From 7e7541e6918a6f7b3c121606eaef6cb94c6be20a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 19 Jun 2019 20:36:05 +0000 Subject: [PATCH 1/4] Generated from 072d6202fc3d3e1b4dac90bc03f4f135ca811129 update readme.go.md --- .../mgmt/vmwarecloudsimple/models.go | 395 ++ .../vmwarecloudsimpleapi/models.go | 37 + .../mgmt/vmwarecloudsimple/models.go | 395 ++ .../vmwarecloudsimpleapi/models.go | 37 + .../vmwarecloudsimple/availableoperations.go | 147 + .../2019-04-01/vmwarecloudsimple/client.go | 212 ++ .../vmwarecloudsimple/dedicatedcloudnode.go | 641 ++++ .../dedicatedcloudservice.go | 618 ++++ .../2019-04-01/vmwarecloudsimple/models.go | 3262 +++++++++++++++++ .../vmwarecloudsimple/privatecloudbyregion.go | 152 + .../vmwarecloudsimple/resourcepoolbypc.go | 119 + .../vmwarecloudsimple/resourcepoolsbypc.go | 155 + .../skusavailabilitywithinregion.go | 158 + .../vmwarecloudsimple/usageswithinregion.go | 158 + .../2019-04-01/vmwarecloudsimple/version.go | 30 + .../vmwarecloudsimple/virtualmachine.go | 790 ++++ .../virtualmachinetemplatebypc.go | 119 + .../virtualmachinetemplatesbypc.go | 157 + .../vmwarecloudsimple/virtualnetworkbypc.go | 119 + .../vmwarecloudsimple/virtualnetworksbypc.go | 157 + .../vmwarecloudsimpleapi/interfaces.go | 140 + 21 files changed, 7998 insertions(+) create mode 100644 profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go create mode 100644 profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go create mode 100644 profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go create mode 100644 profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/availableoperations.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/client.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/dedicatedcloudnode.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/dedicatedcloudservice.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/privatecloudbyregion.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolbypc.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolsbypc.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/skusavailabilitywithinregion.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/usageswithinregion.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/version.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualmachine.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualmachinetemplatebypc.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualmachinetemplatesbypc.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualnetworkbypc.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualnetworksbypc.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi/interfaces.go diff --git a/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go b/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go new file mode 100644 index 000000000000..833f6b13afd5 --- /dev/null +++ b/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go @@ -0,0 +1,395 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package vmwarecloudsimple + +import ( + "context" + + original "github.com/Azure/azure-sdk-for-go/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple" +) + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type AggregationType = original.AggregationType + +const ( + Average AggregationType = original.Average + Total AggregationType = original.Total +) + +type DiskIndependenceMode = original.DiskIndependenceMode + +const ( + IndependentNonpersistent DiskIndependenceMode = original.IndependentNonpersistent + IndependentPersistent DiskIndependenceMode = original.IndependentPersistent + Persistent DiskIndependenceMode = original.Persistent +) + +type GuestOSType = original.GuestOSType + +const ( + Linux GuestOSType = original.Linux + Other GuestOSType = original.Other + Windows GuestOSType = original.Windows +) + +type NICType = original.NICType + +const ( + E1000 NICType = original.E1000 + E1000E NICType = original.E1000E + PCNET32 NICType = original.PCNET32 + VMXNET NICType = original.VMXNET + VMXNET2 NICType = original.VMXNET2 + VMXNET3 NICType = original.VMXNET3 +) + +type NodeStatus = original.NodeStatus + +const ( + Unused NodeStatus = original.Unused + Used NodeStatus = original.Used +) + +type OnboardingStatus = original.OnboardingStatus + +const ( + NotOnBoarded OnboardingStatus = original.NotOnBoarded + OnBoarded OnboardingStatus = original.OnBoarded + OnBoarding OnboardingStatus = original.OnBoarding + OnBoardingFailed OnboardingStatus = original.OnBoardingFailed +) + +type OperationOrigin = original.OperationOrigin + +const ( + System OperationOrigin = original.System + User OperationOrigin = original.User + Usersystem OperationOrigin = original.Usersystem +) + +type PrivateCloudResourceType = original.PrivateCloudResourceType + +const ( + MicrosoftVMwareCloudSimpleprivateClouds PrivateCloudResourceType = original.MicrosoftVMwareCloudSimpleprivateClouds +) + +type StopMode = original.StopMode + +const ( + Poweroff StopMode = original.Poweroff + Reboot StopMode = original.Reboot + Shutdown StopMode = original.Shutdown + Suspend StopMode = original.Suspend +) + +type UsageCount = original.UsageCount + +const ( + Bytes UsageCount = original.Bytes + BytesPerSecond UsageCount = original.BytesPerSecond + Count UsageCount = original.Count + CountPerSecond UsageCount = original.CountPerSecond + Percent UsageCount = original.Percent + Seconds UsageCount = original.Seconds +) + +type VirtualMachineStatus = original.VirtualMachineStatus + +const ( + Deallocating VirtualMachineStatus = original.Deallocating + Deleting VirtualMachineStatus = original.Deleting + Poweredoff VirtualMachineStatus = original.Poweredoff + Running VirtualMachineStatus = original.Running + Suspended VirtualMachineStatus = original.Suspended + Updating VirtualMachineStatus = original.Updating +) + +type AvailableOperation = original.AvailableOperation +type AvailableOperationDisplay = original.AvailableOperationDisplay +type AvailableOperationDisplayPropertyServiceSpecification = original.AvailableOperationDisplayPropertyServiceSpecification +type AvailableOperationDisplayPropertyServiceSpecificationMetricsItem = original.AvailableOperationDisplayPropertyServiceSpecificationMetricsItem +type AvailableOperationDisplayPropertyServiceSpecificationMetricsList = original.AvailableOperationDisplayPropertyServiceSpecificationMetricsList +type AvailableOperationsClient = original.AvailableOperationsClient +type AvailableOperationsListResponse = original.AvailableOperationsListResponse +type AvailableOperationsListResponseIterator = original.AvailableOperationsListResponseIterator +type AvailableOperationsListResponsePage = original.AvailableOperationsListResponsePage +type BaseClient = original.BaseClient +type CSRPError = original.CSRPError +type CSRPErrorBody = original.CSRPErrorBody +type DedicatedCloudNode = original.DedicatedCloudNode +type DedicatedCloudNodeClient = original.DedicatedCloudNodeClient +type DedicatedCloudNodeCreateOrUpdateFuture = original.DedicatedCloudNodeCreateOrUpdateFuture +type DedicatedCloudNodeListResponse = original.DedicatedCloudNodeListResponse +type DedicatedCloudNodeListResponseIterator = original.DedicatedCloudNodeListResponseIterator +type DedicatedCloudNodeListResponsePage = original.DedicatedCloudNodeListResponsePage +type DedicatedCloudNodeProperties = original.DedicatedCloudNodeProperties +type DedicatedCloudService = original.DedicatedCloudService +type DedicatedCloudServiceClient = original.DedicatedCloudServiceClient +type DedicatedCloudServiceDeleteFuture = original.DedicatedCloudServiceDeleteFuture +type DedicatedCloudServiceListResponse = original.DedicatedCloudServiceListResponse +type DedicatedCloudServiceListResponseIterator = original.DedicatedCloudServiceListResponseIterator +type DedicatedCloudServiceListResponsePage = original.DedicatedCloudServiceListResponsePage +type DedicatedCloudServiceProperties = original.DedicatedCloudServiceProperties +type GetOperationResultByRegionFuture = original.GetOperationResultByRegionFuture +type OperationError = original.OperationError +type OperationResource = original.OperationResource +type PatchPayload = original.PatchPayload +type PrivateCloud = original.PrivateCloud +type PrivateCloudByRegionClient = original.PrivateCloudByRegionClient +type PrivateCloudList = original.PrivateCloudList +type PrivateCloudListIterator = original.PrivateCloudListIterator +type PrivateCloudListPage = original.PrivateCloudListPage +type PrivateCloudProperties = original.PrivateCloudProperties +type ResourcePool = original.ResourcePool +type ResourcePoolProperties = original.ResourcePoolProperties +type ResourcePoolsListResponse = original.ResourcePoolsListResponse +type ResourcePoolsListResponseIterator = original.ResourcePoolsListResponseIterator +type ResourcePoolsListResponsePage = original.ResourcePoolsListResponsePage +type ResourcepoolByPCClient = original.ResourcepoolByPCClient +type ResourcepoolsByPCClient = original.ResourcepoolsByPCClient +type Sku = original.Sku +type SkuAvailability = original.SkuAvailability +type SkuAvailabilityListResponse = original.SkuAvailabilityListResponse +type SkuAvailabilityListResponseIterator = original.SkuAvailabilityListResponseIterator +type SkuAvailabilityListResponsePage = original.SkuAvailabilityListResponsePage +type SkuDescription = original.SkuDescription +type SkusAvailabilityWithinRegionClient = original.SkusAvailabilityWithinRegionClient +type Usage = original.Usage +type UsageListResponse = original.UsageListResponse +type UsageListResponseIterator = original.UsageListResponseIterator +type UsageListResponsePage = original.UsageListResponsePage +type UsageName = original.UsageName +type UsagesWithinRegionClient = original.UsagesWithinRegionClient +type VirtualDisk = original.VirtualDisk +type VirtualDiskController = original.VirtualDiskController +type VirtualMachine = original.VirtualMachine +type VirtualMachineClient = original.VirtualMachineClient +type VirtualMachineCreateOrUpdateFuture = original.VirtualMachineCreateOrUpdateFuture +type VirtualMachineDeleteFuture = original.VirtualMachineDeleteFuture +type VirtualMachineListResponse = original.VirtualMachineListResponse +type VirtualMachineListResponseIterator = original.VirtualMachineListResponseIterator +type VirtualMachineListResponsePage = original.VirtualMachineListResponsePage +type VirtualMachineProperties = original.VirtualMachineProperties +type VirtualMachineStartFuture = original.VirtualMachineStartFuture +type VirtualMachineStopFuture = original.VirtualMachineStopFuture +type VirtualMachineStopMode = original.VirtualMachineStopMode +type VirtualMachineTemplate = original.VirtualMachineTemplate +type VirtualMachineTemplateByPCClient = original.VirtualMachineTemplateByPCClient +type VirtualMachineTemplateListResponse = original.VirtualMachineTemplateListResponse +type VirtualMachineTemplateListResponseIterator = original.VirtualMachineTemplateListResponseIterator +type VirtualMachineTemplateListResponsePage = original.VirtualMachineTemplateListResponsePage +type VirtualMachineTemplateProperties = original.VirtualMachineTemplateProperties +type VirtualMachineTemplatesByPCClient = original.VirtualMachineTemplatesByPCClient +type VirtualMachineUpdateFuture = original.VirtualMachineUpdateFuture +type VirtualNetwork = original.VirtualNetwork +type VirtualNetworkByPCClient = original.VirtualNetworkByPCClient +type VirtualNetworkListResponse = original.VirtualNetworkListResponse +type VirtualNetworkListResponseIterator = original.VirtualNetworkListResponseIterator +type VirtualNetworkListResponsePage = original.VirtualNetworkListResponsePage +type VirtualNetworkProperties = original.VirtualNetworkProperties +type VirtualNetworksByPCClient = original.VirtualNetworksByPCClient +type VirtualNic = original.VirtualNic + +func New(referer string, regionID string, subscriptionID string) BaseClient { + return original.New(referer, regionID, subscriptionID) +} +func NewAvailableOperationsClient(referer string, regionID string, subscriptionID string) AvailableOperationsClient { + return original.NewAvailableOperationsClient(referer, regionID, subscriptionID) +} +func NewAvailableOperationsClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) AvailableOperationsClient { + return original.NewAvailableOperationsClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewAvailableOperationsListResponseIterator(page AvailableOperationsListResponsePage) AvailableOperationsListResponseIterator { + return original.NewAvailableOperationsListResponseIterator(page) +} +func NewAvailableOperationsListResponsePage(getNextPage func(context.Context, AvailableOperationsListResponse) (AvailableOperationsListResponse, error)) AvailableOperationsListResponsePage { + return original.NewAvailableOperationsListResponsePage(getNextPage) +} +func NewDedicatedCloudNodeClient(referer string, regionID string, subscriptionID string) DedicatedCloudNodeClient { + return original.NewDedicatedCloudNodeClient(referer, regionID, subscriptionID) +} +func NewDedicatedCloudNodeClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) DedicatedCloudNodeClient { + return original.NewDedicatedCloudNodeClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewDedicatedCloudNodeListResponseIterator(page DedicatedCloudNodeListResponsePage) DedicatedCloudNodeListResponseIterator { + return original.NewDedicatedCloudNodeListResponseIterator(page) +} +func NewDedicatedCloudNodeListResponsePage(getNextPage func(context.Context, DedicatedCloudNodeListResponse) (DedicatedCloudNodeListResponse, error)) DedicatedCloudNodeListResponsePage { + return original.NewDedicatedCloudNodeListResponsePage(getNextPage) +} +func NewDedicatedCloudServiceClient(referer string, regionID string, subscriptionID string) DedicatedCloudServiceClient { + return original.NewDedicatedCloudServiceClient(referer, regionID, subscriptionID) +} +func NewDedicatedCloudServiceClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) DedicatedCloudServiceClient { + return original.NewDedicatedCloudServiceClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewDedicatedCloudServiceListResponseIterator(page DedicatedCloudServiceListResponsePage) DedicatedCloudServiceListResponseIterator { + return original.NewDedicatedCloudServiceListResponseIterator(page) +} +func NewDedicatedCloudServiceListResponsePage(getNextPage func(context.Context, DedicatedCloudServiceListResponse) (DedicatedCloudServiceListResponse, error)) DedicatedCloudServiceListResponsePage { + return original.NewDedicatedCloudServiceListResponsePage(getNextPage) +} +func NewPrivateCloudByRegionClient(referer string, regionID string, subscriptionID string) PrivateCloudByRegionClient { + return original.NewPrivateCloudByRegionClient(referer, regionID, subscriptionID) +} +func NewPrivateCloudByRegionClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) PrivateCloudByRegionClient { + return original.NewPrivateCloudByRegionClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewPrivateCloudListIterator(page PrivateCloudListPage) PrivateCloudListIterator { + return original.NewPrivateCloudListIterator(page) +} +func NewPrivateCloudListPage(getNextPage func(context.Context, PrivateCloudList) (PrivateCloudList, error)) PrivateCloudListPage { + return original.NewPrivateCloudListPage(getNextPage) +} +func NewResourcePoolsListResponseIterator(page ResourcePoolsListResponsePage) ResourcePoolsListResponseIterator { + return original.NewResourcePoolsListResponseIterator(page) +} +func NewResourcePoolsListResponsePage(getNextPage func(context.Context, ResourcePoolsListResponse) (ResourcePoolsListResponse, error)) ResourcePoolsListResponsePage { + return original.NewResourcePoolsListResponsePage(getNextPage) +} +func NewResourcepoolByPCClient(referer string, regionID string, subscriptionID string) ResourcepoolByPCClient { + return original.NewResourcepoolByPCClient(referer, regionID, subscriptionID) +} +func NewResourcepoolByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcepoolByPCClient { + return original.NewResourcepoolByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewResourcepoolsByPCClient(referer string, regionID string, subscriptionID string) ResourcepoolsByPCClient { + return original.NewResourcepoolsByPCClient(referer, regionID, subscriptionID) +} +func NewResourcepoolsByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcepoolsByPCClient { + return original.NewResourcepoolsByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewSkuAvailabilityListResponseIterator(page SkuAvailabilityListResponsePage) SkuAvailabilityListResponseIterator { + return original.NewSkuAvailabilityListResponseIterator(page) +} +func NewSkuAvailabilityListResponsePage(getNextPage func(context.Context, SkuAvailabilityListResponse) (SkuAvailabilityListResponse, error)) SkuAvailabilityListResponsePage { + return original.NewSkuAvailabilityListResponsePage(getNextPage) +} +func NewSkusAvailabilityWithinRegionClient(referer string, regionID string, subscriptionID string) SkusAvailabilityWithinRegionClient { + return original.NewSkusAvailabilityWithinRegionClient(referer, regionID, subscriptionID) +} +func NewSkusAvailabilityWithinRegionClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) SkusAvailabilityWithinRegionClient { + return original.NewSkusAvailabilityWithinRegionClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewUsageListResponseIterator(page UsageListResponsePage) UsageListResponseIterator { + return original.NewUsageListResponseIterator(page) +} +func NewUsageListResponsePage(getNextPage func(context.Context, UsageListResponse) (UsageListResponse, error)) UsageListResponsePage { + return original.NewUsageListResponsePage(getNextPage) +} +func NewUsagesWithinRegionClient(referer string, regionID string, subscriptionID string) UsagesWithinRegionClient { + return original.NewUsagesWithinRegionClient(referer, regionID, subscriptionID) +} +func NewUsagesWithinRegionClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) UsagesWithinRegionClient { + return original.NewUsagesWithinRegionClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewVirtualMachineClient(referer string, regionID string, subscriptionID string) VirtualMachineClient { + return original.NewVirtualMachineClient(referer, regionID, subscriptionID) +} +func NewVirtualMachineClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualMachineClient { + return original.NewVirtualMachineClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewVirtualMachineListResponseIterator(page VirtualMachineListResponsePage) VirtualMachineListResponseIterator { + return original.NewVirtualMachineListResponseIterator(page) +} +func NewVirtualMachineListResponsePage(getNextPage func(context.Context, VirtualMachineListResponse) (VirtualMachineListResponse, error)) VirtualMachineListResponsePage { + return original.NewVirtualMachineListResponsePage(getNextPage) +} +func NewVirtualMachineTemplateByPCClient(referer string, regionID string, subscriptionID string) VirtualMachineTemplateByPCClient { + return original.NewVirtualMachineTemplateByPCClient(referer, regionID, subscriptionID) +} +func NewVirtualMachineTemplateByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualMachineTemplateByPCClient { + return original.NewVirtualMachineTemplateByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewVirtualMachineTemplateListResponseIterator(page VirtualMachineTemplateListResponsePage) VirtualMachineTemplateListResponseIterator { + return original.NewVirtualMachineTemplateListResponseIterator(page) +} +func NewVirtualMachineTemplateListResponsePage(getNextPage func(context.Context, VirtualMachineTemplateListResponse) (VirtualMachineTemplateListResponse, error)) VirtualMachineTemplateListResponsePage { + return original.NewVirtualMachineTemplateListResponsePage(getNextPage) +} +func NewVirtualMachineTemplatesByPCClient(referer string, regionID string, subscriptionID string) VirtualMachineTemplatesByPCClient { + return original.NewVirtualMachineTemplatesByPCClient(referer, regionID, subscriptionID) +} +func NewVirtualMachineTemplatesByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualMachineTemplatesByPCClient { + return original.NewVirtualMachineTemplatesByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewVirtualNetworkByPCClient(referer string, regionID string, subscriptionID string) VirtualNetworkByPCClient { + return original.NewVirtualNetworkByPCClient(referer, regionID, subscriptionID) +} +func NewVirtualNetworkByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualNetworkByPCClient { + return original.NewVirtualNetworkByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewVirtualNetworkListResponseIterator(page VirtualNetworkListResponsePage) VirtualNetworkListResponseIterator { + return original.NewVirtualNetworkListResponseIterator(page) +} +func NewVirtualNetworkListResponsePage(getNextPage func(context.Context, VirtualNetworkListResponse) (VirtualNetworkListResponse, error)) VirtualNetworkListResponsePage { + return original.NewVirtualNetworkListResponsePage(getNextPage) +} +func NewVirtualNetworksByPCClient(referer string, regionID string, subscriptionID string) VirtualNetworksByPCClient { + return original.NewVirtualNetworksByPCClient(referer, regionID, subscriptionID) +} +func NewVirtualNetworksByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualNetworksByPCClient { + return original.NewVirtualNetworksByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func PossibleAggregationTypeValues() []AggregationType { + return original.PossibleAggregationTypeValues() +} +func PossibleDiskIndependenceModeValues() []DiskIndependenceMode { + return original.PossibleDiskIndependenceModeValues() +} +func PossibleGuestOSTypeValues() []GuestOSType { + return original.PossibleGuestOSTypeValues() +} +func PossibleNICTypeValues() []NICType { + return original.PossibleNICTypeValues() +} +func PossibleNodeStatusValues() []NodeStatus { + return original.PossibleNodeStatusValues() +} +func PossibleOnboardingStatusValues() []OnboardingStatus { + return original.PossibleOnboardingStatusValues() +} +func PossibleOperationOriginValues() []OperationOrigin { + return original.PossibleOperationOriginValues() +} +func PossiblePrivateCloudResourceTypeValues() []PrivateCloudResourceType { + return original.PossiblePrivateCloudResourceTypeValues() +} +func PossibleStopModeValues() []StopMode { + return original.PossibleStopModeValues() +} +func PossibleUsageCountValues() []UsageCount { + return original.PossibleUsageCountValues() +} +func PossibleVirtualMachineStatusValues() []VirtualMachineStatus { + return original.PossibleVirtualMachineStatusValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/latest" +} +func Version() string { + return original.Version() +} diff --git a/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go b/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go new file mode 100644 index 000000000000..7f422f4451b3 --- /dev/null +++ b/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go @@ -0,0 +1,37 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package vmwarecloudsimpleapi + +import original "github.com/Azure/azure-sdk-for-go/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi" + +type AvailableOperationsClientAPI = original.AvailableOperationsClientAPI +type BaseClientAPI = original.BaseClientAPI +type DedicatedCloudNodeClientAPI = original.DedicatedCloudNodeClientAPI +type DedicatedCloudServiceClientAPI = original.DedicatedCloudServiceClientAPI +type PrivateCloudByRegionClientAPI = original.PrivateCloudByRegionClientAPI +type ResourcepoolByPCClientAPI = original.ResourcepoolByPCClientAPI +type ResourcepoolsByPCClientAPI = original.ResourcepoolsByPCClientAPI +type SkusAvailabilityWithinRegionClientAPI = original.SkusAvailabilityWithinRegionClientAPI +type UsagesWithinRegionClientAPI = original.UsagesWithinRegionClientAPI +type VirtualMachineClientAPI = original.VirtualMachineClientAPI +type VirtualMachineTemplateByPCClientAPI = original.VirtualMachineTemplateByPCClientAPI +type VirtualMachineTemplatesByPCClientAPI = original.VirtualMachineTemplatesByPCClientAPI +type VirtualNetworkByPCClientAPI = original.VirtualNetworkByPCClientAPI +type VirtualNetworksByPCClientAPI = original.VirtualNetworksByPCClientAPI diff --git a/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go b/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go new file mode 100644 index 000000000000..a56a6f844aa7 --- /dev/null +++ b/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go @@ -0,0 +1,395 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package vmwarecloudsimple + +import ( + "context" + + original "github.com/Azure/azure-sdk-for-go/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple" +) + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type AggregationType = original.AggregationType + +const ( + Average AggregationType = original.Average + Total AggregationType = original.Total +) + +type DiskIndependenceMode = original.DiskIndependenceMode + +const ( + IndependentNonpersistent DiskIndependenceMode = original.IndependentNonpersistent + IndependentPersistent DiskIndependenceMode = original.IndependentPersistent + Persistent DiskIndependenceMode = original.Persistent +) + +type GuestOSType = original.GuestOSType + +const ( + Linux GuestOSType = original.Linux + Other GuestOSType = original.Other + Windows GuestOSType = original.Windows +) + +type NICType = original.NICType + +const ( + E1000 NICType = original.E1000 + E1000E NICType = original.E1000E + PCNET32 NICType = original.PCNET32 + VMXNET NICType = original.VMXNET + VMXNET2 NICType = original.VMXNET2 + VMXNET3 NICType = original.VMXNET3 +) + +type NodeStatus = original.NodeStatus + +const ( + Unused NodeStatus = original.Unused + Used NodeStatus = original.Used +) + +type OnboardingStatus = original.OnboardingStatus + +const ( + NotOnBoarded OnboardingStatus = original.NotOnBoarded + OnBoarded OnboardingStatus = original.OnBoarded + OnBoarding OnboardingStatus = original.OnBoarding + OnBoardingFailed OnboardingStatus = original.OnBoardingFailed +) + +type OperationOrigin = original.OperationOrigin + +const ( + System OperationOrigin = original.System + User OperationOrigin = original.User + Usersystem OperationOrigin = original.Usersystem +) + +type PrivateCloudResourceType = original.PrivateCloudResourceType + +const ( + MicrosoftVMwareCloudSimpleprivateClouds PrivateCloudResourceType = original.MicrosoftVMwareCloudSimpleprivateClouds +) + +type StopMode = original.StopMode + +const ( + Poweroff StopMode = original.Poweroff + Reboot StopMode = original.Reboot + Shutdown StopMode = original.Shutdown + Suspend StopMode = original.Suspend +) + +type UsageCount = original.UsageCount + +const ( + Bytes UsageCount = original.Bytes + BytesPerSecond UsageCount = original.BytesPerSecond + Count UsageCount = original.Count + CountPerSecond UsageCount = original.CountPerSecond + Percent UsageCount = original.Percent + Seconds UsageCount = original.Seconds +) + +type VirtualMachineStatus = original.VirtualMachineStatus + +const ( + Deallocating VirtualMachineStatus = original.Deallocating + Deleting VirtualMachineStatus = original.Deleting + Poweredoff VirtualMachineStatus = original.Poweredoff + Running VirtualMachineStatus = original.Running + Suspended VirtualMachineStatus = original.Suspended + Updating VirtualMachineStatus = original.Updating +) + +type AvailableOperation = original.AvailableOperation +type AvailableOperationDisplay = original.AvailableOperationDisplay +type AvailableOperationDisplayPropertyServiceSpecification = original.AvailableOperationDisplayPropertyServiceSpecification +type AvailableOperationDisplayPropertyServiceSpecificationMetricsItem = original.AvailableOperationDisplayPropertyServiceSpecificationMetricsItem +type AvailableOperationDisplayPropertyServiceSpecificationMetricsList = original.AvailableOperationDisplayPropertyServiceSpecificationMetricsList +type AvailableOperationsClient = original.AvailableOperationsClient +type AvailableOperationsListResponse = original.AvailableOperationsListResponse +type AvailableOperationsListResponseIterator = original.AvailableOperationsListResponseIterator +type AvailableOperationsListResponsePage = original.AvailableOperationsListResponsePage +type BaseClient = original.BaseClient +type CSRPError = original.CSRPError +type CSRPErrorBody = original.CSRPErrorBody +type DedicatedCloudNode = original.DedicatedCloudNode +type DedicatedCloudNodeClient = original.DedicatedCloudNodeClient +type DedicatedCloudNodeCreateOrUpdateFuture = original.DedicatedCloudNodeCreateOrUpdateFuture +type DedicatedCloudNodeListResponse = original.DedicatedCloudNodeListResponse +type DedicatedCloudNodeListResponseIterator = original.DedicatedCloudNodeListResponseIterator +type DedicatedCloudNodeListResponsePage = original.DedicatedCloudNodeListResponsePage +type DedicatedCloudNodeProperties = original.DedicatedCloudNodeProperties +type DedicatedCloudService = original.DedicatedCloudService +type DedicatedCloudServiceClient = original.DedicatedCloudServiceClient +type DedicatedCloudServiceDeleteFuture = original.DedicatedCloudServiceDeleteFuture +type DedicatedCloudServiceListResponse = original.DedicatedCloudServiceListResponse +type DedicatedCloudServiceListResponseIterator = original.DedicatedCloudServiceListResponseIterator +type DedicatedCloudServiceListResponsePage = original.DedicatedCloudServiceListResponsePage +type DedicatedCloudServiceProperties = original.DedicatedCloudServiceProperties +type GetOperationResultByRegionFuture = original.GetOperationResultByRegionFuture +type OperationError = original.OperationError +type OperationResource = original.OperationResource +type PatchPayload = original.PatchPayload +type PrivateCloud = original.PrivateCloud +type PrivateCloudByRegionClient = original.PrivateCloudByRegionClient +type PrivateCloudList = original.PrivateCloudList +type PrivateCloudListIterator = original.PrivateCloudListIterator +type PrivateCloudListPage = original.PrivateCloudListPage +type PrivateCloudProperties = original.PrivateCloudProperties +type ResourcePool = original.ResourcePool +type ResourcePoolProperties = original.ResourcePoolProperties +type ResourcePoolsListResponse = original.ResourcePoolsListResponse +type ResourcePoolsListResponseIterator = original.ResourcePoolsListResponseIterator +type ResourcePoolsListResponsePage = original.ResourcePoolsListResponsePage +type ResourcepoolByPCClient = original.ResourcepoolByPCClient +type ResourcepoolsByPCClient = original.ResourcepoolsByPCClient +type Sku = original.Sku +type SkuAvailability = original.SkuAvailability +type SkuAvailabilityListResponse = original.SkuAvailabilityListResponse +type SkuAvailabilityListResponseIterator = original.SkuAvailabilityListResponseIterator +type SkuAvailabilityListResponsePage = original.SkuAvailabilityListResponsePage +type SkuDescription = original.SkuDescription +type SkusAvailabilityWithinRegionClient = original.SkusAvailabilityWithinRegionClient +type Usage = original.Usage +type UsageListResponse = original.UsageListResponse +type UsageListResponseIterator = original.UsageListResponseIterator +type UsageListResponsePage = original.UsageListResponsePage +type UsageName = original.UsageName +type UsagesWithinRegionClient = original.UsagesWithinRegionClient +type VirtualDisk = original.VirtualDisk +type VirtualDiskController = original.VirtualDiskController +type VirtualMachine = original.VirtualMachine +type VirtualMachineClient = original.VirtualMachineClient +type VirtualMachineCreateOrUpdateFuture = original.VirtualMachineCreateOrUpdateFuture +type VirtualMachineDeleteFuture = original.VirtualMachineDeleteFuture +type VirtualMachineListResponse = original.VirtualMachineListResponse +type VirtualMachineListResponseIterator = original.VirtualMachineListResponseIterator +type VirtualMachineListResponsePage = original.VirtualMachineListResponsePage +type VirtualMachineProperties = original.VirtualMachineProperties +type VirtualMachineStartFuture = original.VirtualMachineStartFuture +type VirtualMachineStopFuture = original.VirtualMachineStopFuture +type VirtualMachineStopMode = original.VirtualMachineStopMode +type VirtualMachineTemplate = original.VirtualMachineTemplate +type VirtualMachineTemplateByPCClient = original.VirtualMachineTemplateByPCClient +type VirtualMachineTemplateListResponse = original.VirtualMachineTemplateListResponse +type VirtualMachineTemplateListResponseIterator = original.VirtualMachineTemplateListResponseIterator +type VirtualMachineTemplateListResponsePage = original.VirtualMachineTemplateListResponsePage +type VirtualMachineTemplateProperties = original.VirtualMachineTemplateProperties +type VirtualMachineTemplatesByPCClient = original.VirtualMachineTemplatesByPCClient +type VirtualMachineUpdateFuture = original.VirtualMachineUpdateFuture +type VirtualNetwork = original.VirtualNetwork +type VirtualNetworkByPCClient = original.VirtualNetworkByPCClient +type VirtualNetworkListResponse = original.VirtualNetworkListResponse +type VirtualNetworkListResponseIterator = original.VirtualNetworkListResponseIterator +type VirtualNetworkListResponsePage = original.VirtualNetworkListResponsePage +type VirtualNetworkProperties = original.VirtualNetworkProperties +type VirtualNetworksByPCClient = original.VirtualNetworksByPCClient +type VirtualNic = original.VirtualNic + +func New(referer string, regionID string, subscriptionID string) BaseClient { + return original.New(referer, regionID, subscriptionID) +} +func NewAvailableOperationsClient(referer string, regionID string, subscriptionID string) AvailableOperationsClient { + return original.NewAvailableOperationsClient(referer, regionID, subscriptionID) +} +func NewAvailableOperationsClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) AvailableOperationsClient { + return original.NewAvailableOperationsClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewAvailableOperationsListResponseIterator(page AvailableOperationsListResponsePage) AvailableOperationsListResponseIterator { + return original.NewAvailableOperationsListResponseIterator(page) +} +func NewAvailableOperationsListResponsePage(getNextPage func(context.Context, AvailableOperationsListResponse) (AvailableOperationsListResponse, error)) AvailableOperationsListResponsePage { + return original.NewAvailableOperationsListResponsePage(getNextPage) +} +func NewDedicatedCloudNodeClient(referer string, regionID string, subscriptionID string) DedicatedCloudNodeClient { + return original.NewDedicatedCloudNodeClient(referer, regionID, subscriptionID) +} +func NewDedicatedCloudNodeClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) DedicatedCloudNodeClient { + return original.NewDedicatedCloudNodeClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewDedicatedCloudNodeListResponseIterator(page DedicatedCloudNodeListResponsePage) DedicatedCloudNodeListResponseIterator { + return original.NewDedicatedCloudNodeListResponseIterator(page) +} +func NewDedicatedCloudNodeListResponsePage(getNextPage func(context.Context, DedicatedCloudNodeListResponse) (DedicatedCloudNodeListResponse, error)) DedicatedCloudNodeListResponsePage { + return original.NewDedicatedCloudNodeListResponsePage(getNextPage) +} +func NewDedicatedCloudServiceClient(referer string, regionID string, subscriptionID string) DedicatedCloudServiceClient { + return original.NewDedicatedCloudServiceClient(referer, regionID, subscriptionID) +} +func NewDedicatedCloudServiceClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) DedicatedCloudServiceClient { + return original.NewDedicatedCloudServiceClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewDedicatedCloudServiceListResponseIterator(page DedicatedCloudServiceListResponsePage) DedicatedCloudServiceListResponseIterator { + return original.NewDedicatedCloudServiceListResponseIterator(page) +} +func NewDedicatedCloudServiceListResponsePage(getNextPage func(context.Context, DedicatedCloudServiceListResponse) (DedicatedCloudServiceListResponse, error)) DedicatedCloudServiceListResponsePage { + return original.NewDedicatedCloudServiceListResponsePage(getNextPage) +} +func NewPrivateCloudByRegionClient(referer string, regionID string, subscriptionID string) PrivateCloudByRegionClient { + return original.NewPrivateCloudByRegionClient(referer, regionID, subscriptionID) +} +func NewPrivateCloudByRegionClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) PrivateCloudByRegionClient { + return original.NewPrivateCloudByRegionClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewPrivateCloudListIterator(page PrivateCloudListPage) PrivateCloudListIterator { + return original.NewPrivateCloudListIterator(page) +} +func NewPrivateCloudListPage(getNextPage func(context.Context, PrivateCloudList) (PrivateCloudList, error)) PrivateCloudListPage { + return original.NewPrivateCloudListPage(getNextPage) +} +func NewResourcePoolsListResponseIterator(page ResourcePoolsListResponsePage) ResourcePoolsListResponseIterator { + return original.NewResourcePoolsListResponseIterator(page) +} +func NewResourcePoolsListResponsePage(getNextPage func(context.Context, ResourcePoolsListResponse) (ResourcePoolsListResponse, error)) ResourcePoolsListResponsePage { + return original.NewResourcePoolsListResponsePage(getNextPage) +} +func NewResourcepoolByPCClient(referer string, regionID string, subscriptionID string) ResourcepoolByPCClient { + return original.NewResourcepoolByPCClient(referer, regionID, subscriptionID) +} +func NewResourcepoolByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcepoolByPCClient { + return original.NewResourcepoolByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewResourcepoolsByPCClient(referer string, regionID string, subscriptionID string) ResourcepoolsByPCClient { + return original.NewResourcepoolsByPCClient(referer, regionID, subscriptionID) +} +func NewResourcepoolsByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcepoolsByPCClient { + return original.NewResourcepoolsByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewSkuAvailabilityListResponseIterator(page SkuAvailabilityListResponsePage) SkuAvailabilityListResponseIterator { + return original.NewSkuAvailabilityListResponseIterator(page) +} +func NewSkuAvailabilityListResponsePage(getNextPage func(context.Context, SkuAvailabilityListResponse) (SkuAvailabilityListResponse, error)) SkuAvailabilityListResponsePage { + return original.NewSkuAvailabilityListResponsePage(getNextPage) +} +func NewSkusAvailabilityWithinRegionClient(referer string, regionID string, subscriptionID string) SkusAvailabilityWithinRegionClient { + return original.NewSkusAvailabilityWithinRegionClient(referer, regionID, subscriptionID) +} +func NewSkusAvailabilityWithinRegionClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) SkusAvailabilityWithinRegionClient { + return original.NewSkusAvailabilityWithinRegionClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewUsageListResponseIterator(page UsageListResponsePage) UsageListResponseIterator { + return original.NewUsageListResponseIterator(page) +} +func NewUsageListResponsePage(getNextPage func(context.Context, UsageListResponse) (UsageListResponse, error)) UsageListResponsePage { + return original.NewUsageListResponsePage(getNextPage) +} +func NewUsagesWithinRegionClient(referer string, regionID string, subscriptionID string) UsagesWithinRegionClient { + return original.NewUsagesWithinRegionClient(referer, regionID, subscriptionID) +} +func NewUsagesWithinRegionClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) UsagesWithinRegionClient { + return original.NewUsagesWithinRegionClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewVirtualMachineClient(referer string, regionID string, subscriptionID string) VirtualMachineClient { + return original.NewVirtualMachineClient(referer, regionID, subscriptionID) +} +func NewVirtualMachineClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualMachineClient { + return original.NewVirtualMachineClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewVirtualMachineListResponseIterator(page VirtualMachineListResponsePage) VirtualMachineListResponseIterator { + return original.NewVirtualMachineListResponseIterator(page) +} +func NewVirtualMachineListResponsePage(getNextPage func(context.Context, VirtualMachineListResponse) (VirtualMachineListResponse, error)) VirtualMachineListResponsePage { + return original.NewVirtualMachineListResponsePage(getNextPage) +} +func NewVirtualMachineTemplateByPCClient(referer string, regionID string, subscriptionID string) VirtualMachineTemplateByPCClient { + return original.NewVirtualMachineTemplateByPCClient(referer, regionID, subscriptionID) +} +func NewVirtualMachineTemplateByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualMachineTemplateByPCClient { + return original.NewVirtualMachineTemplateByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewVirtualMachineTemplateListResponseIterator(page VirtualMachineTemplateListResponsePage) VirtualMachineTemplateListResponseIterator { + return original.NewVirtualMachineTemplateListResponseIterator(page) +} +func NewVirtualMachineTemplateListResponsePage(getNextPage func(context.Context, VirtualMachineTemplateListResponse) (VirtualMachineTemplateListResponse, error)) VirtualMachineTemplateListResponsePage { + return original.NewVirtualMachineTemplateListResponsePage(getNextPage) +} +func NewVirtualMachineTemplatesByPCClient(referer string, regionID string, subscriptionID string) VirtualMachineTemplatesByPCClient { + return original.NewVirtualMachineTemplatesByPCClient(referer, regionID, subscriptionID) +} +func NewVirtualMachineTemplatesByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualMachineTemplatesByPCClient { + return original.NewVirtualMachineTemplatesByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewVirtualNetworkByPCClient(referer string, regionID string, subscriptionID string) VirtualNetworkByPCClient { + return original.NewVirtualNetworkByPCClient(referer, regionID, subscriptionID) +} +func NewVirtualNetworkByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualNetworkByPCClient { + return original.NewVirtualNetworkByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewVirtualNetworkListResponseIterator(page VirtualNetworkListResponsePage) VirtualNetworkListResponseIterator { + return original.NewVirtualNetworkListResponseIterator(page) +} +func NewVirtualNetworkListResponsePage(getNextPage func(context.Context, VirtualNetworkListResponse) (VirtualNetworkListResponse, error)) VirtualNetworkListResponsePage { + return original.NewVirtualNetworkListResponsePage(getNextPage) +} +func NewVirtualNetworksByPCClient(referer string, regionID string, subscriptionID string) VirtualNetworksByPCClient { + return original.NewVirtualNetworksByPCClient(referer, regionID, subscriptionID) +} +func NewVirtualNetworksByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualNetworksByPCClient { + return original.NewVirtualNetworksByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func NewWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, referer, regionID, subscriptionID) +} +func PossibleAggregationTypeValues() []AggregationType { + return original.PossibleAggregationTypeValues() +} +func PossibleDiskIndependenceModeValues() []DiskIndependenceMode { + return original.PossibleDiskIndependenceModeValues() +} +func PossibleGuestOSTypeValues() []GuestOSType { + return original.PossibleGuestOSTypeValues() +} +func PossibleNICTypeValues() []NICType { + return original.PossibleNICTypeValues() +} +func PossibleNodeStatusValues() []NodeStatus { + return original.PossibleNodeStatusValues() +} +func PossibleOnboardingStatusValues() []OnboardingStatus { + return original.PossibleOnboardingStatusValues() +} +func PossibleOperationOriginValues() []OperationOrigin { + return original.PossibleOperationOriginValues() +} +func PossiblePrivateCloudResourceTypeValues() []PrivateCloudResourceType { + return original.PossiblePrivateCloudResourceTypeValues() +} +func PossibleStopModeValues() []StopMode { + return original.PossibleStopModeValues() +} +func PossibleUsageCountValues() []UsageCount { + return original.PossibleUsageCountValues() +} +func PossibleVirtualMachineStatusValues() []VirtualMachineStatus { + return original.PossibleVirtualMachineStatusValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go b/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go new file mode 100644 index 000000000000..7f422f4451b3 --- /dev/null +++ b/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go @@ -0,0 +1,37 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package vmwarecloudsimpleapi + +import original "github.com/Azure/azure-sdk-for-go/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi" + +type AvailableOperationsClientAPI = original.AvailableOperationsClientAPI +type BaseClientAPI = original.BaseClientAPI +type DedicatedCloudNodeClientAPI = original.DedicatedCloudNodeClientAPI +type DedicatedCloudServiceClientAPI = original.DedicatedCloudServiceClientAPI +type PrivateCloudByRegionClientAPI = original.PrivateCloudByRegionClientAPI +type ResourcepoolByPCClientAPI = original.ResourcepoolByPCClientAPI +type ResourcepoolsByPCClientAPI = original.ResourcepoolsByPCClientAPI +type SkusAvailabilityWithinRegionClientAPI = original.SkusAvailabilityWithinRegionClientAPI +type UsagesWithinRegionClientAPI = original.UsagesWithinRegionClientAPI +type VirtualMachineClientAPI = original.VirtualMachineClientAPI +type VirtualMachineTemplateByPCClientAPI = original.VirtualMachineTemplateByPCClientAPI +type VirtualMachineTemplatesByPCClientAPI = original.VirtualMachineTemplatesByPCClientAPI +type VirtualNetworkByPCClientAPI = original.VirtualNetworkByPCClientAPI +type VirtualNetworksByPCClientAPI = original.VirtualNetworksByPCClientAPI diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/availableoperations.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/availableoperations.go new file mode 100644 index 000000000000..dcae2d9cc43c --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/availableoperations.go @@ -0,0 +1,147 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AvailableOperationsClient is the description of the new service +type AvailableOperationsClient struct { + BaseClient +} + +// NewAvailableOperationsClient creates an instance of the AvailableOperationsClient client. +func NewAvailableOperationsClient(referer string, regionID string, subscriptionID string) AvailableOperationsClient { + return NewAvailableOperationsClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewAvailableOperationsClientWithBaseURI creates an instance of the AvailableOperationsClient client. +func NewAvailableOperationsClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) AvailableOperationsClient { + return AvailableOperationsClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +} + +// List return list of operations +func (client AvailableOperationsClient) List(ctx context.Context) (result AvailableOperationsListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsClient.List") + defer func() { + sc := -1 + if result.aolr.Response.Response != nil { + sc = result.aolr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.AvailableOperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aolr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.AvailableOperationsClient", "List", resp, "Failure sending request") + return + } + + result.aolr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.AvailableOperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AvailableOperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.VMwareCloudSimple/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AvailableOperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AvailableOperationsClient) ListResponder(resp *http.Response) (result AvailableOperationsListResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AvailableOperationsClient) listNextResults(ctx context.Context, lastResults AvailableOperationsListResponse) (result AvailableOperationsListResponse, err error) { + req, err := lastResults.availableOperationsListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.AvailableOperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.AvailableOperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.AvailableOperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AvailableOperationsClient) ListComplete(ctx context.Context) (result AvailableOperationsListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/client.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/client.go new file mode 100644 index 000000000000..a99d71cd56fe --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/client.go @@ -0,0 +1,212 @@ +// Package vmwarecloudsimple implements the Azure ARM Vmwarecloudsimple service API version 2019-04-01. +// +// Description of the new service +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Vmwarecloudsimple + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Vmwarecloudsimple. +type BaseClient struct { + autorest.Client + BaseURI string + Referer string + RegionID string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(referer string, regionID string, subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + Referer: referer, + RegionID: regionID, + SubscriptionID: subscriptionID, + } +} + +// GetOperationResultByRegion return an async operation +// Parameters: +// operationID - operation id +func (client BaseClient) GetOperationResultByRegion(ctx context.Context, operationID string) (result GetOperationResultByRegionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetOperationResultByRegion") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetOperationResultByRegionPreparer(ctx, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.BaseClient", "GetOperationResultByRegion", nil, "Failure preparing request") + return + } + + result, err = client.GetOperationResultByRegionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.BaseClient", "GetOperationResultByRegion", result.Response(), "Failure sending request") + return + } + + return +} + +// GetOperationResultByRegionPreparer prepares the GetOperationResultByRegion request. +func (client BaseClient) GetOperationResultByRegionPreparer(ctx context.Context, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "operationId": autorest.Encode("path", operationID), + "regionId": autorest.Encode("path", client.RegionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/operationResults/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Referer", client.Referer)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetOperationResultByRegionSender sends the GetOperationResultByRegion request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetOperationResultByRegionSender(req *http.Request) (future GetOperationResultByRegionFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// GetOperationResultByRegionResponder handles the response to the GetOperationResultByRegion request. The method always +// closes the http.Response Body. +func (client BaseClient) GetOperationResultByRegionResponder(resp *http.Response) (result OperationResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPrivateCloud returns private cloud by its name +// Parameters: +// pcName - the private cloud name +func (client BaseClient) GetPrivateCloud(ctx context.Context, pcName string) (result PrivateCloud, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetPrivateCloud") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPrivateCloudPreparer(ctx, pcName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.BaseClient", "GetPrivateCloud", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateCloudSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.BaseClient", "GetPrivateCloud", resp, "Failure sending request") + return + } + + result, err = client.GetPrivateCloudResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.BaseClient", "GetPrivateCloud", resp, "Failure responding to request") + } + + return +} + +// GetPrivateCloudPreparer prepares the GetPrivateCloud request. +func (client BaseClient) GetPrivateCloudPreparer(ctx context.Context, pcName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", client.RegionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateCloudSender sends the GetPrivateCloud request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetPrivateCloudSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateCloudResponder handles the response to the GetPrivateCloud request. The method always +// closes the http.Response Body. +func (client BaseClient) GetPrivateCloudResponder(resp *http.Response) (result PrivateCloud, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/dedicatedcloudnode.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/dedicatedcloudnode.go new file mode 100644 index 000000000000..107a485df7e5 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/dedicatedcloudnode.go @@ -0,0 +1,641 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DedicatedCloudNodeClient is the description of the new service +type DedicatedCloudNodeClient struct { + BaseClient +} + +// NewDedicatedCloudNodeClient creates an instance of the DedicatedCloudNodeClient client. +func NewDedicatedCloudNodeClient(referer string, regionID string, subscriptionID string) DedicatedCloudNodeClient { + return NewDedicatedCloudNodeClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewDedicatedCloudNodeClientWithBaseURI creates an instance of the DedicatedCloudNodeClient client. +func NewDedicatedCloudNodeClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) DedicatedCloudNodeClient { + return DedicatedCloudNodeClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +} + +// CreateOrUpdate returns dedicated cloud node by its name +// Parameters: +// resourceGroupName - the name of the resource group +// dedicatedCloudNodeName - dedicated cloud node name +// dedicatedCloudNodeRequest - create Dedicated Cloud Node request +func (client DedicatedCloudNodeClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest DedicatedCloudNode) (result DedicatedCloudNodeCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodeClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dedicatedCloudNodeName, + Constraints: []validation.Constraint{{Target: "dedicatedCloudNodeName", Name: validation.Pattern, Rule: `^[-a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: dedicatedCloudNodeRequest, + Constraints: []validation.Constraint{{Target: "dedicatedCloudNodeRequest.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "dedicatedCloudNodeRequest.Name", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "dedicatedCloudNodeRequest.Name", Name: validation.Pattern, Rule: `^[-a-zA-Z0-9]+$`, Chain: nil}}}, + {Target: "dedicatedCloudNodeRequest.DedicatedCloudNodeProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "dedicatedCloudNodeRequest.DedicatedCloudNodeProperties.AvailabilityZoneID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "dedicatedCloudNodeRequest.DedicatedCloudNodeProperties.NodesCount", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "dedicatedCloudNodeRequest.DedicatedCloudNodeProperties.PlacementGroupID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "dedicatedCloudNodeRequest.DedicatedCloudNodeProperties.PurchaseID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "dedicatedCloudNodeRequest.DedicatedCloudNodeProperties.SkuDescription", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "dedicatedCloudNodeRequest.DedicatedCloudNodeProperties.SkuDescription.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "dedicatedCloudNodeRequest.DedicatedCloudNodeProperties.SkuDescription.Name", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + {Target: "dedicatedCloudNodeRequest.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "dedicatedCloudNodeRequest.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("vmwarecloudsimple.DedicatedCloudNodeClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, dedicatedCloudNodeName, dedicatedCloudNodeRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DedicatedCloudNodeClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest DedicatedCloudNode) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dedicatedCloudNodeName": autorest.Encode("path", dedicatedCloudNodeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + dedicatedCloudNodeRequest.ID = nil + dedicatedCloudNodeRequest.Name = nil + dedicatedCloudNodeRequest.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}", pathParameters), + autorest.WithJSON(dedicatedCloudNodeRequest), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Referer", client.Referer)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DedicatedCloudNodeClient) CreateOrUpdateSender(req *http.Request) (future DedicatedCloudNodeCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DedicatedCloudNodeClient) CreateOrUpdateResponder(resp *http.Response) (result DedicatedCloudNode, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete dedicated cloud node +// Parameters: +// resourceGroupName - the name of the resource group +// dedicatedCloudNodeName - dedicated cloud node name +func (client DedicatedCloudNodeClient) Delete(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodeClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dedicatedCloudNodeName, + Constraints: []validation.Constraint{{Target: "dedicatedCloudNodeName", Name: validation.Pattern, Rule: `^[-a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("vmwarecloudsimple.DedicatedCloudNodeClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, dedicatedCloudNodeName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DedicatedCloudNodeClient) DeletePreparer(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dedicatedCloudNodeName": autorest.Encode("path", dedicatedCloudNodeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DedicatedCloudNodeClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DedicatedCloudNodeClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns dedicated cloud node +// Parameters: +// resourceGroupName - the name of the resource group +// dedicatedCloudNodeName - dedicated cloud node name +func (client DedicatedCloudNodeClient) Get(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string) (result DedicatedCloudNode, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodeClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dedicatedCloudNodeName, + Constraints: []validation.Constraint{{Target: "dedicatedCloudNodeName", Name: validation.Pattern, Rule: `^[-a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("vmwarecloudsimple.DedicatedCloudNodeClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, dedicatedCloudNodeName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DedicatedCloudNodeClient) GetPreparer(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dedicatedCloudNodeName": autorest.Encode("path", dedicatedCloudNodeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DedicatedCloudNodeClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DedicatedCloudNodeClient) GetResponder(resp *http.Response) (result DedicatedCloudNode, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup returns list of dedicate cloud nodes within resource group +// Parameters: +// resourceGroupName - the name of the resource group +// filter - the filter to apply on the list operation +// top - the maximum number of record sets to return +// skipToken - to be used by nextLink implementation +func (client DedicatedCloudNodeClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result DedicatedCloudNodeListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodeClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.dcnlr.Response.Response != nil { + sc = result.dcnlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dcnlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dcnlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DedicatedCloudNodeClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DedicatedCloudNodeClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DedicatedCloudNodeClient) ListByResourceGroupResponder(resp *http.Response) (result DedicatedCloudNodeListResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client DedicatedCloudNodeClient) listByResourceGroupNextResults(ctx context.Context, lastResults DedicatedCloudNodeListResponse) (result DedicatedCloudNodeListResponse, err error) { + req, err := lastResults.dedicatedCloudNodeListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DedicatedCloudNodeClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result DedicatedCloudNodeListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodeClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter, top, skipToken) + return +} + +// ListBySubscription returns list of dedicate cloud nodes within subscription +// Parameters: +// filter - the filter to apply on the list operation +// top - the maximum number of record sets to return +// skipToken - to be used by nextLink implementation +func (client DedicatedCloudNodeClient) ListBySubscription(ctx context.Context, filter string, top *int32, skipToken string) (result DedicatedCloudNodeListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodeClient.ListBySubscription") + defer func() { + sc := -1 + if result.dcnlr.Response.Response != nil { + sc = result.dcnlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, filter, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.dcnlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.dcnlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client DedicatedCloudNodeClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client DedicatedCloudNodeClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client DedicatedCloudNodeClient) ListBySubscriptionResponder(resp *http.Response) (result DedicatedCloudNodeListResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client DedicatedCloudNodeClient) listBySubscriptionNextResults(ctx context.Context, lastResults DedicatedCloudNodeListResponse) (result DedicatedCloudNodeListResponse, err error) { + req, err := lastResults.dedicatedCloudNodeListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client DedicatedCloudNodeClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32, skipToken string) (result DedicatedCloudNodeListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodeClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx, filter, top, skipToken) + return +} + +// Update patches dedicated node properties +// Parameters: +// resourceGroupName - the name of the resource group +// dedicatedCloudNodeName - dedicated cloud node name +// dedicatedCloudNodeRequest - patch Dedicated Cloud Node request +func (client DedicatedCloudNodeClient) Update(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest PatchPayload) (result DedicatedCloudNode, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodeClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dedicatedCloudNodeName, + Constraints: []validation.Constraint{{Target: "dedicatedCloudNodeName", Name: validation.Pattern, Rule: `^[-a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("vmwarecloudsimple.DedicatedCloudNodeClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, dedicatedCloudNodeName, dedicatedCloudNodeRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DedicatedCloudNodeClient) UpdatePreparer(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest PatchPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dedicatedCloudNodeName": autorest.Encode("path", dedicatedCloudNodeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}", pathParameters), + autorest.WithJSON(dedicatedCloudNodeRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client DedicatedCloudNodeClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DedicatedCloudNodeClient) UpdateResponder(resp *http.Response) (result DedicatedCloudNode, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/dedicatedcloudservice.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/dedicatedcloudservice.go new file mode 100644 index 000000000000..b7c7a071eba4 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/dedicatedcloudservice.go @@ -0,0 +1,618 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DedicatedCloudServiceClient is the description of the new service +type DedicatedCloudServiceClient struct { + BaseClient +} + +// NewDedicatedCloudServiceClient creates an instance of the DedicatedCloudServiceClient client. +func NewDedicatedCloudServiceClient(referer string, regionID string, subscriptionID string) DedicatedCloudServiceClient { + return NewDedicatedCloudServiceClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewDedicatedCloudServiceClientWithBaseURI creates an instance of the DedicatedCloudServiceClient client. +func NewDedicatedCloudServiceClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) DedicatedCloudServiceClient { + return DedicatedCloudServiceClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +} + +// CreateOrUpdate create dedicate cloud service +// Parameters: +// resourceGroupName - the name of the resource group +// dedicatedCloudServiceName - dedicated cloud Service name +// dedicatedCloudServiceRequest - create Dedicated Cloud Service request +func (client DedicatedCloudServiceClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string, dedicatedCloudServiceRequest DedicatedCloudService) (result DedicatedCloudService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServiceClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dedicatedCloudServiceName, + Constraints: []validation.Constraint{{Target: "dedicatedCloudServiceName", Name: validation.Pattern, Rule: `^[-a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: dedicatedCloudServiceRequest, + Constraints: []validation.Constraint{{Target: "dedicatedCloudServiceRequest.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "dedicatedCloudServiceRequest.Name", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "dedicatedCloudServiceRequest.Name", Name: validation.Pattern, Rule: `^[-a-zA-Z0-9]+$`, Chain: nil}}}, + {Target: "dedicatedCloudServiceRequest.DedicatedCloudServiceProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "dedicatedCloudServiceRequest.DedicatedCloudServiceProperties.GatewaySubnet", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("vmwarecloudsimple.DedicatedCloudServiceClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, dedicatedCloudServiceName, dedicatedCloudServiceRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DedicatedCloudServiceClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string, dedicatedCloudServiceRequest DedicatedCloudService) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dedicatedCloudServiceName": autorest.Encode("path", dedicatedCloudServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + dedicatedCloudServiceRequest.ID = nil + dedicatedCloudServiceRequest.Name = nil + dedicatedCloudServiceRequest.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}", pathParameters), + autorest.WithJSON(dedicatedCloudServiceRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DedicatedCloudServiceClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DedicatedCloudServiceClient) CreateOrUpdateResponder(resp *http.Response) (result DedicatedCloudService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete dedicate cloud service +// Parameters: +// resourceGroupName - the name of the resource group +// dedicatedCloudServiceName - dedicated cloud service name +func (client DedicatedCloudServiceClient) Delete(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string) (result DedicatedCloudServiceDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServiceClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, dedicatedCloudServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DedicatedCloudServiceClient) DeletePreparer(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dedicatedCloudServiceName": autorest.Encode("path", dedicatedCloudServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DedicatedCloudServiceClient) DeleteSender(req *http.Request) (future DedicatedCloudServiceDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DedicatedCloudServiceClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns Dedicate Cloud Service +// Parameters: +// resourceGroupName - the name of the resource group +// dedicatedCloudServiceName - dedicated cloud Service name +func (client DedicatedCloudServiceClient) Get(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string) (result DedicatedCloudService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServiceClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, dedicatedCloudServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DedicatedCloudServiceClient) GetPreparer(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dedicatedCloudServiceName": autorest.Encode("path", dedicatedCloudServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DedicatedCloudServiceClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DedicatedCloudServiceClient) GetResponder(resp *http.Response) (result DedicatedCloudService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup returns list of dedicated cloud service within resource group +// Parameters: +// resourceGroupName - the name of the resource group +// filter - the filter to apply on the list operation +// top - the maximum number of record sets to return +// skipToken - to be used by nextLink implementation +func (client DedicatedCloudServiceClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result DedicatedCloudServiceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServiceClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.dcslr.Response.Response != nil { + sc = result.dcslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dcslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dcslr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DedicatedCloudServiceClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DedicatedCloudServiceClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DedicatedCloudServiceClient) ListByResourceGroupResponder(resp *http.Response) (result DedicatedCloudServiceListResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client DedicatedCloudServiceClient) listByResourceGroupNextResults(ctx context.Context, lastResults DedicatedCloudServiceListResponse) (result DedicatedCloudServiceListResponse, err error) { + req, err := lastResults.dedicatedCloudServiceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DedicatedCloudServiceClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result DedicatedCloudServiceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServiceClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter, top, skipToken) + return +} + +// ListBySubscription returns list of dedicated cloud service within within subscription +// Parameters: +// filter - the filter to apply on the list operation +// top - the maximum number of record sets to return +// skipToken - to be used by nextLink implementation +func (client DedicatedCloudServiceClient) ListBySubscription(ctx context.Context, filter string, top *int32, skipToken string) (result DedicatedCloudServiceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServiceClient.ListBySubscription") + defer func() { + sc := -1 + if result.dcslr.Response.Response != nil { + sc = result.dcslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, filter, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.dcslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.dcslr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client DedicatedCloudServiceClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client DedicatedCloudServiceClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client DedicatedCloudServiceClient) ListBySubscriptionResponder(resp *http.Response) (result DedicatedCloudServiceListResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client DedicatedCloudServiceClient) listBySubscriptionNextResults(ctx context.Context, lastResults DedicatedCloudServiceListResponse) (result DedicatedCloudServiceListResponse, err error) { + req, err := lastResults.dedicatedCloudServiceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client DedicatedCloudServiceClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32, skipToken string) (result DedicatedCloudServiceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServiceClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx, filter, top, skipToken) + return +} + +// Update patch dedicated cloud service's properties +// Parameters: +// resourceGroupName - the name of the resource group +// dedicatedCloudServiceName - dedicated cloud service name +// dedicatedCloudServiceRequest - patch Dedicated Cloud Service request +func (client DedicatedCloudServiceClient) Update(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string, dedicatedCloudServiceRequest PatchPayload) (result DedicatedCloudService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServiceClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, dedicatedCloudServiceName, dedicatedCloudServiceRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DedicatedCloudServiceClient) UpdatePreparer(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string, dedicatedCloudServiceRequest PatchPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dedicatedCloudServiceName": autorest.Encode("path", dedicatedCloudServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudServices/{dedicatedCloudServiceName}", pathParameters), + autorest.WithJSON(dedicatedCloudServiceRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client DedicatedCloudServiceClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DedicatedCloudServiceClient) UpdateResponder(resp *http.Response) (result DedicatedCloudService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go new file mode 100644 index 000000000000..eb4c0d27437a --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go @@ -0,0 +1,3262 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple" + +// AggregationType enumerates the values for aggregation type. +type AggregationType string + +const ( + // Average ... + Average AggregationType = "Average" + // Total ... + Total AggregationType = "Total" +) + +// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. +func PossibleAggregationTypeValues() []AggregationType { + return []AggregationType{Average, Total} +} + +// DiskIndependenceMode enumerates the values for disk independence mode. +type DiskIndependenceMode string + +const ( + // IndependentNonpersistent ... + IndependentNonpersistent DiskIndependenceMode = "independent_nonpersistent" + // IndependentPersistent ... + IndependentPersistent DiskIndependenceMode = "independent_persistent" + // Persistent ... + Persistent DiskIndependenceMode = "persistent" +) + +// PossibleDiskIndependenceModeValues returns an array of possible values for the DiskIndependenceMode const type. +func PossibleDiskIndependenceModeValues() []DiskIndependenceMode { + return []DiskIndependenceMode{IndependentNonpersistent, IndependentPersistent, Persistent} +} + +// GuestOSType enumerates the values for guest os type. +type GuestOSType string + +const ( + // Linux ... + Linux GuestOSType = "linux" + // Other ... + Other GuestOSType = "other" + // Windows ... + Windows GuestOSType = "windows" +) + +// PossibleGuestOSTypeValues returns an array of possible values for the GuestOSType const type. +func PossibleGuestOSTypeValues() []GuestOSType { + return []GuestOSType{Linux, Other, Windows} +} + +// NICType enumerates the values for nic type. +type NICType string + +const ( + // E1000 ... + E1000 NICType = "E1000" + // E1000E ... + E1000E NICType = "E1000E" + // PCNET32 ... + PCNET32 NICType = "PCNET32" + // VMXNET ... + VMXNET NICType = "VMXNET" + // VMXNET2 ... + VMXNET2 NICType = "VMXNET2" + // VMXNET3 ... + VMXNET3 NICType = "VMXNET3" +) + +// PossibleNICTypeValues returns an array of possible values for the NICType const type. +func PossibleNICTypeValues() []NICType { + return []NICType{E1000, E1000E, PCNET32, VMXNET, VMXNET2, VMXNET3} +} + +// NodeStatus enumerates the values for node status. +type NodeStatus string + +const ( + // Unused ... + Unused NodeStatus = "unused" + // Used ... + Used NodeStatus = "used" +) + +// PossibleNodeStatusValues returns an array of possible values for the NodeStatus const type. +func PossibleNodeStatusValues() []NodeStatus { + return []NodeStatus{Unused, Used} +} + +// OnboardingStatus enumerates the values for onboarding status. +type OnboardingStatus string + +const ( + // NotOnBoarded ... + NotOnBoarded OnboardingStatus = "notOnBoarded" + // OnBoarded ... + OnBoarded OnboardingStatus = "onBoarded" + // OnBoarding ... + OnBoarding OnboardingStatus = "onBoarding" + // OnBoardingFailed ... + OnBoardingFailed OnboardingStatus = "onBoardingFailed" +) + +// PossibleOnboardingStatusValues returns an array of possible values for the OnboardingStatus const type. +func PossibleOnboardingStatusValues() []OnboardingStatus { + return []OnboardingStatus{NotOnBoarded, OnBoarded, OnBoarding, OnBoardingFailed} +} + +// OperationOrigin enumerates the values for operation origin. +type OperationOrigin string + +const ( + // System ... + System OperationOrigin = "system" + // User ... + User OperationOrigin = "user" + // Usersystem ... + Usersystem OperationOrigin = "user,system" +) + +// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. +func PossibleOperationOriginValues() []OperationOrigin { + return []OperationOrigin{System, User, Usersystem} +} + +// PrivateCloudResourceType enumerates the values for private cloud resource type. +type PrivateCloudResourceType string + +const ( + // MicrosoftVMwareCloudSimpleprivateClouds ... + MicrosoftVMwareCloudSimpleprivateClouds PrivateCloudResourceType = "Microsoft.VMwareCloudSimple/privateClouds" +) + +// PossiblePrivateCloudResourceTypeValues returns an array of possible values for the PrivateCloudResourceType const type. +func PossiblePrivateCloudResourceTypeValues() []PrivateCloudResourceType { + return []PrivateCloudResourceType{MicrosoftVMwareCloudSimpleprivateClouds} +} + +// StopMode enumerates the values for stop mode. +type StopMode string + +const ( + // Poweroff ... + Poweroff StopMode = "poweroff" + // Reboot ... + Reboot StopMode = "reboot" + // Shutdown ... + Shutdown StopMode = "shutdown" + // Suspend ... + Suspend StopMode = "suspend" +) + +// PossibleStopModeValues returns an array of possible values for the StopMode const type. +func PossibleStopModeValues() []StopMode { + return []StopMode{Poweroff, Reboot, Shutdown, Suspend} +} + +// UsageCount enumerates the values for usage count. +type UsageCount string + +const ( + // Bytes ... + Bytes UsageCount = "Bytes" + // BytesPerSecond ... + BytesPerSecond UsageCount = "BytesPerSecond" + // Count ... + Count UsageCount = "Count" + // CountPerSecond ... + CountPerSecond UsageCount = "CountPerSecond" + // Percent ... + Percent UsageCount = "Percent" + // Seconds ... + Seconds UsageCount = "Seconds" +) + +// PossibleUsageCountValues returns an array of possible values for the UsageCount const type. +func PossibleUsageCountValues() []UsageCount { + return []UsageCount{Bytes, BytesPerSecond, Count, CountPerSecond, Percent, Seconds} +} + +// VirtualMachineStatus enumerates the values for virtual machine status. +type VirtualMachineStatus string + +const ( + // Deallocating ... + Deallocating VirtualMachineStatus = "deallocating" + // Deleting ... + Deleting VirtualMachineStatus = "deleting" + // Poweredoff ... + Poweredoff VirtualMachineStatus = "poweredoff" + // Running ... + Running VirtualMachineStatus = "running" + // Suspended ... + Suspended VirtualMachineStatus = "suspended" + // Updating ... + Updating VirtualMachineStatus = "updating" +) + +// PossibleVirtualMachineStatusValues returns an array of possible values for the VirtualMachineStatus const type. +func PossibleVirtualMachineStatusValues() []VirtualMachineStatus { + return []VirtualMachineStatus{Deallocating, Deleting, Poweredoff, Running, Suspended, Updating} +} + +// AvailableOperation resource provider available operation model +type AvailableOperation struct { + // Display - The list of operations + Display *AvailableOperationDisplay `json:"display,omitempty"` + // IsDataAction - Indicating whether the operation is a data action or not + IsDataAction *bool `json:"isDataAction,omitempty"` + // Name - {resourceProviderNamespace}/{resourceType}/{read|write|delete|action} + Name *string `json:"name,omitempty"` + // Origin - The origin of operation. Possible values include: 'User', 'System', 'Usersystem' + Origin OperationOrigin `json:"origin,omitempty"` + // AvailableOperationDisplayPropertyServiceSpecification - The list of operation properties + *AvailableOperationDisplayPropertyServiceSpecification `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailableOperation. +func (ao AvailableOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ao.Display != nil { + objectMap["display"] = ao.Display + } + if ao.IsDataAction != nil { + objectMap["isDataAction"] = ao.IsDataAction + } + if ao.Name != nil { + objectMap["name"] = ao.Name + } + if ao.Origin != "" { + objectMap["origin"] = ao.Origin + } + if ao.AvailableOperationDisplayPropertyServiceSpecification != nil { + objectMap["properties"] = ao.AvailableOperationDisplayPropertyServiceSpecification + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AvailableOperation struct. +func (ao *AvailableOperation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "display": + if v != nil { + var display AvailableOperationDisplay + err = json.Unmarshal(*v, &display) + if err != nil { + return err + } + ao.Display = &display + } + case "isDataAction": + if v != nil { + var isDataAction bool + err = json.Unmarshal(*v, &isDataAction) + if err != nil { + return err + } + ao.IsDataAction = &isDataAction + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ao.Name = &name + } + case "origin": + if v != nil { + var origin OperationOrigin + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + ao.Origin = origin + } + case "properties": + if v != nil { + var availableOperationDisplayPropertyServiceSpecification AvailableOperationDisplayPropertyServiceSpecification + err = json.Unmarshal(*v, &availableOperationDisplayPropertyServiceSpecification) + if err != nil { + return err + } + ao.AvailableOperationDisplayPropertyServiceSpecification = &availableOperationDisplayPropertyServiceSpecification + } + } + } + + return nil +} + +// AvailableOperationDisplay resource provider available operation display model +type AvailableOperationDisplay struct { + // Description - Description of the operation for display purposes + Description *string `json:"description,omitempty"` + // Operation - Name of the operation for display purposes + Operation *string `json:"operation,omitempty"` + // Provider - Name of the provider for display purposes + Provider *string `json:"provider,omitempty"` + // Resource - Name of the resource type for display purposes + Resource *string `json:"resource,omitempty"` +} + +// AvailableOperationDisplayPropertyServiceSpecification available operation display property service +// specification model +type AvailableOperationDisplayPropertyServiceSpecification struct { + // ServiceSpecification - The list of specification's service metrics + ServiceSpecification *AvailableOperationDisplayPropertyServiceSpecificationMetricsList `json:"serviceSpecification,omitempty"` +} + +// AvailableOperationDisplayPropertyServiceSpecificationMetricsItem available operation display property +// service specification metrics item +type AvailableOperationDisplayPropertyServiceSpecificationMetricsItem struct { + // AggregationType - Metric's aggregation type for e.g. (Average, Total). Possible values include: 'Average', 'Total' + AggregationType AggregationType `json:"aggregationType,omitempty"` + // DisplayDescription - Metric's description + DisplayDescription *string `json:"displayDescription,omitempty"` + // DisplayName - Human readable metric's name + DisplayName *string `json:"displayName,omitempty"` + // Name - Metric's name/id + Name *string `json:"name,omitempty"` + // Unit - Metric's unit + Unit *string `json:"unit,omitempty"` +} + +// AvailableOperationDisplayPropertyServiceSpecificationMetricsList list of available operation display +// property service specification metrics +type AvailableOperationDisplayPropertyServiceSpecificationMetricsList struct { + // MetricSpecifications - Metric specifications of operation + MetricSpecifications *[]AvailableOperationDisplayPropertyServiceSpecificationMetricsItem `json:"metricSpecifications,omitempty"` +} + +// AvailableOperationsListResponse list of available operations +type AvailableOperationsListResponse struct { + autorest.Response `json:"-"` + // NextLink - Link for next list of available operations + NextLink *string `json:"nextLink,omitempty"` + // Value - Returns a list of available operations + Value *[]AvailableOperation `json:"value,omitempty"` +} + +// AvailableOperationsListResponseIterator provides access to a complete listing of AvailableOperation +// values. +type AvailableOperationsListResponseIterator struct { + i int + page AvailableOperationsListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AvailableOperationsListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AvailableOperationsListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AvailableOperationsListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AvailableOperationsListResponseIterator) Response() AvailableOperationsListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AvailableOperationsListResponseIterator) Value() AvailableOperation { + if !iter.page.NotDone() { + return AvailableOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AvailableOperationsListResponseIterator type. +func NewAvailableOperationsListResponseIterator(page AvailableOperationsListResponsePage) AvailableOperationsListResponseIterator { + return AvailableOperationsListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aolr AvailableOperationsListResponse) IsEmpty() bool { + return aolr.Value == nil || len(*aolr.Value) == 0 +} + +// availableOperationsListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aolr AvailableOperationsListResponse) availableOperationsListResponsePreparer(ctx context.Context) (*http.Request, error) { + if aolr.NextLink == nil || len(to.String(aolr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aolr.NextLink))) +} + +// AvailableOperationsListResponsePage contains a page of AvailableOperation values. +type AvailableOperationsListResponsePage struct { + fn func(context.Context, AvailableOperationsListResponse) (AvailableOperationsListResponse, error) + aolr AvailableOperationsListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AvailableOperationsListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.aolr) + if err != nil { + return err + } + page.aolr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AvailableOperationsListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AvailableOperationsListResponsePage) NotDone() bool { + return !page.aolr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AvailableOperationsListResponsePage) Response() AvailableOperationsListResponse { + return page.aolr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AvailableOperationsListResponsePage) Values() []AvailableOperation { + if page.aolr.IsEmpty() { + return nil + } + return *page.aolr.Value +} + +// Creates a new instance of the AvailableOperationsListResponsePage type. +func NewAvailableOperationsListResponsePage(getNextPage func(context.Context, AvailableOperationsListResponse) (AvailableOperationsListResponse, error)) AvailableOperationsListResponsePage { + return AvailableOperationsListResponsePage{fn: getNextPage} +} + +// CSRPError general error model +type CSRPError struct { + // Error - Error's body + Error *CSRPErrorBody `json:"error,omitempty"` +} + +// CSRPErrorBody error properties +type CSRPErrorBody struct { + // Code - READ-ONLY; Error's code + Code *string `json:"code,omitempty"` + // Details - READ-ONLY; Error's details + Details *[]CSRPErrorBody `json:"details,omitempty"` + // Message - READ-ONLY; Error's message + Message *string `json:"message,omitempty"` + // Target - Error's target + Target *string `json:"target,omitempty"` +} + +// DedicatedCloudNode dedicated cloud node model +type DedicatedCloudNode struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/dedicatedCloudNodes/{dedicatedCloudNodeName} + ID *string `json:"id,omitempty"` + // Location - Azure region + Location *string `json:"location,omitempty"` + // Name - READ-ONLY; {dedicatedCloudNodeName} + Name *string `json:"name,omitempty"` + // DedicatedCloudNodeProperties - Dedicated Cloud Nodes properties + *DedicatedCloudNodeProperties `json:"properties,omitempty"` + // Sku - Dedicated Cloud Nodes SKU + Sku *Sku `json:"sku,omitempty"` + // Tags - Dedicated Cloud Nodes tags + Tags map[string]*string `json:"tags"` + // Type - READ-ONLY; {resourceProviderNamespace}/{resourceType} + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DedicatedCloudNode. +func (dcn DedicatedCloudNode) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcn.Location != nil { + objectMap["location"] = dcn.Location + } + if dcn.DedicatedCloudNodeProperties != nil { + objectMap["properties"] = dcn.DedicatedCloudNodeProperties + } + if dcn.Sku != nil { + objectMap["sku"] = dcn.Sku + } + if dcn.Tags != nil { + objectMap["tags"] = dcn.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DedicatedCloudNode struct. +func (dcn *DedicatedCloudNode) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dcn.ID = &ID + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dcn.Location = &location + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dcn.Name = &name + } + case "properties": + if v != nil { + var dedicatedCloudNodeProperties DedicatedCloudNodeProperties + err = json.Unmarshal(*v, &dedicatedCloudNodeProperties) + if err != nil { + return err + } + dcn.DedicatedCloudNodeProperties = &dedicatedCloudNodeProperties + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + dcn.Sku = &sku + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dcn.Tags = tags + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dcn.Type = &typeVar + } + } + } + + return nil +} + +// DedicatedCloudNodeCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DedicatedCloudNodeCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DedicatedCloudNodeCreateOrUpdateFuture) Result(client DedicatedCloudNodeClient) (dcn DedicatedCloudNode, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.DedicatedCloudNodeCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dcn.Response.Response, err = future.GetResult(sender); err == nil && dcn.Response.Response.StatusCode != http.StatusNoContent { + dcn, err = client.CreateOrUpdateResponder(dcn.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodeCreateOrUpdateFuture", "Result", dcn.Response.Response, "Failure responding to request") + } + } + return +} + +// DedicatedCloudNodeListResponse list of dedicated nodes response model +type DedicatedCloudNodeListResponse struct { + autorest.Response `json:"-"` + // NextLink - Link for next list of DedicatedCloudNode + NextLink *string `json:"nextLink,omitempty"` + // Value - Results of the DedicatedCloudNode list + Value *[]DedicatedCloudNode `json:"value,omitempty"` +} + +// DedicatedCloudNodeListResponseIterator provides access to a complete listing of DedicatedCloudNode +// values. +type DedicatedCloudNodeListResponseIterator struct { + i int + page DedicatedCloudNodeListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DedicatedCloudNodeListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodeListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DedicatedCloudNodeListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DedicatedCloudNodeListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DedicatedCloudNodeListResponseIterator) Response() DedicatedCloudNodeListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DedicatedCloudNodeListResponseIterator) Value() DedicatedCloudNode { + if !iter.page.NotDone() { + return DedicatedCloudNode{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DedicatedCloudNodeListResponseIterator type. +func NewDedicatedCloudNodeListResponseIterator(page DedicatedCloudNodeListResponsePage) DedicatedCloudNodeListResponseIterator { + return DedicatedCloudNodeListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dcnlr DedicatedCloudNodeListResponse) IsEmpty() bool { + return dcnlr.Value == nil || len(*dcnlr.Value) == 0 +} + +// dedicatedCloudNodeListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dcnlr DedicatedCloudNodeListResponse) dedicatedCloudNodeListResponsePreparer(ctx context.Context) (*http.Request, error) { + if dcnlr.NextLink == nil || len(to.String(dcnlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dcnlr.NextLink))) +} + +// DedicatedCloudNodeListResponsePage contains a page of DedicatedCloudNode values. +type DedicatedCloudNodeListResponsePage struct { + fn func(context.Context, DedicatedCloudNodeListResponse) (DedicatedCloudNodeListResponse, error) + dcnlr DedicatedCloudNodeListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DedicatedCloudNodeListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodeListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.dcnlr) + if err != nil { + return err + } + page.dcnlr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DedicatedCloudNodeListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DedicatedCloudNodeListResponsePage) NotDone() bool { + return !page.dcnlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DedicatedCloudNodeListResponsePage) Response() DedicatedCloudNodeListResponse { + return page.dcnlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DedicatedCloudNodeListResponsePage) Values() []DedicatedCloudNode { + if page.dcnlr.IsEmpty() { + return nil + } + return *page.dcnlr.Value +} + +// Creates a new instance of the DedicatedCloudNodeListResponsePage type. +func NewDedicatedCloudNodeListResponsePage(getNextPage func(context.Context, DedicatedCloudNodeListResponse) (DedicatedCloudNodeListResponse, error)) DedicatedCloudNodeListResponsePage { + return DedicatedCloudNodeListResponsePage{fn: getNextPage} +} + +// DedicatedCloudNodeProperties properties of dedicated cloud node +type DedicatedCloudNodeProperties struct { + // AvailabilityZoneID - Availability Zone id, e.g. "az1" + AvailabilityZoneID *string `json:"availabilityZoneId,omitempty"` + // AvailabilityZoneName - READ-ONLY; Availability Zone name, e.g. "Availability Zone 1" + AvailabilityZoneName *string `json:"availabilityZoneName,omitempty"` + // CloudRackName - READ-ONLY; VMWare Cloud Rack Name + CloudRackName *string `json:"cloudRackName,omitempty"` + // Created - READ-ONLY; date time the resource was created + Created interface{} `json:"created,omitempty"` + // NodesCount - count of nodes to create + NodesCount *int32 `json:"nodesCount,omitempty"` + // PlacementGroupID - Placement Group id, e.g. "n1" + PlacementGroupID *string `json:"placementGroupId,omitempty"` + // PlacementGroupName - READ-ONLY; Placement Name, e.g. "Placement Group 1" + PlacementGroupName *string `json:"placementGroupName,omitempty"` + // PrivateCloudID - READ-ONLY; Private Cloud Id + PrivateCloudID *string `json:"privateCloudId,omitempty"` + // PrivateCloudName - READ-ONLY; Resource Pool Name + PrivateCloudName *string `json:"privateCloudName,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning status of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // PurchaseID - purchase id + PurchaseID *uuid.UUID `json:"purchaseId,omitempty"` + // SkuDescription - Dedicated Cloud Nodes SKU's description + *SkuDescription `json:"skuDescription,omitempty"` + // Status - READ-ONLY; Node status, indicates is private cloud set up on this node or not. Possible values include: 'Unused', 'Used' + Status NodeStatus `json:"status,omitempty"` + // VmwareClusterName - READ-ONLY; VMWare Cluster Name + VmwareClusterName *string `json:"vmwareClusterName,omitempty"` +} + +// MarshalJSON is the custom marshaler for DedicatedCloudNodeProperties. +func (dcnp DedicatedCloudNodeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcnp.AvailabilityZoneID != nil { + objectMap["availabilityZoneId"] = dcnp.AvailabilityZoneID + } + if dcnp.NodesCount != nil { + objectMap["nodesCount"] = dcnp.NodesCount + } + if dcnp.PlacementGroupID != nil { + objectMap["placementGroupId"] = dcnp.PlacementGroupID + } + if dcnp.PurchaseID != nil { + objectMap["purchaseId"] = dcnp.PurchaseID + } + if dcnp.SkuDescription != nil { + objectMap["skuDescription"] = dcnp.SkuDescription + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DedicatedCloudNodeProperties struct. +func (dcnp *DedicatedCloudNodeProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "availabilityZoneId": + if v != nil { + var availabilityZoneID string + err = json.Unmarshal(*v, &availabilityZoneID) + if err != nil { + return err + } + dcnp.AvailabilityZoneID = &availabilityZoneID + } + case "availabilityZoneName": + if v != nil { + var availabilityZoneName string + err = json.Unmarshal(*v, &availabilityZoneName) + if err != nil { + return err + } + dcnp.AvailabilityZoneName = &availabilityZoneName + } + case "cloudRackName": + if v != nil { + var cloudRackName string + err = json.Unmarshal(*v, &cloudRackName) + if err != nil { + return err + } + dcnp.CloudRackName = &cloudRackName + } + case "created": + if v != nil { + var created interface{} + err = json.Unmarshal(*v, &created) + if err != nil { + return err + } + dcnp.Created = created + } + case "nodesCount": + if v != nil { + var nodesCount int32 + err = json.Unmarshal(*v, &nodesCount) + if err != nil { + return err + } + dcnp.NodesCount = &nodesCount + } + case "placementGroupId": + if v != nil { + var placementGroupID string + err = json.Unmarshal(*v, &placementGroupID) + if err != nil { + return err + } + dcnp.PlacementGroupID = &placementGroupID + } + case "placementGroupName": + if v != nil { + var placementGroupName string + err = json.Unmarshal(*v, &placementGroupName) + if err != nil { + return err + } + dcnp.PlacementGroupName = &placementGroupName + } + case "privateCloudId": + if v != nil { + var privateCloudID string + err = json.Unmarshal(*v, &privateCloudID) + if err != nil { + return err + } + dcnp.PrivateCloudID = &privateCloudID + } + case "privateCloudName": + if v != nil { + var privateCloudName string + err = json.Unmarshal(*v, &privateCloudName) + if err != nil { + return err + } + dcnp.PrivateCloudName = &privateCloudName + } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + dcnp.ProvisioningState = &provisioningState + } + case "purchaseId": + if v != nil { + var purchaseID uuid.UUID + err = json.Unmarshal(*v, &purchaseID) + if err != nil { + return err + } + dcnp.PurchaseID = &purchaseID + } + case "skuDescription": + if v != nil { + var skuDescription SkuDescription + err = json.Unmarshal(*v, &skuDescription) + if err != nil { + return err + } + dcnp.SkuDescription = &skuDescription + } + case "status": + if v != nil { + var status NodeStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + dcnp.Status = status + } + case "vmwareClusterName": + if v != nil { + var vmwareClusterName string + err = json.Unmarshal(*v, &vmwareClusterName) + if err != nil { + return err + } + dcnp.VmwareClusterName = &vmwareClusterName + } + } + } + + return nil +} + +// DedicatedCloudService dedicated cloud service model +type DedicatedCloudService struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/dedicatedcloudservices/{dedicatedCloudServiceName} + ID *string `json:"id,omitempty"` + // Location - Azure region + Location *string `json:"location,omitempty"` + // Name - READ-ONLY; {dedicatedCloudServiceName} + Name *string `json:"name,omitempty"` + // DedicatedCloudServiceProperties - The properties of Dedicated Node Service + *DedicatedCloudServiceProperties `json:"properties,omitempty"` + // Tags - The list of tags + Tags map[string]*string `json:"tags"` + // Type - READ-ONLY; {resourceProviderNamespace}/{resourceType} + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DedicatedCloudService. +func (dcs DedicatedCloudService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcs.Location != nil { + objectMap["location"] = dcs.Location + } + if dcs.DedicatedCloudServiceProperties != nil { + objectMap["properties"] = dcs.DedicatedCloudServiceProperties + } + if dcs.Tags != nil { + objectMap["tags"] = dcs.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DedicatedCloudService struct. +func (dcs *DedicatedCloudService) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dcs.ID = &ID + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dcs.Location = &location + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dcs.Name = &name + } + case "properties": + if v != nil { + var dedicatedCloudServiceProperties DedicatedCloudServiceProperties + err = json.Unmarshal(*v, &dedicatedCloudServiceProperties) + if err != nil { + return err + } + dcs.DedicatedCloudServiceProperties = &dedicatedCloudServiceProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dcs.Tags = tags + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dcs.Type = &typeVar + } + } + } + + return nil +} + +// DedicatedCloudServiceDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DedicatedCloudServiceDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DedicatedCloudServiceDeleteFuture) Result(client DedicatedCloudServiceClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServiceDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.DedicatedCloudServiceDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DedicatedCloudServiceListResponse list of dedicated cloud services +type DedicatedCloudServiceListResponse struct { + autorest.Response `json:"-"` + // NextLink - Link for next list of DedicatedCloudNode + NextLink *string `json:"nextLink,omitempty"` + // Value - Results of the DedicatedCloudService list + Value *[]DedicatedCloudService `json:"value,omitempty"` +} + +// DedicatedCloudServiceListResponseIterator provides access to a complete listing of DedicatedCloudService +// values. +type DedicatedCloudServiceListResponseIterator struct { + i int + page DedicatedCloudServiceListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DedicatedCloudServiceListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServiceListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DedicatedCloudServiceListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DedicatedCloudServiceListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DedicatedCloudServiceListResponseIterator) Response() DedicatedCloudServiceListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DedicatedCloudServiceListResponseIterator) Value() DedicatedCloudService { + if !iter.page.NotDone() { + return DedicatedCloudService{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DedicatedCloudServiceListResponseIterator type. +func NewDedicatedCloudServiceListResponseIterator(page DedicatedCloudServiceListResponsePage) DedicatedCloudServiceListResponseIterator { + return DedicatedCloudServiceListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dcslr DedicatedCloudServiceListResponse) IsEmpty() bool { + return dcslr.Value == nil || len(*dcslr.Value) == 0 +} + +// dedicatedCloudServiceListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dcslr DedicatedCloudServiceListResponse) dedicatedCloudServiceListResponsePreparer(ctx context.Context) (*http.Request, error) { + if dcslr.NextLink == nil || len(to.String(dcslr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dcslr.NextLink))) +} + +// DedicatedCloudServiceListResponsePage contains a page of DedicatedCloudService values. +type DedicatedCloudServiceListResponsePage struct { + fn func(context.Context, DedicatedCloudServiceListResponse) (DedicatedCloudServiceListResponse, error) + dcslr DedicatedCloudServiceListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DedicatedCloudServiceListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServiceListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.dcslr) + if err != nil { + return err + } + page.dcslr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DedicatedCloudServiceListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DedicatedCloudServiceListResponsePage) NotDone() bool { + return !page.dcslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DedicatedCloudServiceListResponsePage) Response() DedicatedCloudServiceListResponse { + return page.dcslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DedicatedCloudServiceListResponsePage) Values() []DedicatedCloudService { + if page.dcslr.IsEmpty() { + return nil + } + return *page.dcslr.Value +} + +// Creates a new instance of the DedicatedCloudServiceListResponsePage type. +func NewDedicatedCloudServiceListResponsePage(getNextPage func(context.Context, DedicatedCloudServiceListResponse) (DedicatedCloudServiceListResponse, error)) DedicatedCloudServiceListResponsePage { + return DedicatedCloudServiceListResponsePage{fn: getNextPage} +} + +// DedicatedCloudServiceProperties properties of dedicated cloud service +type DedicatedCloudServiceProperties struct { + // GatewaySubnet - gateway Subnet for the account. It will collect the subnet address and always treat it as /28 + GatewaySubnet *string `json:"gatewaySubnet,omitempty"` + // IsAccountOnboarded - READ-ONLY; indicates whether account onboarded or not in a given region. Possible values include: 'NotOnBoarded', 'OnBoarded', 'OnBoardingFailed', 'OnBoarding' + IsAccountOnboarded OnboardingStatus `json:"isAccountOnboarded,omitempty"` + // Nodes - total nodes purchased + Nodes *int32 `json:"nodes,omitempty"` + // ServiceURL - link to a service management web portal + ServiceURL *string `json:"serviceURL,omitempty"` +} + +// GetOperationResultByRegionFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GetOperationResultByRegionFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GetOperationResultByRegionFuture) Result(client BaseClient) (or OperationResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.GetOperationResultByRegionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.GetOperationResultByRegionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if or.Response.Response, err = future.GetResult(sender); err == nil && or.Response.Response.StatusCode != http.StatusNoContent { + or, err = client.GetOperationResultByRegionResponder(or.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.GetOperationResultByRegionFuture", "Result", or.Response.Response, "Failure responding to request") + } + } + return +} + +// OperationError operation error model +type OperationError struct { + // Code - Error's code + Code *string `json:"code,omitempty"` + // Message - Error's message + Message *string `json:"message,omitempty"` +} + +// OperationResource operation status response +type OperationResource struct { + autorest.Response `json:"-"` + // EndTime - READ-ONLY; End time of the operation + EndTime *date.Time `json:"endTime,omitempty"` + // Error - Error Message if operation failed + Error *OperationError `json:"error,omitempty"` + // ID - READ-ONLY; Operation Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Operation ID + Name *string `json:"name,omitempty"` + // StartTime - READ-ONLY; Start time of the operation + StartTime *date.Time `json:"startTime,omitempty"` + // Status - READ-ONLY; Operation status + Status *string `json:"status,omitempty"` +} + +// PatchPayload general patch payload modal +type PatchPayload struct { + // Tags - The tags key:value pairs + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PatchPayload. +func (pp PatchPayload) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pp.Tags != nil { + objectMap["tags"] = pp.Tags + } + return json.Marshal(objectMap) +} + +// PrivateCloud private cloud model +type PrivateCloud struct { + autorest.Response `json:"-"` + // ID - Azure Id, e.g. "/subscriptions/4da99247-a172-4ed6-8ae9-ebed2d12f839/providers/Microsoft.VMwareCloudSimple/privateClouds/cloud123" + ID *string `json:"id,omitempty"` + // Location - Location where private cloud created, e.g "westus" + Location *string `json:"location,omitempty"` + // Name - Private cloud name + Name *string `json:"name,omitempty"` + // PrivateCloudProperties - Private cloud properties + *PrivateCloudProperties `json:"properties,omitempty"` + // Type - Azure Resource type. Possible values include: 'MicrosoftVMwareCloudSimpleprivateClouds' + Type PrivateCloudResourceType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateCloud. +func (pc PrivateCloud) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pc.ID != nil { + objectMap["id"] = pc.ID + } + if pc.Location != nil { + objectMap["location"] = pc.Location + } + if pc.Name != nil { + objectMap["name"] = pc.Name + } + if pc.PrivateCloudProperties != nil { + objectMap["properties"] = pc.PrivateCloudProperties + } + if pc.Type != "" { + objectMap["type"] = pc.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateCloud struct. +func (pc *PrivateCloud) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pc.ID = &ID + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pc.Location = &location + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pc.Name = &name + } + case "properties": + if v != nil { + var privateCloudProperties PrivateCloudProperties + err = json.Unmarshal(*v, &privateCloudProperties) + if err != nil { + return err + } + pc.PrivateCloudProperties = &privateCloudProperties + } + case "type": + if v != nil { + var typeVar PrivateCloudResourceType + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pc.Type = typeVar + } + } + } + + return nil +} + +// PrivateCloudList list of private clouds +type PrivateCloudList struct { + autorest.Response `json:"-"` + // NextLink - Link for next list of Private Clouds + NextLink *string `json:"nextLink,omitempty"` + // Value - the list of private clouds + Value *[]PrivateCloud `json:"value,omitempty"` +} + +// PrivateCloudListIterator provides access to a complete listing of PrivateCloud values. +type PrivateCloudListIterator struct { + i int + page PrivateCloudListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateCloudListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateCloudListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateCloudListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateCloudListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateCloudListIterator) Response() PrivateCloudList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateCloudListIterator) Value() PrivateCloud { + if !iter.page.NotDone() { + return PrivateCloud{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateCloudListIterator type. +func NewPrivateCloudListIterator(page PrivateCloudListPage) PrivateCloudListIterator { + return PrivateCloudListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pcl PrivateCloudList) IsEmpty() bool { + return pcl.Value == nil || len(*pcl.Value) == 0 +} + +// privateCloudListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pcl PrivateCloudList) privateCloudListPreparer(ctx context.Context) (*http.Request, error) { + if pcl.NextLink == nil || len(to.String(pcl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pcl.NextLink))) +} + +// PrivateCloudListPage contains a page of PrivateCloud values. +type PrivateCloudListPage struct { + fn func(context.Context, PrivateCloudList) (PrivateCloudList, error) + pcl PrivateCloudList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateCloudListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateCloudListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.pcl) + if err != nil { + return err + } + page.pcl = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateCloudListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateCloudListPage) NotDone() bool { + return !page.pcl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateCloudListPage) Response() PrivateCloudList { + return page.pcl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateCloudListPage) Values() []PrivateCloud { + if page.pcl.IsEmpty() { + return nil + } + return *page.pcl.Value +} + +// Creates a new instance of the PrivateCloudListPage type. +func NewPrivateCloudListPage(getNextPage func(context.Context, PrivateCloudList) (PrivateCloudList, error)) PrivateCloudListPage { + return PrivateCloudListPage{fn: getNextPage} +} + +// PrivateCloudProperties properties of private +type PrivateCloudProperties struct { + // AvailabilityZoneID - Availability Zone id, e.g. "az1" + AvailabilityZoneID *string `json:"availabilityZoneId,omitempty"` + // AvailabilityZoneName - Availability Zone name, e.g. "Availability Zone 1" + AvailabilityZoneName *string `json:"availabilityZoneName,omitempty"` + // ClustersNumber - Number of clusters + ClustersNumber *int32 `json:"clustersNumber,omitempty"` + // CreatedBy - User's emails who created cloud + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedOn - When private cloud was created + CreatedOn *date.Time `json:"createdOn,omitempty"` + // DNSServers - Array of DNS servers + DNSServers *[]string `json:"dnsServers,omitempty"` + // Expires - Expiration date of PC + Expires *string `json:"expires,omitempty"` + // NsxType - Nsx Type, e.g. "Advanced" + NsxType *string `json:"nsxType,omitempty"` + // PlacementGroupID - Placement Group id, e.g. "n1" + PlacementGroupID *string `json:"placementGroupId,omitempty"` + // PlacementGroupName - Placement Group name + PlacementGroupName *string `json:"placementGroupName,omitempty"` + // PrivateCloudID - Id of a private cloud + PrivateCloudID *uuid.UUID `json:"privateCloudId,omitempty"` + // ResourcePools - The list of Resource Pools + ResourcePools *[]ResourcePool `json:"resourcePools,omitempty"` + // State - Private Cloud state, e.g. "operational" + State *string `json:"state,omitempty"` + // TotalCPUCores - Number of cores + TotalCPUCores *int32 `json:"totalCpuCores,omitempty"` + // TotalNodes - Number of nodes + TotalNodes *int32 `json:"totalNodes,omitempty"` + // TotalRAM - Memory size + TotalRAM *int32 `json:"totalRam,omitempty"` + // TotalStorage - Disk space in TB + TotalStorage *float64 `json:"totalStorage,omitempty"` + // Type - Virtualization type e.g. "vSphere" + Type *string `json:"type,omitempty"` + // VSphereVersion - e.g. "6.5u2" + VSphereVersion *string `json:"vSphereVersion,omitempty"` + // VcenterFqdn - FQDN for vcneter access + VcenterFqdn *string `json:"vcenterFqdn,omitempty"` + // VcenterRefid - Vcenters' ip address + VcenterRefid *string `json:"vcenterRefid,omitempty"` + // VirtualMachineTemplates - The list of Virtual Machine Templates + VirtualMachineTemplates *[]VirtualMachineTemplate `json:"virtualMachineTemplates,omitempty"` + // VirtualNetworks - The list of Virtual Networks + VirtualNetworks *[]VirtualNetwork `json:"virtualNetworks,omitempty"` + // VrOpsEnabled - Is Vrops enabled/disabled + VrOpsEnabled *bool `json:"vrOpsEnabled,omitempty"` +} + +// ResourcePool resource pool model +type ResourcePool struct { + autorest.Response `json:"-"` + // ID - resource pool id (privateCloudId:vsphereId) + ID *string `json:"id,omitempty"` + // Location - Azure region + Location *string `json:"location,omitempty"` + // Name - READ-ONLY; {ResourcePoolName} + Name *string `json:"name,omitempty"` + // PrivateCloudID - READ-ONLY; The Private Cloud Id + PrivateCloudID *string `json:"privateCloudId,omitempty"` + // ResourcePoolProperties - Resource pool properties + *ResourcePoolProperties `json:"properties,omitempty"` + // Type - READ-ONLY; {resourceProviderNamespace}/{resourceType} + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourcePool. +func (rp ResourcePool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rp.ID != nil { + objectMap["id"] = rp.ID + } + if rp.Location != nil { + objectMap["location"] = rp.Location + } + if rp.ResourcePoolProperties != nil { + objectMap["properties"] = rp.ResourcePoolProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ResourcePool struct. +func (rp *ResourcePool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rp.ID = &ID + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rp.Location = &location + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rp.Name = &name + } + case "privateCloudId": + if v != nil { + var privateCloudID string + err = json.Unmarshal(*v, &privateCloudID) + if err != nil { + return err + } + rp.PrivateCloudID = &privateCloudID + } + case "properties": + if v != nil { + var resourcePoolProperties ResourcePoolProperties + err = json.Unmarshal(*v, &resourcePoolProperties) + if err != nil { + return err + } + rp.ResourcePoolProperties = &resourcePoolProperties + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rp.Type = &typeVar + } + } + } + + return nil +} + +// ResourcePoolProperties properties of resource pool +type ResourcePoolProperties struct { + // FullName - READ-ONLY; Hierarchical resource pool name + FullName *string `json:"fullName,omitempty"` +} + +// ResourcePoolsListResponse list of resource pools response model +type ResourcePoolsListResponse struct { + autorest.Response `json:"-"` + // NextLink - Link for next list of ResourcePoolsList + NextLink *string `json:"nextLink,omitempty"` + // Value - Results of the Resource pools list + Value *[]ResourcePool `json:"value,omitempty"` +} + +// ResourcePoolsListResponseIterator provides access to a complete listing of ResourcePool values. +type ResourcePoolsListResponseIterator struct { + i int + page ResourcePoolsListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourcePoolsListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourcePoolsListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourcePoolsListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourcePoolsListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourcePoolsListResponseIterator) Response() ResourcePoolsListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourcePoolsListResponseIterator) Value() ResourcePool { + if !iter.page.NotDone() { + return ResourcePool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourcePoolsListResponseIterator type. +func NewResourcePoolsListResponseIterator(page ResourcePoolsListResponsePage) ResourcePoolsListResponseIterator { + return ResourcePoolsListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rplr ResourcePoolsListResponse) IsEmpty() bool { + return rplr.Value == nil || len(*rplr.Value) == 0 +} + +// resourcePoolsListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rplr ResourcePoolsListResponse) resourcePoolsListResponsePreparer(ctx context.Context) (*http.Request, error) { + if rplr.NextLink == nil || len(to.String(rplr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rplr.NextLink))) +} + +// ResourcePoolsListResponsePage contains a page of ResourcePool values. +type ResourcePoolsListResponsePage struct { + fn func(context.Context, ResourcePoolsListResponse) (ResourcePoolsListResponse, error) + rplr ResourcePoolsListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourcePoolsListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourcePoolsListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.rplr) + if err != nil { + return err + } + page.rplr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourcePoolsListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourcePoolsListResponsePage) NotDone() bool { + return !page.rplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourcePoolsListResponsePage) Response() ResourcePoolsListResponse { + return page.rplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourcePoolsListResponsePage) Values() []ResourcePool { + if page.rplr.IsEmpty() { + return nil + } + return *page.rplr.Value +} + +// Creates a new instance of the ResourcePoolsListResponsePage type. +func NewResourcePoolsListResponsePage(getNextPage func(context.Context, ResourcePoolsListResponse) (ResourcePoolsListResponse, error)) ResourcePoolsListResponsePage { + return ResourcePoolsListResponsePage{fn: getNextPage} +} + +// Sku the purchase SKU for CloudSimple paid resources +type Sku struct { + // Capacity - The capacity of the SKU + Capacity *string `json:"capacity,omitempty"` + // Description - dedicatedcloudnode example: 8 x Ten-Core Intel® Xeon® Processor E5-2640 v4 2.40GHz 25MB Cache (90W); 12 x 64GB PC4-19200 2400MHz DDR4 ECC Registered DIMM, ... + Description *string `json:"description,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here + Family *string `json:"family,omitempty"` + // Name - The name of the SKU for VMWare Cloudsimple Node + Name *string `json:"name,omitempty"` + // Tier - The tier of the SKU + Tier *string `json:"tier,omitempty"` +} + +// SkuAvailability SKU availability model +type SkuAvailability struct { + // DedicatedAvailabilityZoneID - CSOS Availability Zone id + DedicatedAvailabilityZoneID *string `json:"dedicatedAvailabilityZoneId,omitempty"` + // DedicatedAvailabilityZoneName - CSOS Availability Zone Name + DedicatedAvailabilityZoneName *string `json:"dedicatedAvailabilityZoneName,omitempty"` + // DedicatedPlacementGroupID - CSOS Placement Group Id + DedicatedPlacementGroupID *string `json:"dedicatedPlacementGroupId,omitempty"` + // DedicatedPlacementGroupName - CSOS Placement Group name + DedicatedPlacementGroupName *string `json:"dedicatedPlacementGroupName,omitempty"` + // Limit - indicates how many resources of a given SKU is available in a AZ->PG + Limit *int32 `json:"limit,omitempty"` + // ResourceType - resource type e.g. DedicatedCloudNodes + ResourceType *string `json:"resourceType,omitempty"` + // SkuID - sku id + SkuID *string `json:"skuId,omitempty"` + // SkuName - sku name + SkuName *string `json:"skuName,omitempty"` +} + +// SkuAvailabilityListResponse list of SKU availabilities +type SkuAvailabilityListResponse struct { + autorest.Response `json:"-"` + // NextLink - Link for next list of DedicatedCloudNode + NextLink *string `json:"nextLink,omitempty"` + // Value - Results of the DedicatedPlacementGroupSkuAvailability list + Value *[]SkuAvailability `json:"value,omitempty"` +} + +// SkuAvailabilityListResponseIterator provides access to a complete listing of SkuAvailability values. +type SkuAvailabilityListResponseIterator struct { + i int + page SkuAvailabilityListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SkuAvailabilityListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuAvailabilityListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SkuAvailabilityListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SkuAvailabilityListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SkuAvailabilityListResponseIterator) Response() SkuAvailabilityListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SkuAvailabilityListResponseIterator) Value() SkuAvailability { + if !iter.page.NotDone() { + return SkuAvailability{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SkuAvailabilityListResponseIterator type. +func NewSkuAvailabilityListResponseIterator(page SkuAvailabilityListResponsePage) SkuAvailabilityListResponseIterator { + return SkuAvailabilityListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (salr SkuAvailabilityListResponse) IsEmpty() bool { + return salr.Value == nil || len(*salr.Value) == 0 +} + +// skuAvailabilityListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (salr SkuAvailabilityListResponse) skuAvailabilityListResponsePreparer(ctx context.Context) (*http.Request, error) { + if salr.NextLink == nil || len(to.String(salr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(salr.NextLink))) +} + +// SkuAvailabilityListResponsePage contains a page of SkuAvailability values. +type SkuAvailabilityListResponsePage struct { + fn func(context.Context, SkuAvailabilityListResponse) (SkuAvailabilityListResponse, error) + salr SkuAvailabilityListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SkuAvailabilityListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuAvailabilityListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.salr) + if err != nil { + return err + } + page.salr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SkuAvailabilityListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SkuAvailabilityListResponsePage) NotDone() bool { + return !page.salr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SkuAvailabilityListResponsePage) Response() SkuAvailabilityListResponse { + return page.salr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SkuAvailabilityListResponsePage) Values() []SkuAvailability { + if page.salr.IsEmpty() { + return nil + } + return *page.salr.Value +} + +// Creates a new instance of the SkuAvailabilityListResponsePage type. +func NewSkuAvailabilityListResponsePage(getNextPage func(context.Context, SkuAvailabilityListResponse) (SkuAvailabilityListResponse, error)) SkuAvailabilityListResponsePage { + return SkuAvailabilityListResponsePage{fn: getNextPage} +} + +// SkuDescription the purchase SKU for CloudSimple paid resources +type SkuDescription struct { + // ID - SKU's id + ID *string `json:"id,omitempty"` + // Name - SKU's name + Name *string `json:"name,omitempty"` +} + +// Usage usage model +type Usage struct { + // CurrentValue - The current usage value + CurrentValue *int32 `json:"currentValue,omitempty"` + // Limit - limit of a given sku in a region for a subscription. The maximum permitted value for the usage quota. If there is no limit, this value will be -1 + Limit *int32 `json:"limit,omitempty"` + // Name - Usage name value and localized name + Name *UsageName `json:"name,omitempty"` + // Unit - The usages' unit. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond' + Unit UsageCount `json:"unit,omitempty"` +} + +// UsageListResponse list of usages +type UsageListResponse struct { + autorest.Response `json:"-"` + // NextLink - Link for next list of DedicatedCloudNode + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; The list of usages + Value *[]Usage `json:"value,omitempty"` +} + +// UsageListResponseIterator provides access to a complete listing of Usage values. +type UsageListResponseIterator struct { + i int + page UsageListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *UsageListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *UsageListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter UsageListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter UsageListResponseIterator) Response() UsageListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter UsageListResponseIterator) Value() Usage { + if !iter.page.NotDone() { + return Usage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the UsageListResponseIterator type. +func NewUsageListResponseIterator(page UsageListResponsePage) UsageListResponseIterator { + return UsageListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ulr UsageListResponse) IsEmpty() bool { + return ulr.Value == nil || len(*ulr.Value) == 0 +} + +// usageListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ulr UsageListResponse) usageListResponsePreparer(ctx context.Context) (*http.Request, error) { + if ulr.NextLink == nil || len(to.String(ulr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ulr.NextLink))) +} + +// UsageListResponsePage contains a page of Usage values. +type UsageListResponsePage struct { + fn func(context.Context, UsageListResponse) (UsageListResponse, error) + ulr UsageListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *UsageListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.ulr) + if err != nil { + return err + } + page.ulr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *UsageListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page UsageListResponsePage) NotDone() bool { + return !page.ulr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page UsageListResponsePage) Response() UsageListResponse { + return page.ulr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page UsageListResponsePage) Values() []Usage { + if page.ulr.IsEmpty() { + return nil + } + return *page.ulr.Value +} + +// Creates a new instance of the UsageListResponsePage type. +func NewUsageListResponsePage(getNextPage func(context.Context, UsageListResponse) (UsageListResponse, error)) UsageListResponsePage { + return UsageListResponsePage{fn: getNextPage} +} + +// UsageName user name model +type UsageName struct { + // LocalizedValue - e.g. "Virtual Machines" + LocalizedValue *string `json:"localizedValue,omitempty"` + // Value - resource type or resource type sku name, e.g. virtualMachines + Value *string `json:"value,omitempty"` +} + +// VirtualDisk virtual disk model +type VirtualDisk struct { + // ControllerID - Disk's Controller id + ControllerID *string `json:"controllerId,omitempty"` + // IndependenceMode - Disk's independence mode type. Possible values include: 'Persistent', 'IndependentPersistent', 'IndependentNonpersistent' + IndependenceMode DiskIndependenceMode `json:"independenceMode,omitempty"` + // TotalSize - Disk's total size + TotalSize *int32 `json:"totalSize,omitempty"` + // VirtualDiskID - Disk's id + VirtualDiskID *string `json:"virtualDiskId,omitempty"` + // VirtualDiskName - READ-ONLY; Disk's display name + VirtualDiskName *string `json:"virtualDiskName,omitempty"` +} + +// VirtualDiskController virtual disk controller model +type VirtualDiskController struct { + // ID - READ-ONLY; Controller's id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The display name of Controller + Name *string `json:"name,omitempty"` + // SubType - READ-ONLY; dik controller subtype (VMWARE_PARAVIRTUAL, BUS_PARALEL, LSI_PARALEL, LSI_SAS) + SubType *string `json:"subType,omitempty"` + // Type - READ-ONLY; disk controller type (SCSI) + Type *string `json:"type,omitempty"` +} + +// VirtualMachine virtual machine model +type VirtualMachine struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/virtualMachines/{virtualMachineName} + ID *string `json:"id,omitempty"` + // Location - Azure region + Location *string `json:"location,omitempty"` + // Name - READ-ONLY; {virtualMachineName} + Name *string `json:"name,omitempty"` + // VirtualMachineProperties - Virtual machine properties + *VirtualMachineProperties `json:"properties,omitempty"` + // Tags - The list of tags + Tags map[string]*string `json:"tags"` + // Type - READ-ONLY; {resourceProviderNamespace}/{resourceType} + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachine. +func (VM VirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if VM.Location != nil { + objectMap["location"] = VM.Location + } + if VM.VirtualMachineProperties != nil { + objectMap["properties"] = VM.VirtualMachineProperties + } + if VM.Tags != nil { + objectMap["tags"] = VM.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachine struct. +func (VM *VirtualMachine) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + VM.ID = &ID + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + VM.Location = &location + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + VM.Name = &name + } + case "properties": + if v != nil { + var virtualMachineProperties VirtualMachineProperties + err = json.Unmarshal(*v, &virtualMachineProperties) + if err != nil { + return err + } + VM.VirtualMachineProperties = &virtualMachineProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + VM.Tags = tags + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + VM.Type = &typeVar + } + } + } + + return nil +} + +// VirtualMachineCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineCreateOrUpdateFuture) Result(client VirtualMachineClient) (VM VirtualMachine, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.VirtualMachineCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if VM.Response.Response, err = future.GetResult(sender); err == nil && VM.Response.Response.StatusCode != http.StatusNoContent { + VM, err = client.CreateOrUpdateResponder(VM.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineCreateOrUpdateFuture", "Result", VM.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachineDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachineDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineDeleteFuture) Result(client VirtualMachineClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.VirtualMachineDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineListResponse list of virtual machines +type VirtualMachineListResponse struct { + autorest.Response `json:"-"` + // NextLink - Link for next list of VirtualMachines + NextLink *string `json:"nextLink,omitempty"` + // Value - Results of the VirtualMachine list + Value *[]VirtualMachine `json:"value,omitempty"` +} + +// VirtualMachineListResponseIterator provides access to a complete listing of VirtualMachine values. +type VirtualMachineListResponseIterator struct { + i int + page VirtualMachineListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualMachineListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualMachineListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualMachineListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualMachineListResponseIterator) Response() VirtualMachineListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualMachineListResponseIterator) Value() VirtualMachine { + if !iter.page.NotDone() { + return VirtualMachine{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualMachineListResponseIterator type. +func NewVirtualMachineListResponseIterator(page VirtualMachineListResponsePage) VirtualMachineListResponseIterator { + return VirtualMachineListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vmlr VirtualMachineListResponse) IsEmpty() bool { + return vmlr.Value == nil || len(*vmlr.Value) == 0 +} + +// virtualMachineListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vmlr VirtualMachineListResponse) virtualMachineListResponsePreparer(ctx context.Context) (*http.Request, error) { + if vmlr.NextLink == nil || len(to.String(vmlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vmlr.NextLink))) +} + +// VirtualMachineListResponsePage contains a page of VirtualMachine values. +type VirtualMachineListResponsePage struct { + fn func(context.Context, VirtualMachineListResponse) (VirtualMachineListResponse, error) + vmlr VirtualMachineListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualMachineListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.vmlr) + if err != nil { + return err + } + page.vmlr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualMachineListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualMachineListResponsePage) NotDone() bool { + return !page.vmlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualMachineListResponsePage) Response() VirtualMachineListResponse { + return page.vmlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualMachineListResponsePage) Values() []VirtualMachine { + if page.vmlr.IsEmpty() { + return nil + } + return *page.vmlr.Value +} + +// Creates a new instance of the VirtualMachineListResponsePage type. +func NewVirtualMachineListResponsePage(getNextPage func(context.Context, VirtualMachineListResponse) (VirtualMachineListResponse, error)) VirtualMachineListResponsePage { + return VirtualMachineListResponsePage{fn: getNextPage} +} + +// VirtualMachineProperties properties of virtual machine +type VirtualMachineProperties struct { + // AmountOfRAM - The amount of memory + AmountOfRAM *int32 `json:"amountOfRam,omitempty"` + // Controllers - READ-ONLY; The list of Virtual Disks' Controllers + Controllers *[]VirtualDiskController `json:"controllers,omitempty"` + // Disks - The list of Virtual Disks + Disks *[]VirtualDisk `json:"disks,omitempty"` + // Dnsname - READ-ONLY; The DNS name of Virtual Machine in VCenter + Dnsname *string `json:"dnsname,omitempty"` + // ExposeToGuestVM - Expose Guest OS or not + ExposeToGuestVM *bool `json:"exposeToGuestVM,omitempty"` + // Folder - READ-ONLY; The path to virtual machine folder in VCenter + Folder *string `json:"folder,omitempty"` + // GuestOS - The name of Guest OS + GuestOS *string `json:"guestOS,omitempty"` + // GuestOSType - The Guest OS type. Possible values include: 'Linux', 'Windows', 'Other' + GuestOSType GuestOSType `json:"guestOSType,omitempty"` + // Nics - The list of Virtual NICs + Nics *[]VirtualNic `json:"nics,omitempty"` + // NumberOfCores - The number of CPU cores + NumberOfCores *int32 `json:"numberOfCores,omitempty"` + // Password - Password for login + Password *string `json:"password,omitempty"` + // PrivateCloudID - Private Cloud Id + PrivateCloudID *string `json:"privateCloudId,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning status of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // PublicIP - READ-ONLY; The public ip of Virtual Machine + PublicIP *string `json:"publicIP,omitempty"` + // ResourcePool - Virtual Machines Resource Pool + ResourcePool *ResourcePool `json:"resourcePool,omitempty"` + // Status - READ-ONLY; The status of Virtual machine. Possible values include: 'Running', 'Suspended', 'Poweredoff', 'Updating', 'Deallocating', 'Deleting' + Status VirtualMachineStatus `json:"status,omitempty"` + // TemplateID - Virtual Machine Template Id + TemplateID *string `json:"templateId,omitempty"` + // Username - Username for login + Username *string `json:"username,omitempty"` + // VSphereNetworks - The list of Virtual VSphere Networks + VSphereNetworks *[]string `json:"vSphereNetworks,omitempty"` + // VMID - READ-ONLY; The internal id of Virtual Machine in VCenter + VMID *string `json:"vmId,omitempty"` + // Vmwaretools - READ-ONLY; VMware tools version + Vmwaretools *string `json:"vmwaretools,omitempty"` +} + +// VirtualMachineStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachineStartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineStartFuture) Result(client VirtualMachineClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.VirtualMachineStartFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachineStopFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineStopFuture) Result(client VirtualMachineClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.VirtualMachineStopFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineStopMode list of virtual machine stop modes +type VirtualMachineStopMode struct { + // Mode - mode indicates a type of stop operation - reboot, suspend, shutdown or power-off. Possible values include: 'Reboot', 'Suspend', 'Shutdown', 'Poweroff' + Mode StopMode `json:"mode,omitempty"` +} + +// VirtualMachineTemplate virtual machine template model +type VirtualMachineTemplate struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; virtual machine template id (privateCloudId:vsphereId) + ID *string `json:"id,omitempty"` + // Location - Azure region + Location *string `json:"location,omitempty"` + // Name - READ-ONLY; {virtualMachineTemplateName} + Name *string `json:"name,omitempty"` + // VirtualMachineTemplateProperties - The Virtual Machine Template properties + *VirtualMachineTemplateProperties `json:"properties,omitempty"` + // Type - READ-ONLY; {resourceProviderNamespace}/{resourceType} + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineTemplate. +func (vmt VirtualMachineTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vmt.Location != nil { + objectMap["location"] = vmt.Location + } + if vmt.VirtualMachineTemplateProperties != nil { + objectMap["properties"] = vmt.VirtualMachineTemplateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualMachineTemplate struct. +func (vmt *VirtualMachineTemplate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmt.ID = &ID + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vmt.Location = &location + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmt.Name = &name + } + case "properties": + if v != nil { + var virtualMachineTemplateProperties VirtualMachineTemplateProperties + err = json.Unmarshal(*v, &virtualMachineTemplateProperties) + if err != nil { + return err + } + vmt.VirtualMachineTemplateProperties = &virtualMachineTemplateProperties + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vmt.Type = &typeVar + } + } + } + + return nil +} + +// VirtualMachineTemplateListResponse list of virtual machine templates +type VirtualMachineTemplateListResponse struct { + autorest.Response `json:"-"` + // NextLink - Link for next list of VirtualMachineTemplate + NextLink *string `json:"nextLink,omitempty"` + // Value - Results of the VM template list + Value *[]VirtualMachineTemplate `json:"value,omitempty"` +} + +// VirtualMachineTemplateListResponseIterator provides access to a complete listing of +// VirtualMachineTemplate values. +type VirtualMachineTemplateListResponseIterator struct { + i int + page VirtualMachineTemplateListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualMachineTemplateListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineTemplateListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualMachineTemplateListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualMachineTemplateListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualMachineTemplateListResponseIterator) Response() VirtualMachineTemplateListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualMachineTemplateListResponseIterator) Value() VirtualMachineTemplate { + if !iter.page.NotDone() { + return VirtualMachineTemplate{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualMachineTemplateListResponseIterator type. +func NewVirtualMachineTemplateListResponseIterator(page VirtualMachineTemplateListResponsePage) VirtualMachineTemplateListResponseIterator { + return VirtualMachineTemplateListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vmtlr VirtualMachineTemplateListResponse) IsEmpty() bool { + return vmtlr.Value == nil || len(*vmtlr.Value) == 0 +} + +// virtualMachineTemplateListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vmtlr VirtualMachineTemplateListResponse) virtualMachineTemplateListResponsePreparer(ctx context.Context) (*http.Request, error) { + if vmtlr.NextLink == nil || len(to.String(vmtlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vmtlr.NextLink))) +} + +// VirtualMachineTemplateListResponsePage contains a page of VirtualMachineTemplate values. +type VirtualMachineTemplateListResponsePage struct { + fn func(context.Context, VirtualMachineTemplateListResponse) (VirtualMachineTemplateListResponse, error) + vmtlr VirtualMachineTemplateListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualMachineTemplateListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineTemplateListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.vmtlr) + if err != nil { + return err + } + page.vmtlr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualMachineTemplateListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualMachineTemplateListResponsePage) NotDone() bool { + return !page.vmtlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualMachineTemplateListResponsePage) Response() VirtualMachineTemplateListResponse { + return page.vmtlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualMachineTemplateListResponsePage) Values() []VirtualMachineTemplate { + if page.vmtlr.IsEmpty() { + return nil + } + return *page.vmtlr.Value +} + +// Creates a new instance of the VirtualMachineTemplateListResponsePage type. +func NewVirtualMachineTemplateListResponsePage(getNextPage func(context.Context, VirtualMachineTemplateListResponse) (VirtualMachineTemplateListResponse, error)) VirtualMachineTemplateListResponsePage { + return VirtualMachineTemplateListResponsePage{fn: getNextPage} +} + +// VirtualMachineTemplateProperties properties of virtual machine template +type VirtualMachineTemplateProperties struct { + // AmountOfRAM - The amount of memory + AmountOfRAM *int32 `json:"amountOfRam,omitempty"` + // Controllers - The list of Virtual Disk Controllers + Controllers *[]VirtualDiskController `json:"controllers,omitempty"` + // Description - The description of Virtual Machine Template + Description *string `json:"description,omitempty"` + // Disks - The list of Virtual Disks + Disks *[]VirtualDisk `json:"disks,omitempty"` + // ExposeToGuestVM - Expose Guest OS or not + ExposeToGuestVM *bool `json:"exposeToGuestVM,omitempty"` + // GuestOS - The Guest OS + GuestOS *string `json:"guestOS,omitempty"` + // GuestOSType - The Guest OS types + GuestOSType *string `json:"guestOSType,omitempty"` + // Nics - The list of Virtual NICs + Nics *[]VirtualNic `json:"nics,omitempty"` + // NumberOfCores - The number of CPU cores + NumberOfCores *int32 `json:"numberOfCores,omitempty"` + // Path - path to folder + Path *string `json:"path,omitempty"` + // PrivateCloudID - The Private Cloud Id + PrivateCloudID *string `json:"privateCloudId,omitempty"` + // VSphereNetworks - The list of VSphere networks + VSphereNetworks *[]string `json:"vSphereNetworks,omitempty"` + // VSphereTags - The tags from VSphere + VSphereTags *[]string `json:"vSphereTags,omitempty"` + // Vmwaretools - READ-ONLY; The VMware tools version + Vmwaretools *string `json:"vmwaretools,omitempty"` +} + +// VirtualMachineUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachineUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachineUpdateFuture) Result(client VirtualMachineClient) (VM VirtualMachine, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.VirtualMachineUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if VM.Response.Response, err = future.GetResult(sender); err == nil && VM.Response.Response.StatusCode != http.StatusNoContent { + VM, err = client.UpdateResponder(VM.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineUpdateFuture", "Result", VM.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetwork virtual network model +type VirtualNetwork struct { + autorest.Response `json:"-"` + // Assignable - READ-ONLY; can be used in vm creation/deletion + Assignable *bool `json:"assignable,omitempty"` + // ID - virtual network id (privateCloudId:vsphereId) + ID *string `json:"id,omitempty"` + // Location - Azure region + Location *string `json:"location,omitempty"` + // Name - READ-ONLY; {VirtualNetworkName} + Name *string `json:"name,omitempty"` + // VirtualNetworkProperties - Virtual Network properties + *VirtualNetworkProperties `json:"properties,omitempty"` + // Type - READ-ONLY; {resourceProviderNamespace}/{resourceType} + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetwork. +func (vn VirtualNetwork) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vn.ID != nil { + objectMap["id"] = vn.ID + } + if vn.Location != nil { + objectMap["location"] = vn.Location + } + if vn.VirtualNetworkProperties != nil { + objectMap["properties"] = vn.VirtualNetworkProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetwork struct. +func (vn *VirtualNetwork) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "assignable": + if v != nil { + var assignable bool + err = json.Unmarshal(*v, &assignable) + if err != nil { + return err + } + vn.Assignable = &assignable + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vn.ID = &ID + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vn.Location = &location + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vn.Name = &name + } + case "properties": + if v != nil { + var virtualNetworkProperties VirtualNetworkProperties + err = json.Unmarshal(*v, &virtualNetworkProperties) + if err != nil { + return err + } + vn.VirtualNetworkProperties = &virtualNetworkProperties + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vn.Type = &typeVar + } + } + } + + return nil +} + +// VirtualNetworkListResponse list of virtual networks +type VirtualNetworkListResponse struct { + autorest.Response `json:"-"` + // NextLink - Link for next list of VirtualNetwork + NextLink *string `json:"nextLink,omitempty"` + // Value - Results of the VirtualNetwork list + Value *[]VirtualNetwork `json:"value,omitempty"` +} + +// VirtualNetworkListResponseIterator provides access to a complete listing of VirtualNetwork values. +type VirtualNetworkListResponseIterator struct { + i int + page VirtualNetworkListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkListResponseIterator) Response() VirtualNetworkListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkListResponseIterator) Value() VirtualNetwork { + if !iter.page.NotDone() { + return VirtualNetwork{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkListResponseIterator type. +func NewVirtualNetworkListResponseIterator(page VirtualNetworkListResponsePage) VirtualNetworkListResponseIterator { + return VirtualNetworkListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnlr VirtualNetworkListResponse) IsEmpty() bool { + return vnlr.Value == nil || len(*vnlr.Value) == 0 +} + +// virtualNetworkListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnlr VirtualNetworkListResponse) virtualNetworkListResponsePreparer(ctx context.Context) (*http.Request, error) { + if vnlr.NextLink == nil || len(to.String(vnlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnlr.NextLink))) +} + +// VirtualNetworkListResponsePage contains a page of VirtualNetwork values. +type VirtualNetworkListResponsePage struct { + fn func(context.Context, VirtualNetworkListResponse) (VirtualNetworkListResponse, error) + vnlr VirtualNetworkListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.vnlr) + if err != nil { + return err + } + page.vnlr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkListResponsePage) NotDone() bool { + return !page.vnlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkListResponsePage) Response() VirtualNetworkListResponse { + return page.vnlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkListResponsePage) Values() []VirtualNetwork { + if page.vnlr.IsEmpty() { + return nil + } + return *page.vnlr.Value +} + +// Creates a new instance of the VirtualNetworkListResponsePage type. +func NewVirtualNetworkListResponsePage(getNextPage func(context.Context, VirtualNetworkListResponse) (VirtualNetworkListResponse, error)) VirtualNetworkListResponsePage { + return VirtualNetworkListResponsePage{fn: getNextPage} +} + +// VirtualNetworkProperties properties of virtual network +type VirtualNetworkProperties struct { + // PrivateCloudID - READ-ONLY; The Private Cloud id + PrivateCloudID *string `json:"privateCloudId,omitempty"` +} + +// VirtualNic virtual NIC model +type VirtualNic struct { + // IPAddresses - NIC's ip address + IPAddresses *[]string `json:"ipAddresses,omitempty"` + // MacAddress - NIC's MAC address + MacAddress *string `json:"macAddress,omitempty"` + // Network - The list of Virtual Networks + Network *VirtualNetwork `json:"network,omitempty"` + // NicType - NIC's type. Possible values include: 'E1000', 'E1000E', 'PCNET32', 'VMXNET', 'VMXNET2', 'VMXNET3' + NicType NICType `json:"nicType,omitempty"` + // PowerOnBoot - Is NIC powered on/off on boot + PowerOnBoot *bool `json:"powerOnBoot,omitempty"` + // VirtualNicID - NIC's id + VirtualNicID *string `json:"virtualNicId,omitempty"` + // VirtualNicName - READ-ONLY; NIC's name + VirtualNicName *string `json:"virtualNicName,omitempty"` +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/privatecloudbyregion.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/privatecloudbyregion.go new file mode 100644 index 000000000000..f095b73de998 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/privatecloudbyregion.go @@ -0,0 +1,152 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateCloudByRegionClient is the description of the new service +type PrivateCloudByRegionClient struct { + BaseClient +} + +// NewPrivateCloudByRegionClient creates an instance of the PrivateCloudByRegionClient client. +func NewPrivateCloudByRegionClient(referer string, regionID string, subscriptionID string) PrivateCloudByRegionClient { + return NewPrivateCloudByRegionClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewPrivateCloudByRegionClientWithBaseURI creates an instance of the PrivateCloudByRegionClient client. +func NewPrivateCloudByRegionClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) PrivateCloudByRegionClient { + return PrivateCloudByRegionClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +} + +// List returns list of private clouds in particular region +func (client PrivateCloudByRegionClient) List(ctx context.Context) (result PrivateCloudListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateCloudByRegionClient.List") + defer func() { + sc := -1 + if result.pcl.Response.Response != nil { + sc = result.pcl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.PrivateCloudByRegionClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.PrivateCloudByRegionClient", "List", resp, "Failure sending request") + return + } + + result.pcl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.PrivateCloudByRegionClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateCloudByRegionClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "regionId": autorest.Encode("path", client.RegionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateCloudByRegionClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateCloudByRegionClient) ListResponder(resp *http.Response) (result PrivateCloudList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PrivateCloudByRegionClient) listNextResults(ctx context.Context, lastResults PrivateCloudList) (result PrivateCloudList, err error) { + req, err := lastResults.privateCloudListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.PrivateCloudByRegionClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.PrivateCloudByRegionClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.PrivateCloudByRegionClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateCloudByRegionClient) ListComplete(ctx context.Context) (result PrivateCloudListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateCloudByRegionClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolbypc.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolbypc.go new file mode 100644 index 000000000000..c38db4f25607 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolbypc.go @@ -0,0 +1,119 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ResourcepoolByPCClient is the description of the new service +type ResourcepoolByPCClient struct { + BaseClient +} + +// NewResourcepoolByPCClient creates an instance of the ResourcepoolByPCClient client. +func NewResourcepoolByPCClient(referer string, regionID string, subscriptionID string) ResourcepoolByPCClient { + return NewResourcepoolByPCClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewResourcepoolByPCClientWithBaseURI creates an instance of the ResourcepoolByPCClient client. +func NewResourcepoolByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcepoolByPCClient { + return ResourcepoolByPCClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +} + +// Get returns resource pool templates by its name +// Parameters: +// pcName - the private cloud name +// resourcePoolName - resource pool id (vsphereId) +func (client ResourcepoolByPCClient) Get(ctx context.Context, pcName string, resourcePoolName string) (result ResourcePool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourcepoolByPCClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, pcName, resourcePoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolByPCClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolByPCClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolByPCClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ResourcepoolByPCClient) GetPreparer(ctx context.Context, pcName string, resourcePoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", client.RegionID), + "resourcePoolName": autorest.Encode("path", resourcePoolName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/resourcePools/{resourcePoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ResourcepoolByPCClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ResourcepoolByPCClient) GetResponder(resp *http.Response) (result ResourcePool, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolsbypc.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolsbypc.go new file mode 100644 index 000000000000..7098e187a37b --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolsbypc.go @@ -0,0 +1,155 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ResourcepoolsByPCClient is the description of the new service +type ResourcepoolsByPCClient struct { + BaseClient +} + +// NewResourcepoolsByPCClient creates an instance of the ResourcepoolsByPCClient client. +func NewResourcepoolsByPCClient(referer string, regionID string, subscriptionID string) ResourcepoolsByPCClient { + return NewResourcepoolsByPCClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewResourcepoolsByPCClientWithBaseURI creates an instance of the ResourcepoolsByPCClient client. +func NewResourcepoolsByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcepoolsByPCClient { + return ResourcepoolsByPCClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +} + +// List returns list of resource pools in region for private cloud +// Parameters: +// pcName - the private cloud name +func (client ResourcepoolsByPCClient) List(ctx context.Context, pcName string) (result ResourcePoolsListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourcepoolsByPCClient.List") + defer func() { + sc := -1 + if result.rplr.Response.Response != nil { + sc = result.rplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, pcName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolsByPCClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolsByPCClient", "List", resp, "Failure sending request") + return + } + + result.rplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolsByPCClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ResourcepoolsByPCClient) ListPreparer(ctx context.Context, pcName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", client.RegionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/resourcePools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ResourcepoolsByPCClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ResourcepoolsByPCClient) ListResponder(resp *http.Response) (result ResourcePoolsListResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ResourcepoolsByPCClient) listNextResults(ctx context.Context, lastResults ResourcePoolsListResponse) (result ResourcePoolsListResponse, err error) { + req, err := lastResults.resourcePoolsListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolsByPCClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolsByPCClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolsByPCClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ResourcepoolsByPCClient) ListComplete(ctx context.Context, pcName string) (result ResourcePoolsListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourcepoolsByPCClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, pcName) + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/skusavailabilitywithinregion.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/skusavailabilitywithinregion.go new file mode 100644 index 000000000000..591c60f36fad --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/skusavailabilitywithinregion.go @@ -0,0 +1,158 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SkusAvailabilityWithinRegionClient is the description of the new service +type SkusAvailabilityWithinRegionClient struct { + BaseClient +} + +// NewSkusAvailabilityWithinRegionClient creates an instance of the SkusAvailabilityWithinRegionClient client. +func NewSkusAvailabilityWithinRegionClient(referer string, regionID string, subscriptionID string) SkusAvailabilityWithinRegionClient { + return NewSkusAvailabilityWithinRegionClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewSkusAvailabilityWithinRegionClientWithBaseURI creates an instance of the SkusAvailabilityWithinRegionClient +// client. +func NewSkusAvailabilityWithinRegionClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) SkusAvailabilityWithinRegionClient { + return SkusAvailabilityWithinRegionClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +} + +// List returns list of available resources in region +// Parameters: +// skuID - sku id, if no sku is passed availability for all skus will be returned +func (client SkusAvailabilityWithinRegionClient) List(ctx context.Context, skuID string) (result SkuAvailabilityListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkusAvailabilityWithinRegionClient.List") + defer func() { + sc := -1 + if result.salr.Response.Response != nil { + sc = result.salr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, skuID) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.SkusAvailabilityWithinRegionClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.salr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.SkusAvailabilityWithinRegionClient", "List", resp, "Failure sending request") + return + } + + result.salr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.SkusAvailabilityWithinRegionClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SkusAvailabilityWithinRegionClient) ListPreparer(ctx context.Context, skuID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "regionId": autorest.Encode("path", client.RegionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skuID) > 0 { + queryParameters["skuId"] = autorest.Encode("query", skuID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/availabilities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SkusAvailabilityWithinRegionClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SkusAvailabilityWithinRegionClient) ListResponder(resp *http.Response) (result SkuAvailabilityListResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SkusAvailabilityWithinRegionClient) listNextResults(ctx context.Context, lastResults SkuAvailabilityListResponse) (result SkuAvailabilityListResponse, err error) { + req, err := lastResults.skuAvailabilityListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.SkusAvailabilityWithinRegionClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.SkusAvailabilityWithinRegionClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.SkusAvailabilityWithinRegionClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SkusAvailabilityWithinRegionClient) ListComplete(ctx context.Context, skuID string) (result SkuAvailabilityListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkusAvailabilityWithinRegionClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, skuID) + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/usageswithinregion.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/usageswithinregion.go new file mode 100644 index 000000000000..622eaaa6f89e --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/usageswithinregion.go @@ -0,0 +1,158 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// UsagesWithinRegionClient is the description of the new service +type UsagesWithinRegionClient struct { + BaseClient +} + +// NewUsagesWithinRegionClient creates an instance of the UsagesWithinRegionClient client. +func NewUsagesWithinRegionClient(referer string, regionID string, subscriptionID string) UsagesWithinRegionClient { + return NewUsagesWithinRegionClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewUsagesWithinRegionClientWithBaseURI creates an instance of the UsagesWithinRegionClient client. +func NewUsagesWithinRegionClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) UsagesWithinRegionClient { + return UsagesWithinRegionClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +} + +// List returns list of usage in region +// Parameters: +// filter - the filter to apply on the list operation. only name.value is allowed here as a filter e.g. +// $filter=name.value eq 'xxxx' +func (client UsagesWithinRegionClient) List(ctx context.Context, filter string) (result UsageListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesWithinRegionClient.List") + defer func() { + sc := -1 + if result.ulr.Response.Response != nil { + sc = result.ulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.UsagesWithinRegionClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.UsagesWithinRegionClient", "List", resp, "Failure sending request") + return + } + + result.ulr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.UsagesWithinRegionClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsagesWithinRegionClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "regionId": autorest.Encode("path", client.RegionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsagesWithinRegionClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsagesWithinRegionClient) ListResponder(resp *http.Response) (result UsageListResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client UsagesWithinRegionClient) listNextResults(ctx context.Context, lastResults UsageListResponse) (result UsageListResponse, err error) { + req, err := lastResults.usageListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.UsagesWithinRegionClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.UsagesWithinRegionClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.UsagesWithinRegionClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client UsagesWithinRegionClient) ListComplete(ctx context.Context, filter string) (result UsageListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesWithinRegionClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, filter) + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/version.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/version.go new file mode 100644 index 000000000000..e3ce30613853 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/version.go @@ -0,0 +1,30 @@ +package vmwarecloudsimple + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + version.Number + " vmwarecloudsimple/2019-04-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualmachine.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualmachine.go new file mode 100644 index 000000000000..86709bc46cf5 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualmachine.go @@ -0,0 +1,790 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachineClient is the description of the new service +type VirtualMachineClient struct { + BaseClient +} + +// NewVirtualMachineClient creates an instance of the VirtualMachineClient client. +func NewVirtualMachineClient(referer string, regionID string, subscriptionID string) VirtualMachineClient { + return NewVirtualMachineClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewVirtualMachineClientWithBaseURI creates an instance of the VirtualMachineClient client. +func NewVirtualMachineClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualMachineClient { + return VirtualMachineClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +} + +// CreateOrUpdate create Or Update Virtual Machine +// Parameters: +// resourceGroupName - the name of the resource group +// virtualMachineName - virtual machine name +// virtualMachineRequest - create or Update Virtual Machine request +func (client VirtualMachineClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest VirtualMachine) (result VirtualMachineCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: virtualMachineName, + Constraints: []validation.Constraint{{Target: "virtualMachineName", Name: validation.Pattern, Rule: `^[-a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: virtualMachineRequest, + Constraints: []validation.Constraint{{Target: "virtualMachineRequest.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "virtualMachineRequest.Name", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "virtualMachineRequest.Name", Name: validation.Pattern, Rule: `^[-a-zA-Z0-9]+$`, Chain: nil}}}, + {Target: "virtualMachineRequest.VirtualMachineProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "virtualMachineRequest.VirtualMachineProperties.AmountOfRAM", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "virtualMachineRequest.VirtualMachineProperties.GuestOS", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "virtualMachineRequest.VirtualMachineProperties.NumberOfCores", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "virtualMachineRequest.VirtualMachineProperties.PrivateCloudID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "virtualMachineRequest.VirtualMachineProperties.ResourcePool", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "virtualMachineRequest.VirtualMachineProperties.ResourcePool.ID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("vmwarecloudsimple.VirtualMachineClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualMachineName, virtualMachineRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachineClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest VirtualMachine) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + virtualMachineRequest.ID = nil + virtualMachineRequest.Name = nil + virtualMachineRequest.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}", pathParameters), + autorest.WithJSON(virtualMachineRequest), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Referer", client.Referer)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualMachineClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachine, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete virtual machine +// Parameters: +// resourceGroupName - the name of the resource group +// virtualMachineName - virtual machine name +func (client VirtualMachineClient) Delete(ctx context.Context, resourceGroupName string, virtualMachineName string) (result VirtualMachineDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualMachineName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachineClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualMachineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Referer", client.Referer)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineClient) DeleteSender(req *http.Request) (future VirtualMachineDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualMachineClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get virtual machine +// Parameters: +// resourceGroupName - the name of the resource group +// virtualMachineName - virtual machine name +func (client VirtualMachineClient) Get(ctx context.Context, resourceGroupName string, virtualMachineName string) (result VirtualMachine, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualMachineName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualMachineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineClient) GetResponder(resp *http.Response) (result VirtualMachine, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup returns list of virtual machine within resource group +// Parameters: +// resourceGroupName - the name of the resource group +// filter - the filter to apply on the list operation +// top - the maximum number of record sets to return +// skipToken - to be used by nextLink implementation +func (client VirtualMachineClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result VirtualMachineListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.vmlr.Response.Response != nil { + sc = result.vmlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.vmlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.vmlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VirtualMachineClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VirtualMachineClient) ListByResourceGroupResponder(resp *http.Response) (result VirtualMachineListResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client VirtualMachineClient) listByResourceGroupNextResults(ctx context.Context, lastResults VirtualMachineListResponse) (result VirtualMachineListResponse, err error) { + req, err := lastResults.virtualMachineListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result VirtualMachineListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter, top, skipToken) + return +} + +// ListBySubscription returns list virtual machine within subscription +// Parameters: +// filter - the filter to apply on the list operation +// top - the maximum number of record sets to return +// skipToken - to be used by nextLink implementation +func (client VirtualMachineClient) ListBySubscription(ctx context.Context, filter string, top *int32, skipToken string) (result VirtualMachineListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineClient.ListBySubscription") + defer func() { + sc := -1 + if result.vmlr.Response.Response != nil { + sc = result.vmlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, filter, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.vmlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.vmlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client VirtualMachineClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/virtualMachines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client VirtualMachineClient) ListBySubscriptionResponder(resp *http.Response) (result VirtualMachineListResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client VirtualMachineClient) listBySubscriptionNextResults(ctx context.Context, lastResults VirtualMachineListResponse) (result VirtualMachineListResponse, err error) { + req, err := lastResults.virtualMachineListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32, skipToken string) (result VirtualMachineListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx, filter, top, skipToken) + return +} + +// Start power on virtual machine +// Parameters: +// resourceGroupName - the name of the resource group +// virtualMachineName - virtual machine name +func (client VirtualMachineClient) Start(ctx context.Context, resourceGroupName string, virtualMachineName string) (result VirtualMachineStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineClient.Start") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, virtualMachineName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client VirtualMachineClient) StartPreparer(ctx context.Context, resourceGroupName string, virtualMachineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Referer", client.Referer)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineClient) StartSender(req *http.Request) (future VirtualMachineStartFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client VirtualMachineClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop power off virtual machine, options: shutdown, poweroff, and suspend +// Parameters: +// resourceGroupName - the name of the resource group +// virtualMachineName - virtual machine name +// mParameter - body stop mode parameter (reboot, shutdown, etc...) +// mode - query stop mode parameter (reboot, shutdown, etc...) +func (client VirtualMachineClient) Stop(ctx context.Context, resourceGroupName string, virtualMachineName string, mParameter *VirtualMachineStopMode, mode StopMode) (result VirtualMachineStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineClient.Stop") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopPreparer(ctx, resourceGroupName, virtualMachineName, mParameter, mode) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client VirtualMachineClient) StopPreparer(ctx context.Context, resourceGroupName string, virtualMachineName string, mParameter *VirtualMachineStopMode, mode StopMode) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(mode)) > 0 { + queryParameters["mode"] = autorest.Encode("query", mode) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Referer", client.Referer)) + if mParameter != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(mParameter)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineClient) StopSender(req *http.Request) (future VirtualMachineStopFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client VirtualMachineClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update patch virtual machine properties +// Parameters: +// resourceGroupName - the name of the resource group +// virtualMachineName - virtual machine name +// virtualMachineRequest - patch virtual machine request +func (client VirtualMachineClient) Update(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest PatchPayload) (result VirtualMachineUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, virtualMachineName, virtualMachineRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VirtualMachineClient) UpdatePreparer(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest PatchPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}", pathParameters), + autorest.WithJSON(virtualMachineRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineClient) UpdateSender(req *http.Request) (future VirtualMachineUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VirtualMachineClient) UpdateResponder(resp *http.Response) (result VirtualMachine, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualmachinetemplatebypc.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualmachinetemplatebypc.go new file mode 100644 index 000000000000..599f48125eb8 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualmachinetemplatebypc.go @@ -0,0 +1,119 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachineTemplateByPCClient is the description of the new service +type VirtualMachineTemplateByPCClient struct { + BaseClient +} + +// NewVirtualMachineTemplateByPCClient creates an instance of the VirtualMachineTemplateByPCClient client. +func NewVirtualMachineTemplateByPCClient(referer string, regionID string, subscriptionID string) VirtualMachineTemplateByPCClient { + return NewVirtualMachineTemplateByPCClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewVirtualMachineTemplateByPCClientWithBaseURI creates an instance of the VirtualMachineTemplateByPCClient client. +func NewVirtualMachineTemplateByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualMachineTemplateByPCClient { + return VirtualMachineTemplateByPCClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +} + +// Get returns virtual machine templates by its name +// Parameters: +// pcName - the private cloud name +// virtualMachineTemplateName - virtual machine template id (vsphereId) +func (client VirtualMachineTemplateByPCClient) Get(ctx context.Context, pcName string, virtualMachineTemplateName string) (result VirtualMachineTemplate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineTemplateByPCClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, pcName, virtualMachineTemplateName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplateByPCClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplateByPCClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplateByPCClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineTemplateByPCClient) GetPreparer(ctx context.Context, pcName string, virtualMachineTemplateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", client.RegionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineTemplateName": autorest.Encode("path", virtualMachineTemplateName), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualMachineTemplates/{virtualMachineTemplateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineTemplateByPCClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineTemplateByPCClient) GetResponder(resp *http.Response) (result VirtualMachineTemplate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualmachinetemplatesbypc.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualmachinetemplatesbypc.go new file mode 100644 index 000000000000..a5d5725a5fa4 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualmachinetemplatesbypc.go @@ -0,0 +1,157 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachineTemplatesByPCClient is the description of the new service +type VirtualMachineTemplatesByPCClient struct { + BaseClient +} + +// NewVirtualMachineTemplatesByPCClient creates an instance of the VirtualMachineTemplatesByPCClient client. +func NewVirtualMachineTemplatesByPCClient(referer string, regionID string, subscriptionID string) VirtualMachineTemplatesByPCClient { + return NewVirtualMachineTemplatesByPCClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewVirtualMachineTemplatesByPCClientWithBaseURI creates an instance of the VirtualMachineTemplatesByPCClient client. +func NewVirtualMachineTemplatesByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualMachineTemplatesByPCClient { + return VirtualMachineTemplatesByPCClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +} + +// List returns list of virtual machine templates in region for private cloud +// Parameters: +// pcName - the private cloud name +// resourcePoolName - resource pool used to derive vSphere cluster which contains VM templates +func (client VirtualMachineTemplatesByPCClient) List(ctx context.Context, pcName string, resourcePoolName string) (result VirtualMachineTemplateListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineTemplatesByPCClient.List") + defer func() { + sc := -1 + if result.vmtlr.Response.Response != nil { + sc = result.vmtlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, pcName, resourcePoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplatesByPCClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vmtlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplatesByPCClient", "List", resp, "Failure sending request") + return + } + + result.vmtlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplatesByPCClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineTemplatesByPCClient) ListPreparer(ctx context.Context, pcName string, resourcePoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", client.RegionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "resourcePoolName": autorest.Encode("query", resourcePoolName), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualMachineTemplates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineTemplatesByPCClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineTemplatesByPCClient) ListResponder(resp *http.Response) (result VirtualMachineTemplateListResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualMachineTemplatesByPCClient) listNextResults(ctx context.Context, lastResults VirtualMachineTemplateListResponse) (result VirtualMachineTemplateListResponse, err error) { + req, err := lastResults.virtualMachineTemplateListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplatesByPCClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplatesByPCClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplatesByPCClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineTemplatesByPCClient) ListComplete(ctx context.Context, pcName string, resourcePoolName string) (result VirtualMachineTemplateListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineTemplatesByPCClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, pcName, resourcePoolName) + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualnetworkbypc.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualnetworkbypc.go new file mode 100644 index 000000000000..1b08089c05f9 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualnetworkbypc.go @@ -0,0 +1,119 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualNetworkByPCClient is the description of the new service +type VirtualNetworkByPCClient struct { + BaseClient +} + +// NewVirtualNetworkByPCClient creates an instance of the VirtualNetworkByPCClient client. +func NewVirtualNetworkByPCClient(referer string, regionID string, subscriptionID string) VirtualNetworkByPCClient { + return NewVirtualNetworkByPCClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewVirtualNetworkByPCClientWithBaseURI creates an instance of the VirtualNetworkByPCClient client. +func NewVirtualNetworkByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualNetworkByPCClient { + return VirtualNetworkByPCClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +} + +// Get return virtual network by its name +// Parameters: +// pcName - the private cloud name +// virtualNetworkName - virtual network id (vsphereId) +func (client VirtualNetworkByPCClient) Get(ctx context.Context, pcName string, virtualNetworkName string) (result VirtualNetwork, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkByPCClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, pcName, virtualNetworkName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworkByPCClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworkByPCClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworkByPCClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworkByPCClient) GetPreparer(ctx context.Context, pcName string, virtualNetworkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", client.RegionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualNetworks/{virtualNetworkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkByPCClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworkByPCClient) GetResponder(resp *http.Response) (result VirtualNetwork, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualnetworksbypc.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualnetworksbypc.go new file mode 100644 index 000000000000..6fbb3809ba12 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/virtualnetworksbypc.go @@ -0,0 +1,157 @@ +package vmwarecloudsimple + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualNetworksByPCClient is the description of the new service +type VirtualNetworksByPCClient struct { + BaseClient +} + +// NewVirtualNetworksByPCClient creates an instance of the VirtualNetworksByPCClient client. +func NewVirtualNetworksByPCClient(referer string, regionID string, subscriptionID string) VirtualNetworksByPCClient { + return NewVirtualNetworksByPCClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +} + +// NewVirtualNetworksByPCClientWithBaseURI creates an instance of the VirtualNetworksByPCClient client. +func NewVirtualNetworksByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) VirtualNetworksByPCClient { + return VirtualNetworksByPCClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +} + +// List return list of virtual networks in location for private cloud +// Parameters: +// pcName - the private cloud name +// resourcePoolName - resource pool used to derive vSphere cluster which contains virtual networks +func (client VirtualNetworksByPCClient) List(ctx context.Context, pcName string, resourcePoolName string) (result VirtualNetworkListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksByPCClient.List") + defer func() { + sc := -1 + if result.vnlr.Response.Response != nil { + sc = result.vnlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, pcName, resourcePoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworksByPCClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vnlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworksByPCClient", "List", resp, "Failure sending request") + return + } + + result.vnlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworksByPCClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualNetworksByPCClient) ListPreparer(ctx context.Context, pcName string, resourcePoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", client.RegionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "resourcePoolName": autorest.Encode("query", resourcePoolName), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualNetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksByPCClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualNetworksByPCClient) ListResponder(resp *http.Response) (result VirtualNetworkListResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualNetworksByPCClient) listNextResults(ctx context.Context, lastResults VirtualNetworkListResponse) (result VirtualNetworkListResponse, err error) { + req, err := lastResults.virtualNetworkListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworksByPCClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworksByPCClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworksByPCClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworksByPCClient) ListComplete(ctx context.Context, pcName string, resourcePoolName string) (result VirtualNetworkListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksByPCClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, pcName, resourcePoolName) + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi/interfaces.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi/interfaces.go new file mode 100644 index 000000000000..8eabdd9c5d8a --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi/interfaces.go @@ -0,0 +1,140 @@ +package vmwarecloudsimpleapi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple" + "github.com/Azure/go-autorest/autorest" +) + +// BaseClientAPI contains the set of methods on the BaseClient type. +type BaseClientAPI interface { + GetOperationResultByRegion(ctx context.Context, operationID string) (result vmwarecloudsimple.GetOperationResultByRegionFuture, err error) + GetPrivateCloud(ctx context.Context, pcName string) (result vmwarecloudsimple.PrivateCloud, err error) +} + +var _ BaseClientAPI = (*vmwarecloudsimple.BaseClient)(nil) + +// AvailableOperationsClientAPI contains the set of methods on the AvailableOperationsClient type. +type AvailableOperationsClientAPI interface { + List(ctx context.Context) (result vmwarecloudsimple.AvailableOperationsListResponsePage, err error) +} + +var _ AvailableOperationsClientAPI = (*vmwarecloudsimple.AvailableOperationsClient)(nil) + +// DedicatedCloudNodeClientAPI contains the set of methods on the DedicatedCloudNodeClient type. +type DedicatedCloudNodeClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest vmwarecloudsimple.DedicatedCloudNode) (result vmwarecloudsimple.DedicatedCloudNodeCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string) (result vmwarecloudsimple.DedicatedCloudNode, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result vmwarecloudsimple.DedicatedCloudNodeListResponsePage, err error) + ListBySubscription(ctx context.Context, filter string, top *int32, skipToken string) (result vmwarecloudsimple.DedicatedCloudNodeListResponsePage, err error) + Update(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest vmwarecloudsimple.PatchPayload) (result vmwarecloudsimple.DedicatedCloudNode, err error) +} + +var _ DedicatedCloudNodeClientAPI = (*vmwarecloudsimple.DedicatedCloudNodeClient)(nil) + +// DedicatedCloudServiceClientAPI contains the set of methods on the DedicatedCloudServiceClient type. +type DedicatedCloudServiceClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string, dedicatedCloudServiceRequest vmwarecloudsimple.DedicatedCloudService) (result vmwarecloudsimple.DedicatedCloudService, err error) + Delete(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string) (result vmwarecloudsimple.DedicatedCloudServiceDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string) (result vmwarecloudsimple.DedicatedCloudService, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result vmwarecloudsimple.DedicatedCloudServiceListResponsePage, err error) + ListBySubscription(ctx context.Context, filter string, top *int32, skipToken string) (result vmwarecloudsimple.DedicatedCloudServiceListResponsePage, err error) + Update(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string, dedicatedCloudServiceRequest vmwarecloudsimple.PatchPayload) (result vmwarecloudsimple.DedicatedCloudService, err error) +} + +var _ DedicatedCloudServiceClientAPI = (*vmwarecloudsimple.DedicatedCloudServiceClient)(nil) + +// SkusAvailabilityWithinRegionClientAPI contains the set of methods on the SkusAvailabilityWithinRegionClient type. +type SkusAvailabilityWithinRegionClientAPI interface { + List(ctx context.Context, skuID string) (result vmwarecloudsimple.SkuAvailabilityListResponsePage, err error) +} + +var _ SkusAvailabilityWithinRegionClientAPI = (*vmwarecloudsimple.SkusAvailabilityWithinRegionClient)(nil) + +// PrivateCloudByRegionClientAPI contains the set of methods on the PrivateCloudByRegionClient type. +type PrivateCloudByRegionClientAPI interface { + List(ctx context.Context) (result vmwarecloudsimple.PrivateCloudListPage, err error) +} + +var _ PrivateCloudByRegionClientAPI = (*vmwarecloudsimple.PrivateCloudByRegionClient)(nil) + +// ResourcepoolsByPCClientAPI contains the set of methods on the ResourcepoolsByPCClient type. +type ResourcepoolsByPCClientAPI interface { + List(ctx context.Context, pcName string) (result vmwarecloudsimple.ResourcePoolsListResponsePage, err error) +} + +var _ ResourcepoolsByPCClientAPI = (*vmwarecloudsimple.ResourcepoolsByPCClient)(nil) + +// ResourcepoolByPCClientAPI contains the set of methods on the ResourcepoolByPCClient type. +type ResourcepoolByPCClientAPI interface { + Get(ctx context.Context, pcName string, resourcePoolName string) (result vmwarecloudsimple.ResourcePool, err error) +} + +var _ ResourcepoolByPCClientAPI = (*vmwarecloudsimple.ResourcepoolByPCClient)(nil) + +// VirtualMachineTemplatesByPCClientAPI contains the set of methods on the VirtualMachineTemplatesByPCClient type. +type VirtualMachineTemplatesByPCClientAPI interface { + List(ctx context.Context, pcName string, resourcePoolName string) (result vmwarecloudsimple.VirtualMachineTemplateListResponsePage, err error) +} + +var _ VirtualMachineTemplatesByPCClientAPI = (*vmwarecloudsimple.VirtualMachineTemplatesByPCClient)(nil) + +// VirtualMachineTemplateByPCClientAPI contains the set of methods on the VirtualMachineTemplateByPCClient type. +type VirtualMachineTemplateByPCClientAPI interface { + Get(ctx context.Context, pcName string, virtualMachineTemplateName string) (result vmwarecloudsimple.VirtualMachineTemplate, err error) +} + +var _ VirtualMachineTemplateByPCClientAPI = (*vmwarecloudsimple.VirtualMachineTemplateByPCClient)(nil) + +// VirtualNetworksByPCClientAPI contains the set of methods on the VirtualNetworksByPCClient type. +type VirtualNetworksByPCClientAPI interface { + List(ctx context.Context, pcName string, resourcePoolName string) (result vmwarecloudsimple.VirtualNetworkListResponsePage, err error) +} + +var _ VirtualNetworksByPCClientAPI = (*vmwarecloudsimple.VirtualNetworksByPCClient)(nil) + +// VirtualNetworkByPCClientAPI contains the set of methods on the VirtualNetworkByPCClient type. +type VirtualNetworkByPCClientAPI interface { + Get(ctx context.Context, pcName string, virtualNetworkName string) (result vmwarecloudsimple.VirtualNetwork, err error) +} + +var _ VirtualNetworkByPCClientAPI = (*vmwarecloudsimple.VirtualNetworkByPCClient)(nil) + +// UsagesWithinRegionClientAPI contains the set of methods on the UsagesWithinRegionClient type. +type UsagesWithinRegionClientAPI interface { + List(ctx context.Context, filter string) (result vmwarecloudsimple.UsageListResponsePage, err error) +} + +var _ UsagesWithinRegionClientAPI = (*vmwarecloudsimple.UsagesWithinRegionClient)(nil) + +// VirtualMachineClientAPI contains the set of methods on the VirtualMachineClient type. +type VirtualMachineClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest vmwarecloudsimple.VirtualMachine) (result vmwarecloudsimple.VirtualMachineCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualMachineName string) (result vmwarecloudsimple.VirtualMachineDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualMachineName string) (result vmwarecloudsimple.VirtualMachine, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result vmwarecloudsimple.VirtualMachineListResponsePage, err error) + ListBySubscription(ctx context.Context, filter string, top *int32, skipToken string) (result vmwarecloudsimple.VirtualMachineListResponsePage, err error) + Start(ctx context.Context, resourceGroupName string, virtualMachineName string) (result vmwarecloudsimple.VirtualMachineStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, virtualMachineName string, mParameter *vmwarecloudsimple.VirtualMachineStopMode, mode vmwarecloudsimple.StopMode) (result vmwarecloudsimple.VirtualMachineStopFuture, err error) + Update(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest vmwarecloudsimple.PatchPayload) (result vmwarecloudsimple.VirtualMachineUpdateFuture, err error) +} + +var _ VirtualMachineClientAPI = (*vmwarecloudsimple.VirtualMachineClient)(nil) From 7b7630a524132e54b728b945ebd15dcae005bd55 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 20 Jun 2019 19:40:24 +0000 Subject: [PATCH 2/4] Generated from 9b9c8ebbcd609e4aec9913240d1a5c4c0385debf remove x-ms-log-running-operation from get --- .../mgmt/vmwarecloudsimple/models.go | 1 - .../mgmt/vmwarecloudsimple/models.go | 1 - .../2019-04-01/vmwarecloudsimple/client.go | 26 ++++++++--------- .../2019-04-01/vmwarecloudsimple/models.go | 29 ------------------- .../vmwarecloudsimpleapi/interfaces.go | 2 +- 5 files changed, 14 insertions(+), 45 deletions(-) diff --git a/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go b/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go index 833f6b13afd5..0058a1363e39 100644 --- a/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go +++ b/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go @@ -150,7 +150,6 @@ type DedicatedCloudServiceListResponse = original.DedicatedCloudServiceListRespo type DedicatedCloudServiceListResponseIterator = original.DedicatedCloudServiceListResponseIterator type DedicatedCloudServiceListResponsePage = original.DedicatedCloudServiceListResponsePage type DedicatedCloudServiceProperties = original.DedicatedCloudServiceProperties -type GetOperationResultByRegionFuture = original.GetOperationResultByRegionFuture type OperationError = original.OperationError type OperationResource = original.OperationResource type PatchPayload = original.PatchPayload diff --git a/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go b/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go index a56a6f844aa7..5d0a8ced2d8d 100644 --- a/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go +++ b/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go @@ -150,7 +150,6 @@ type DedicatedCloudServiceListResponse = original.DedicatedCloudServiceListRespo type DedicatedCloudServiceListResponseIterator = original.DedicatedCloudServiceListResponseIterator type DedicatedCloudServiceListResponsePage = original.DedicatedCloudServiceListResponsePage type DedicatedCloudServiceProperties = original.DedicatedCloudServiceProperties -type GetOperationResultByRegionFuture = original.GetOperationResultByRegionFuture type OperationError = original.OperationError type OperationResource = original.OperationResource type PatchPayload = original.PatchPayload diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/client.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/client.go index a99d71cd56fe..a4cd4a1b7805 100644 --- a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/client.go +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/client.go @@ -61,13 +61,13 @@ func NewWithBaseURI(baseURI string, referer string, regionID string, subscriptio // GetOperationResultByRegion return an async operation // Parameters: // operationID - operation id -func (client BaseClient) GetOperationResultByRegion(ctx context.Context, operationID string) (result GetOperationResultByRegionFuture, err error) { +func (client BaseClient) GetOperationResultByRegion(ctx context.Context, operationID string) (result OperationResource, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetOperationResultByRegion") defer func() { sc := -1 - if result.Response() != nil { - sc = result.Response().StatusCode + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -78,12 +78,18 @@ func (client BaseClient) GetOperationResultByRegion(ctx context.Context, operati return } - result, err = client.GetOperationResultByRegionSender(req) + resp, err := client.GetOperationResultByRegionSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "vmwarecloudsimple.BaseClient", "GetOperationResultByRegion", result.Response(), "Failure sending request") + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.BaseClient", "GetOperationResultByRegion", resp, "Failure sending request") return } + result, err = client.GetOperationResultByRegionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.BaseClient", "GetOperationResultByRegion", resp, "Failure responding to request") + } + return } @@ -111,15 +117,9 @@ func (client BaseClient) GetOperationResultByRegionPreparer(ctx context.Context, // GetOperationResultByRegionSender sends the GetOperationResultByRegion request. The method will close the // http.Response Body if it receives an error. -func (client BaseClient) GetOperationResultByRegionSender(req *http.Request) (future GetOperationResultByRegionFuture, err error) { - var resp *http.Response - resp, err = autorest.SendWithSender(client, req, +func (client BaseClient) GetOperationResultByRegionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - future.Future, err = azure.NewFutureFromResponse(resp) - return } // GetOperationResultByRegionResponder handles the response to the GetOperationResultByRegion request. The method always diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go index eb4c0d27437a..92d7959462bd 100644 --- a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go @@ -1302,35 +1302,6 @@ type DedicatedCloudServiceProperties struct { ServiceURL *string `json:"serviceURL,omitempty"` } -// GetOperationResultByRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type GetOperationResultByRegionFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *GetOperationResultByRegionFuture) Result(client BaseClient) (or OperationResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "vmwarecloudsimple.GetOperationResultByRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.GetOperationResultByRegionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if or.Response.Response, err = future.GetResult(sender); err == nil && or.Response.Response.StatusCode != http.StatusNoContent { - or, err = client.GetOperationResultByRegionResponder(or.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "vmwarecloudsimple.GetOperationResultByRegionFuture", "Result", or.Response.Response, "Failure responding to request") - } - } - return -} - // OperationError operation error model type OperationError struct { // Code - Error's code diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi/interfaces.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi/interfaces.go index 8eabdd9c5d8a..2e9889b8190f 100644 --- a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi/interfaces.go +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi/interfaces.go @@ -25,7 +25,7 @@ import ( // BaseClientAPI contains the set of methods on the BaseClient type. type BaseClientAPI interface { - GetOperationResultByRegion(ctx context.Context, operationID string) (result vmwarecloudsimple.GetOperationResultByRegionFuture, err error) + GetOperationResultByRegion(ctx context.Context, operationID string) (result vmwarecloudsimple.OperationResource, err error) GetPrivateCloud(ctx context.Context, pcName string) (result vmwarecloudsimple.PrivateCloud, err error) } From 17321d4054c120d97a3b520b5d8b84a4f97b8730 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 20 Jun 2019 20:16:45 +0000 Subject: [PATCH 3/4] Generated from ae6d26340a332db669291111e34c074f8d5002eb happy spellchecker --- .../mgmt/vmwarecloudsimple/models.go | 28 ++++++------ .../vmwarecloudsimpleapi/models.go | 4 +- .../mgmt/vmwarecloudsimple/models.go | 28 ++++++------ .../vmwarecloudsimpleapi/models.go | 4 +- .../2019-04-01/vmwarecloudsimple/models.go | 24 +++++----- .../vmwarecloudsimple/resourcepoolbypc.go | 32 +++++++------- .../vmwarecloudsimple/resourcepoolsbypc.go | 44 +++++++++---------- .../vmwarecloudsimpleapi/interfaces.go | 12 ++--- 8 files changed, 88 insertions(+), 88 deletions(-) diff --git a/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go b/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go index 0058a1363e39..fa31c226b6f0 100644 --- a/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go +++ b/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go @@ -160,12 +160,12 @@ type PrivateCloudListIterator = original.PrivateCloudListIterator type PrivateCloudListPage = original.PrivateCloudListPage type PrivateCloudProperties = original.PrivateCloudProperties type ResourcePool = original.ResourcePool +type ResourcePoolByPCClient = original.ResourcePoolByPCClient type ResourcePoolProperties = original.ResourcePoolProperties +type ResourcePoolsByPCClient = original.ResourcePoolsByPCClient type ResourcePoolsListResponse = original.ResourcePoolsListResponse type ResourcePoolsListResponseIterator = original.ResourcePoolsListResponseIterator type ResourcePoolsListResponsePage = original.ResourcePoolsListResponsePage -type ResourcepoolByPCClient = original.ResourcepoolByPCClient -type ResourcepoolsByPCClient = original.ResourcepoolsByPCClient type Sku = original.Sku type SkuAvailability = original.SkuAvailability type SkuAvailabilityListResponse = original.SkuAvailabilityListResponse @@ -260,23 +260,23 @@ func NewPrivateCloudListIterator(page PrivateCloudListPage) PrivateCloudListIter func NewPrivateCloudListPage(getNextPage func(context.Context, PrivateCloudList) (PrivateCloudList, error)) PrivateCloudListPage { return original.NewPrivateCloudListPage(getNextPage) } -func NewResourcePoolsListResponseIterator(page ResourcePoolsListResponsePage) ResourcePoolsListResponseIterator { - return original.NewResourcePoolsListResponseIterator(page) +func NewResourcePoolByPCClient(referer string, regionID string, subscriptionID string) ResourcePoolByPCClient { + return original.NewResourcePoolByPCClient(referer, regionID, subscriptionID) } -func NewResourcePoolsListResponsePage(getNextPage func(context.Context, ResourcePoolsListResponse) (ResourcePoolsListResponse, error)) ResourcePoolsListResponsePage { - return original.NewResourcePoolsListResponsePage(getNextPage) +func NewResourcePoolByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcePoolByPCClient { + return original.NewResourcePoolByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) } -func NewResourcepoolByPCClient(referer string, regionID string, subscriptionID string) ResourcepoolByPCClient { - return original.NewResourcepoolByPCClient(referer, regionID, subscriptionID) +func NewResourcePoolsByPCClient(referer string, regionID string, subscriptionID string) ResourcePoolsByPCClient { + return original.NewResourcePoolsByPCClient(referer, regionID, subscriptionID) } -func NewResourcepoolByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcepoolByPCClient { - return original.NewResourcepoolByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +func NewResourcePoolsByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcePoolsByPCClient { + return original.NewResourcePoolsByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) } -func NewResourcepoolsByPCClient(referer string, regionID string, subscriptionID string) ResourcepoolsByPCClient { - return original.NewResourcepoolsByPCClient(referer, regionID, subscriptionID) +func NewResourcePoolsListResponseIterator(page ResourcePoolsListResponsePage) ResourcePoolsListResponseIterator { + return original.NewResourcePoolsListResponseIterator(page) } -func NewResourcepoolsByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcepoolsByPCClient { - return original.NewResourcepoolsByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +func NewResourcePoolsListResponsePage(getNextPage func(context.Context, ResourcePoolsListResponse) (ResourcePoolsListResponse, error)) ResourcePoolsListResponsePage { + return original.NewResourcePoolsListResponsePage(getNextPage) } func NewSkuAvailabilityListResponseIterator(page SkuAvailabilityListResponsePage) SkuAvailabilityListResponseIterator { return original.NewSkuAvailabilityListResponseIterator(page) diff --git a/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go b/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go index 7f422f4451b3..30246cb7a73b 100644 --- a/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go +++ b/profiles/latest/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go @@ -26,8 +26,8 @@ type BaseClientAPI = original.BaseClientAPI type DedicatedCloudNodeClientAPI = original.DedicatedCloudNodeClientAPI type DedicatedCloudServiceClientAPI = original.DedicatedCloudServiceClientAPI type PrivateCloudByRegionClientAPI = original.PrivateCloudByRegionClientAPI -type ResourcepoolByPCClientAPI = original.ResourcepoolByPCClientAPI -type ResourcepoolsByPCClientAPI = original.ResourcepoolsByPCClientAPI +type ResourcePoolByPCClientAPI = original.ResourcePoolByPCClientAPI +type ResourcePoolsByPCClientAPI = original.ResourcePoolsByPCClientAPI type SkusAvailabilityWithinRegionClientAPI = original.SkusAvailabilityWithinRegionClientAPI type UsagesWithinRegionClientAPI = original.UsagesWithinRegionClientAPI type VirtualMachineClientAPI = original.VirtualMachineClientAPI diff --git a/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go b/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go index 5d0a8ced2d8d..16b467810cc4 100644 --- a/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go +++ b/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/models.go @@ -160,12 +160,12 @@ type PrivateCloudListIterator = original.PrivateCloudListIterator type PrivateCloudListPage = original.PrivateCloudListPage type PrivateCloudProperties = original.PrivateCloudProperties type ResourcePool = original.ResourcePool +type ResourcePoolByPCClient = original.ResourcePoolByPCClient type ResourcePoolProperties = original.ResourcePoolProperties +type ResourcePoolsByPCClient = original.ResourcePoolsByPCClient type ResourcePoolsListResponse = original.ResourcePoolsListResponse type ResourcePoolsListResponseIterator = original.ResourcePoolsListResponseIterator type ResourcePoolsListResponsePage = original.ResourcePoolsListResponsePage -type ResourcepoolByPCClient = original.ResourcepoolByPCClient -type ResourcepoolsByPCClient = original.ResourcepoolsByPCClient type Sku = original.Sku type SkuAvailability = original.SkuAvailability type SkuAvailabilityListResponse = original.SkuAvailabilityListResponse @@ -260,23 +260,23 @@ func NewPrivateCloudListIterator(page PrivateCloudListPage) PrivateCloudListIter func NewPrivateCloudListPage(getNextPage func(context.Context, PrivateCloudList) (PrivateCloudList, error)) PrivateCloudListPage { return original.NewPrivateCloudListPage(getNextPage) } -func NewResourcePoolsListResponseIterator(page ResourcePoolsListResponsePage) ResourcePoolsListResponseIterator { - return original.NewResourcePoolsListResponseIterator(page) +func NewResourcePoolByPCClient(referer string, regionID string, subscriptionID string) ResourcePoolByPCClient { + return original.NewResourcePoolByPCClient(referer, regionID, subscriptionID) } -func NewResourcePoolsListResponsePage(getNextPage func(context.Context, ResourcePoolsListResponse) (ResourcePoolsListResponse, error)) ResourcePoolsListResponsePage { - return original.NewResourcePoolsListResponsePage(getNextPage) +func NewResourcePoolByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcePoolByPCClient { + return original.NewResourcePoolByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) } -func NewResourcepoolByPCClient(referer string, regionID string, subscriptionID string) ResourcepoolByPCClient { - return original.NewResourcepoolByPCClient(referer, regionID, subscriptionID) +func NewResourcePoolsByPCClient(referer string, regionID string, subscriptionID string) ResourcePoolsByPCClient { + return original.NewResourcePoolsByPCClient(referer, regionID, subscriptionID) } -func NewResourcepoolByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcepoolByPCClient { - return original.NewResourcepoolByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +func NewResourcePoolsByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcePoolsByPCClient { + return original.NewResourcePoolsByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) } -func NewResourcepoolsByPCClient(referer string, regionID string, subscriptionID string) ResourcepoolsByPCClient { - return original.NewResourcepoolsByPCClient(referer, regionID, subscriptionID) +func NewResourcePoolsListResponseIterator(page ResourcePoolsListResponsePage) ResourcePoolsListResponseIterator { + return original.NewResourcePoolsListResponseIterator(page) } -func NewResourcepoolsByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcepoolsByPCClient { - return original.NewResourcepoolsByPCClientWithBaseURI(baseURI, referer, regionID, subscriptionID) +func NewResourcePoolsListResponsePage(getNextPage func(context.Context, ResourcePoolsListResponse) (ResourcePoolsListResponse, error)) ResourcePoolsListResponsePage { + return original.NewResourcePoolsListResponsePage(getNextPage) } func NewSkuAvailabilityListResponseIterator(page SkuAvailabilityListResponsePage) SkuAvailabilityListResponseIterator { return original.NewSkuAvailabilityListResponseIterator(page) diff --git a/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go b/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go index 7f422f4451b3..30246cb7a73b 100644 --- a/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go +++ b/profiles/preview/vmwarecloudsimple/mgmt/vmwarecloudsimple/vmwarecloudsimpleapi/models.go @@ -26,8 +26,8 @@ type BaseClientAPI = original.BaseClientAPI type DedicatedCloudNodeClientAPI = original.DedicatedCloudNodeClientAPI type DedicatedCloudServiceClientAPI = original.DedicatedCloudServiceClientAPI type PrivateCloudByRegionClientAPI = original.PrivateCloudByRegionClientAPI -type ResourcepoolByPCClientAPI = original.ResourcepoolByPCClientAPI -type ResourcepoolsByPCClientAPI = original.ResourcepoolsByPCClientAPI +type ResourcePoolByPCClientAPI = original.ResourcePoolByPCClientAPI +type ResourcePoolsByPCClientAPI = original.ResourcePoolsByPCClientAPI type SkusAvailabilityWithinRegionClientAPI = original.SkusAvailabilityWithinRegionClientAPI type UsagesWithinRegionClientAPI = original.UsagesWithinRegionClientAPI type VirtualMachineClientAPI = original.VirtualMachineClientAPI diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go index 92d7959462bd..829a16155f7a 100644 --- a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go @@ -1022,7 +1022,7 @@ func (dcnp *DedicatedCloudNodeProperties) UnmarshalJSON(body []byte) error { // DedicatedCloudService dedicated cloud service model type DedicatedCloudService struct { autorest.Response `json:"-"` - // ID - READ-ONLY; /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/dedicatedcloudservices/{dedicatedCloudServiceName} + // ID - READ-ONLY; /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/dedicatedCloudServices/{dedicatedCloudServiceName} ID *string `json:"id,omitempty"` // Location - Azure region Location *string `json:"location,omitempty"` @@ -1893,11 +1893,11 @@ func NewResourcePoolsListResponsePage(getNextPage func(context.Context, Resource type Sku struct { // Capacity - The capacity of the SKU Capacity *string `json:"capacity,omitempty"` - // Description - dedicatedcloudnode example: 8 x Ten-Core Intel® Xeon® Processor E5-2640 v4 2.40GHz 25MB Cache (90W); 12 x 64GB PC4-19200 2400MHz DDR4 ECC Registered DIMM, ... + // Description - dedicatedCloudNode example: 8 x Ten-Core Intel® Xeon® Processor E5-2640 v4 2.40GHz 25MB Cache (90W); 12 x 64GB PC4-19200 2400MHz DDR4 ECC Registered DIMM, ... Description *string `json:"description,omitempty"` // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here Family *string `json:"family,omitempty"` - // Name - The name of the SKU for VMWare Cloudsimple Node + // Name - The name of the SKU for VMWare CloudSimple Node Name *string `json:"name,omitempty"` // Tier - The tier of the SKU Tier *string `json:"tier,omitempty"` @@ -1905,13 +1905,13 @@ type Sku struct { // SkuAvailability SKU availability model type SkuAvailability struct { - // DedicatedAvailabilityZoneID - CSOS Availability Zone id + // DedicatedAvailabilityZoneID - CloudSimple Availability Zone id DedicatedAvailabilityZoneID *string `json:"dedicatedAvailabilityZoneId,omitempty"` - // DedicatedAvailabilityZoneName - CSOS Availability Zone Name + // DedicatedAvailabilityZoneName - CloudSimple Availability Zone Name DedicatedAvailabilityZoneName *string `json:"dedicatedAvailabilityZoneName,omitempty"` - // DedicatedPlacementGroupID - CSOS Placement Group Id + // DedicatedPlacementGroupID - CloudSimple Placement Group Id DedicatedPlacementGroupID *string `json:"dedicatedPlacementGroupId,omitempty"` - // DedicatedPlacementGroupName - CSOS Placement Group name + // DedicatedPlacementGroupName - CloudSimple Placement Group name DedicatedPlacementGroupName *string `json:"dedicatedPlacementGroupName,omitempty"` // Limit - indicates how many resources of a given SKU is available in a AZ->PG Limit *int32 `json:"limit,omitempty"` @@ -3216,18 +3216,18 @@ type VirtualNetworkProperties struct { // VirtualNic virtual NIC model type VirtualNic struct { - // IPAddresses - NIC's ip address + // IPAddresses - NIC ip address IPAddresses *[]string `json:"ipAddresses,omitempty"` - // MacAddress - NIC's MAC address + // MacAddress - NIC MAC address MacAddress *string `json:"macAddress,omitempty"` // Network - The list of Virtual Networks Network *VirtualNetwork `json:"network,omitempty"` - // NicType - NIC's type. Possible values include: 'E1000', 'E1000E', 'PCNET32', 'VMXNET', 'VMXNET2', 'VMXNET3' + // NicType - NIC type. Possible values include: 'E1000', 'E1000E', 'PCNET32', 'VMXNET', 'VMXNET2', 'VMXNET3' NicType NICType `json:"nicType,omitempty"` // PowerOnBoot - Is NIC powered on/off on boot PowerOnBoot *bool `json:"powerOnBoot,omitempty"` - // VirtualNicID - NIC's id + // VirtualNicID - NIC id VirtualNicID *string `json:"virtualNicId,omitempty"` - // VirtualNicName - READ-ONLY; NIC's name + // VirtualNicName - READ-ONLY; NIC name VirtualNicName *string `json:"virtualNicName,omitempty"` } diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolbypc.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolbypc.go index c38db4f25607..18f3986ebf63 100644 --- a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolbypc.go +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolbypc.go @@ -25,28 +25,28 @@ import ( "net/http" ) -// ResourcepoolByPCClient is the description of the new service -type ResourcepoolByPCClient struct { +// ResourcePoolByPCClient is the description of the new service +type ResourcePoolByPCClient struct { BaseClient } -// NewResourcepoolByPCClient creates an instance of the ResourcepoolByPCClient client. -func NewResourcepoolByPCClient(referer string, regionID string, subscriptionID string) ResourcepoolByPCClient { - return NewResourcepoolByPCClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +// NewResourcePoolByPCClient creates an instance of the ResourcePoolByPCClient client. +func NewResourcePoolByPCClient(referer string, regionID string, subscriptionID string) ResourcePoolByPCClient { + return NewResourcePoolByPCClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) } -// NewResourcepoolByPCClientWithBaseURI creates an instance of the ResourcepoolByPCClient client. -func NewResourcepoolByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcepoolByPCClient { - return ResourcepoolByPCClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +// NewResourcePoolByPCClientWithBaseURI creates an instance of the ResourcePoolByPCClient client. +func NewResourcePoolByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcePoolByPCClient { + return ResourcePoolByPCClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} } // Get returns resource pool templates by its name // Parameters: // pcName - the private cloud name // resourcePoolName - resource pool id (vsphereId) -func (client ResourcepoolByPCClient) Get(ctx context.Context, pcName string, resourcePoolName string) (result ResourcePool, err error) { +func (client ResourcePoolByPCClient) Get(ctx context.Context, pcName string, resourcePoolName string) (result ResourcePool, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourcepoolByPCClient.Get") + ctx = tracing.StartSpan(ctx, fqdn+"/ResourcePoolByPCClient.Get") defer func() { sc := -1 if result.Response.Response != nil { @@ -57,27 +57,27 @@ func (client ResourcepoolByPCClient) Get(ctx context.Context, pcName string, res } req, err := client.GetPreparer(ctx, pcName, resourcePoolName) if err != nil { - err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolByPCClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolByPCClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolByPCClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolByPCClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolByPCClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolByPCClient", "Get", resp, "Failure responding to request") } return } // GetPreparer prepares the Get request. -func (client ResourcepoolByPCClient) GetPreparer(ctx context.Context, pcName string, resourcePoolName string) (*http.Request, error) { +func (client ResourcePoolByPCClient) GetPreparer(ctx context.Context, pcName string, resourcePoolName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "pcName": autorest.Encode("path", pcName), "regionId": autorest.Encode("path", client.RegionID), @@ -100,14 +100,14 @@ func (client ResourcepoolByPCClient) GetPreparer(ctx context.Context, pcName str // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client ResourcepoolByPCClient) GetSender(req *http.Request) (*http.Response, error) { +func (client ResourcePoolByPCClient) GetSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client ResourcepoolByPCClient) GetResponder(resp *http.Response) (result ResourcePool, err error) { +func (client ResourcePoolByPCClient) GetResponder(resp *http.Response) (result ResourcePool, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolsbypc.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolsbypc.go index 7098e187a37b..467b77c20a52 100644 --- a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolsbypc.go +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/resourcepoolsbypc.go @@ -25,27 +25,27 @@ import ( "net/http" ) -// ResourcepoolsByPCClient is the description of the new service -type ResourcepoolsByPCClient struct { +// ResourcePoolsByPCClient is the description of the new service +type ResourcePoolsByPCClient struct { BaseClient } -// NewResourcepoolsByPCClient creates an instance of the ResourcepoolsByPCClient client. -func NewResourcepoolsByPCClient(referer string, regionID string, subscriptionID string) ResourcepoolsByPCClient { - return NewResourcepoolsByPCClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) +// NewResourcePoolsByPCClient creates an instance of the ResourcePoolsByPCClient client. +func NewResourcePoolsByPCClient(referer string, regionID string, subscriptionID string) ResourcePoolsByPCClient { + return NewResourcePoolsByPCClientWithBaseURI(DefaultBaseURI, referer, regionID, subscriptionID) } -// NewResourcepoolsByPCClientWithBaseURI creates an instance of the ResourcepoolsByPCClient client. -func NewResourcepoolsByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcepoolsByPCClient { - return ResourcepoolsByPCClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} +// NewResourcePoolsByPCClientWithBaseURI creates an instance of the ResourcePoolsByPCClient client. +func NewResourcePoolsByPCClientWithBaseURI(baseURI string, referer string, regionID string, subscriptionID string) ResourcePoolsByPCClient { + return ResourcePoolsByPCClient{NewWithBaseURI(baseURI, referer, regionID, subscriptionID)} } // List returns list of resource pools in region for private cloud // Parameters: // pcName - the private cloud name -func (client ResourcepoolsByPCClient) List(ctx context.Context, pcName string) (result ResourcePoolsListResponsePage, err error) { +func (client ResourcePoolsByPCClient) List(ctx context.Context, pcName string) (result ResourcePoolsListResponsePage, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourcepoolsByPCClient.List") + ctx = tracing.StartSpan(ctx, fqdn+"/ResourcePoolsByPCClient.List") defer func() { sc := -1 if result.rplr.Response.Response != nil { @@ -57,27 +57,27 @@ func (client ResourcepoolsByPCClient) List(ctx context.Context, pcName string) ( result.fn = client.listNextResults req, err := client.ListPreparer(ctx, pcName) if err != nil { - err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolsByPCClient", "List", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolsByPCClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.rplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolsByPCClient", "List", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolsByPCClient", "List", resp, "Failure sending request") return } result.rplr, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolsByPCClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolsByPCClient", "List", resp, "Failure responding to request") } return } // ListPreparer prepares the List request. -func (client ResourcepoolsByPCClient) ListPreparer(ctx context.Context, pcName string) (*http.Request, error) { +func (client ResourcePoolsByPCClient) ListPreparer(ctx context.Context, pcName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "pcName": autorest.Encode("path", pcName), "regionId": autorest.Encode("path", client.RegionID), @@ -99,14 +99,14 @@ func (client ResourcepoolsByPCClient) ListPreparer(ctx context.Context, pcName s // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. -func (client ResourcepoolsByPCClient) ListSender(req *http.Request) (*http.Response, error) { +func (client ResourcePoolsByPCClient) ListSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client ResourcepoolsByPCClient) ListResponder(resp *http.Response) (result ResourcePoolsListResponse, err error) { +func (client ResourcePoolsByPCClient) ListResponder(resp *http.Response) (result ResourcePoolsListResponse, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -118,10 +118,10 @@ func (client ResourcepoolsByPCClient) ListResponder(resp *http.Response) (result } // listNextResults retrieves the next set of results, if any. -func (client ResourcepoolsByPCClient) listNextResults(ctx context.Context, lastResults ResourcePoolsListResponse) (result ResourcePoolsListResponse, err error) { +func (client ResourcePoolsByPCClient) listNextResults(ctx context.Context, lastResults ResourcePoolsListResponse) (result ResourcePoolsListResponse, err error) { req, err := lastResults.resourcePoolsListResponsePreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolsByPCClient", "listNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolsByPCClient", "listNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -129,19 +129,19 @@ func (client ResourcepoolsByPCClient) listNextResults(ctx context.Context, lastR resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolsByPCClient", "listNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolsByPCClient", "listNextResults", resp, "Failure sending next results request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcepoolsByPCClient", "listNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolsByPCClient", "listNextResults", resp, "Failure responding to next results request") } return } // ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourcepoolsByPCClient) ListComplete(ctx context.Context, pcName string) (result ResourcePoolsListResponseIterator, err error) { +func (client ResourcePoolsByPCClient) ListComplete(ctx context.Context, pcName string) (result ResourcePoolsListResponseIterator, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourcepoolsByPCClient.List") + ctx = tracing.StartSpan(ctx, fqdn+"/ResourcePoolsByPCClient.List") defer func() { sc := -1 if result.Response().Response.Response != nil { diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi/interfaces.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi/interfaces.go index 2e9889b8190f..e572ab6327ee 100644 --- a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi/interfaces.go +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/vmwarecloudsimpleapi/interfaces.go @@ -76,19 +76,19 @@ type PrivateCloudByRegionClientAPI interface { var _ PrivateCloudByRegionClientAPI = (*vmwarecloudsimple.PrivateCloudByRegionClient)(nil) -// ResourcepoolsByPCClientAPI contains the set of methods on the ResourcepoolsByPCClient type. -type ResourcepoolsByPCClientAPI interface { +// ResourcePoolsByPCClientAPI contains the set of methods on the ResourcePoolsByPCClient type. +type ResourcePoolsByPCClientAPI interface { List(ctx context.Context, pcName string) (result vmwarecloudsimple.ResourcePoolsListResponsePage, err error) } -var _ ResourcepoolsByPCClientAPI = (*vmwarecloudsimple.ResourcepoolsByPCClient)(nil) +var _ ResourcePoolsByPCClientAPI = (*vmwarecloudsimple.ResourcePoolsByPCClient)(nil) -// ResourcepoolByPCClientAPI contains the set of methods on the ResourcepoolByPCClient type. -type ResourcepoolByPCClientAPI interface { +// ResourcePoolByPCClientAPI contains the set of methods on the ResourcePoolByPCClient type. +type ResourcePoolByPCClientAPI interface { Get(ctx context.Context, pcName string, resourcePoolName string) (result vmwarecloudsimple.ResourcePool, err error) } -var _ ResourcepoolByPCClientAPI = (*vmwarecloudsimple.ResourcepoolByPCClient)(nil) +var _ ResourcePoolByPCClientAPI = (*vmwarecloudsimple.ResourcePoolByPCClient)(nil) // VirtualMachineTemplatesByPCClientAPI contains the set of methods on the VirtualMachineTemplatesByPCClient type. type VirtualMachineTemplatesByPCClientAPI interface { From f906f768c2fa7d936c486f32681cd6a82b319505 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 20 Jun 2019 20:32:10 +0000 Subject: [PATCH 4/4] Generated from f9032edb80e5046bd0e7c0a045ca5e87bfa50dd2 happy spellchecker. fix typos --- .../mgmt/2019-04-01/vmwarecloudsimple/models.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go index 829a16155f7a..5553a3032a98 100644 --- a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/models.go @@ -1624,9 +1624,9 @@ type PrivateCloudProperties struct { Type *string `json:"type,omitempty"` // VSphereVersion - e.g. "6.5u2" VSphereVersion *string `json:"vSphereVersion,omitempty"` - // VcenterFqdn - FQDN for vcneter access + // VcenterFqdn - FQDN for vcenter access VcenterFqdn *string `json:"vcenterFqdn,omitempty"` - // VcenterRefid - Vcenters' ip address + // VcenterRefid - Vcenter ip address VcenterRefid *string `json:"vcenterRefid,omitempty"` // VirtualMachineTemplates - The list of Virtual Machine Templates VirtualMachineTemplates *[]VirtualMachineTemplate `json:"virtualMachineTemplates,omitempty"` @@ -2263,7 +2263,7 @@ type VirtualDiskController struct { ID *string `json:"id,omitempty"` // Name - READ-ONLY; The display name of Controller Name *string `json:"name,omitempty"` - // SubType - READ-ONLY; dik controller subtype (VMWARE_PARAVIRTUAL, BUS_PARALEL, LSI_PARALEL, LSI_SAS) + // SubType - READ-ONLY; dik controller subtype (VMWARE_PARAVIRTUAL, BUS_PARALLEL, LSI_PARALLEL, LSI_SAS) SubType *string `json:"subType,omitempty"` // Type - READ-ONLY; disk controller type (SCSI) Type *string `json:"type,omitempty"`