From f33d07f5383f31b70491cbb7db4608dcff078efe Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Fri, 25 Oct 2019 11:47:09 +0000 Subject: [PATCH] Generated from a71df15a587ec060147aaef2dcfc12d19500fdc8 Fix json format by prettier --- .../vmwarecloudsimple/v2/CHANGELOG.md | 415 +++ .../2019-04-01/vmwarecloudsimple/v2/client.go | 53 + .../v2/dedicatedcloudnodes.go | 647 ++++ .../v2/dedicatedcloudservices.go | 618 ++++ .../2019-04-01/vmwarecloudsimple/v2/go.mod | 3 + .../2019-04-01/vmwarecloudsimple/v2/models.go | 3227 +++++++++++++++++ .../vmwarecloudsimple/v2/operations.go | 225 ++ .../vmwarecloudsimple/v2/privateclouds.go | 231 ++ .../vmwarecloudsimple/v2/resourcepools.go | 235 ++ .../vmwarecloudsimple/v2/skusavailability.go | 158 + .../2019-04-01/vmwarecloudsimple/v2/usages.go | 159 + .../vmwarecloudsimple/v2/version.go | 30 + .../vmwarecloudsimple/v2/virtualmachines.go | 789 ++++ .../v2/virtualmachinetemplates.go | 237 ++ .../vmwarecloudsimple/v2/virtualnetworks.go | 237 ++ .../v2/vmwarecloudsimpleapi/interfaces.go | 116 + 16 files changed, 7380 insertions(+) create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/CHANGELOG.md create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/client.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/dedicatedcloudnodes.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/dedicatedcloudservices.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/go.mod create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/models.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/operations.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/privateclouds.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/resourcepools.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/skusavailability.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/usages.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/version.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/virtualmachines.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/virtualmachinetemplates.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/virtualnetworks.go create mode 100644 services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/vmwarecloudsimpleapi/interfaces.go diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/CHANGELOG.md b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/CHANGELOG.md new file mode 100644 index 000000000000..294c02eecd3b --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/CHANGELOG.md @@ -0,0 +1,415 @@ +## Breaking Changes + +### Removed Funcs + +1. *DedicatedCloudNodeCreateOrUpdateFuture.Result(DedicatedCloudNodeClient) (DedicatedCloudNode,error) +1. *DedicatedCloudServiceDeleteFuture.Result(DedicatedCloudServiceClient) (autorest.Response,error) +1. *VirtualMachineCreateOrUpdateFuture.Result(VirtualMachineClient) (VirtualMachine,error) +1. *VirtualMachineDeleteFuture.Result(VirtualMachineClient) (autorest.Response,error) +1. *VirtualMachineStartFuture.Result(VirtualMachineClient) (autorest.Response,error) +1. *VirtualMachineStopFuture.Result(VirtualMachineClient) (autorest.Response,error) +1. *VirtualMachineUpdateFuture.Result(VirtualMachineClient) (VirtualMachine,error) +1. AvailableOperationsClient.List(context.Context) (AvailableOperationsListResponsePage,error) +1. AvailableOperationsClient.ListComplete(context.Context) (AvailableOperationsListResponseIterator,error) +1. AvailableOperationsClient.ListPreparer(context.Context) (*http.Request,error) +1. AvailableOperationsClient.ListResponder(*http.Response) (AvailableOperationsListResponse,error) +1. AvailableOperationsClient.ListSender(*http.Request) (*http.Response,error) +1. BaseClient.GetOperationResultByRegion(context.Context,string) (OperationResource,error) +1. BaseClient.GetOperationResultByRegionPreparer(context.Context,string) (*http.Request,error) +1. BaseClient.GetOperationResultByRegionResponder(*http.Response) (OperationResource,error) +1. BaseClient.GetOperationResultByRegionSender(*http.Request) (*http.Response,error) +1. BaseClient.GetPrivateCloud(context.Context,string) (PrivateCloud,error) +1. BaseClient.GetPrivateCloudPreparer(context.Context,string) (*http.Request,error) +1. BaseClient.GetPrivateCloudResponder(*http.Response) (PrivateCloud,error) +1. BaseClient.GetPrivateCloudSender(*http.Request) (*http.Response,error) +1. DedicatedCloudNodeClient.CreateOrUpdate(context.Context,string,string,DedicatedCloudNode) (DedicatedCloudNodeCreateOrUpdateFuture,error) +1. DedicatedCloudNodeClient.CreateOrUpdatePreparer(context.Context,string,string,DedicatedCloudNode) (*http.Request,error) +1. DedicatedCloudNodeClient.CreateOrUpdateResponder(*http.Response) (DedicatedCloudNode,error) +1. DedicatedCloudNodeClient.CreateOrUpdateSender(*http.Request) (DedicatedCloudNodeCreateOrUpdateFuture,error) +1. DedicatedCloudNodeClient.Delete(context.Context,string,string) (autorest.Response,error) +1. DedicatedCloudNodeClient.DeletePreparer(context.Context,string,string) (*http.Request,error) +1. DedicatedCloudNodeClient.DeleteResponder(*http.Response) (autorest.Response,error) +1. DedicatedCloudNodeClient.DeleteSender(*http.Request) (*http.Response,error) +1. DedicatedCloudNodeClient.Get(context.Context,string,string) (DedicatedCloudNode,error) +1. DedicatedCloudNodeClient.GetPreparer(context.Context,string,string) (*http.Request,error) +1. DedicatedCloudNodeClient.GetResponder(*http.Response) (DedicatedCloudNode,error) +1. DedicatedCloudNodeClient.GetSender(*http.Request) (*http.Response,error) +1. DedicatedCloudNodeClient.ListByResourceGroup(context.Context,string,string,*int32,string) (DedicatedCloudNodeListResponsePage,error) +1. DedicatedCloudNodeClient.ListByResourceGroupComplete(context.Context,string,string,*int32,string) (DedicatedCloudNodeListResponseIterator,error) +1. DedicatedCloudNodeClient.ListByResourceGroupPreparer(context.Context,string,string,*int32,string) (*http.Request,error) +1. DedicatedCloudNodeClient.ListByResourceGroupResponder(*http.Response) (DedicatedCloudNodeListResponse,error) +1. DedicatedCloudNodeClient.ListByResourceGroupSender(*http.Request) (*http.Response,error) +1. DedicatedCloudNodeClient.ListBySubscription(context.Context,string,*int32,string) (DedicatedCloudNodeListResponsePage,error) +1. DedicatedCloudNodeClient.ListBySubscriptionComplete(context.Context,string,*int32,string) (DedicatedCloudNodeListResponseIterator,error) +1. DedicatedCloudNodeClient.ListBySubscriptionPreparer(context.Context,string,*int32,string) (*http.Request,error) +1. DedicatedCloudNodeClient.ListBySubscriptionResponder(*http.Response) (DedicatedCloudNodeListResponse,error) +1. DedicatedCloudNodeClient.ListBySubscriptionSender(*http.Request) (*http.Response,error) +1. DedicatedCloudNodeClient.Update(context.Context,string,string,PatchPayload) (DedicatedCloudNode,error) +1. DedicatedCloudNodeClient.UpdatePreparer(context.Context,string,string,PatchPayload) (*http.Request,error) +1. DedicatedCloudNodeClient.UpdateResponder(*http.Response) (DedicatedCloudNode,error) +1. DedicatedCloudNodeClient.UpdateSender(*http.Request) (*http.Response,error) +1. DedicatedCloudServiceClient.CreateOrUpdate(context.Context,string,string,DedicatedCloudService) (DedicatedCloudService,error) +1. DedicatedCloudServiceClient.CreateOrUpdatePreparer(context.Context,string,string,DedicatedCloudService) (*http.Request,error) +1. DedicatedCloudServiceClient.CreateOrUpdateResponder(*http.Response) (DedicatedCloudService,error) +1. DedicatedCloudServiceClient.CreateOrUpdateSender(*http.Request) (*http.Response,error) +1. DedicatedCloudServiceClient.Delete(context.Context,string,string) (DedicatedCloudServiceDeleteFuture,error) +1. DedicatedCloudServiceClient.DeletePreparer(context.Context,string,string) (*http.Request,error) +1. DedicatedCloudServiceClient.DeleteResponder(*http.Response) (autorest.Response,error) +1. DedicatedCloudServiceClient.DeleteSender(*http.Request) (DedicatedCloudServiceDeleteFuture,error) +1. DedicatedCloudServiceClient.Get(context.Context,string,string) (DedicatedCloudService,error) +1. DedicatedCloudServiceClient.GetPreparer(context.Context,string,string) (*http.Request,error) +1. DedicatedCloudServiceClient.GetResponder(*http.Response) (DedicatedCloudService,error) +1. DedicatedCloudServiceClient.GetSender(*http.Request) (*http.Response,error) +1. DedicatedCloudServiceClient.ListByResourceGroup(context.Context,string,string,*int32,string) (DedicatedCloudServiceListResponsePage,error) +1. DedicatedCloudServiceClient.ListByResourceGroupComplete(context.Context,string,string,*int32,string) (DedicatedCloudServiceListResponseIterator,error) +1. DedicatedCloudServiceClient.ListByResourceGroupPreparer(context.Context,string,string,*int32,string) (*http.Request,error) +1. DedicatedCloudServiceClient.ListByResourceGroupResponder(*http.Response) (DedicatedCloudServiceListResponse,error) +1. DedicatedCloudServiceClient.ListByResourceGroupSender(*http.Request) (*http.Response,error) +1. DedicatedCloudServiceClient.ListBySubscription(context.Context,string,*int32,string) (DedicatedCloudServiceListResponsePage,error) +1. DedicatedCloudServiceClient.ListBySubscriptionComplete(context.Context,string,*int32,string) (DedicatedCloudServiceListResponseIterator,error) +1. DedicatedCloudServiceClient.ListBySubscriptionPreparer(context.Context,string,*int32,string) (*http.Request,error) +1. DedicatedCloudServiceClient.ListBySubscriptionResponder(*http.Response) (DedicatedCloudServiceListResponse,error) +1. DedicatedCloudServiceClient.ListBySubscriptionSender(*http.Request) (*http.Response,error) +1. DedicatedCloudServiceClient.Update(context.Context,string,string,PatchPayload) (DedicatedCloudService,error) +1. DedicatedCloudServiceClient.UpdatePreparer(context.Context,string,string,PatchPayload) (*http.Request,error) +1. DedicatedCloudServiceClient.UpdateResponder(*http.Response) (DedicatedCloudService,error) +1. DedicatedCloudServiceClient.UpdateSender(*http.Request) (*http.Response,error) +1. NewAvailableOperationsClient(string,string,string) AvailableOperationsClient +1. NewAvailableOperationsClientWithBaseURI(string,string,string,string) AvailableOperationsClient +1. NewDedicatedCloudNodeClient(string,string,string) DedicatedCloudNodeClient +1. NewDedicatedCloudNodeClientWithBaseURI(string,string,string,string) DedicatedCloudNodeClient +1. NewDedicatedCloudServiceClient(string,string,string) DedicatedCloudServiceClient +1. NewDedicatedCloudServiceClientWithBaseURI(string,string,string,string) DedicatedCloudServiceClient +1. NewPrivateCloudByRegionClient(string,string,string) PrivateCloudByRegionClient +1. NewPrivateCloudByRegionClientWithBaseURI(string,string,string,string) PrivateCloudByRegionClient +1. NewResourcePoolByPCClient(string,string,string) ResourcePoolByPCClient +1. NewResourcePoolByPCClientWithBaseURI(string,string,string,string) ResourcePoolByPCClient +1. NewResourcePoolsByPCClient(string,string,string) ResourcePoolsByPCClient +1. NewResourcePoolsByPCClientWithBaseURI(string,string,string,string) ResourcePoolsByPCClient +1. NewSkusAvailabilityWithinRegionClient(string,string,string) SkusAvailabilityWithinRegionClient +1. NewSkusAvailabilityWithinRegionClientWithBaseURI(string,string,string,string) SkusAvailabilityWithinRegionClient +1. NewUsagesWithinRegionClient(string,string,string) UsagesWithinRegionClient +1. NewUsagesWithinRegionClientWithBaseURI(string,string,string,string) UsagesWithinRegionClient +1. NewVirtualMachineClient(string,string,string) VirtualMachineClient +1. NewVirtualMachineClientWithBaseURI(string,string,string,string) VirtualMachineClient +1. NewVirtualMachineTemplateByPCClient(string,string,string) VirtualMachineTemplateByPCClient +1. NewVirtualMachineTemplateByPCClientWithBaseURI(string,string,string,string) VirtualMachineTemplateByPCClient +1. NewVirtualMachineTemplatesByPCClient(string,string,string) VirtualMachineTemplatesByPCClient +1. NewVirtualMachineTemplatesByPCClientWithBaseURI(string,string,string,string) VirtualMachineTemplatesByPCClient +1. NewVirtualNetworkByPCClient(string,string,string) VirtualNetworkByPCClient +1. NewVirtualNetworkByPCClientWithBaseURI(string,string,string,string) VirtualNetworkByPCClient +1. NewVirtualNetworksByPCClient(string,string,string) VirtualNetworksByPCClient +1. NewVirtualNetworksByPCClientWithBaseURI(string,string,string,string) VirtualNetworksByPCClient +1. PrivateCloudByRegionClient.List(context.Context) (PrivateCloudListPage,error) +1. PrivateCloudByRegionClient.ListComplete(context.Context) (PrivateCloudListIterator,error) +1. PrivateCloudByRegionClient.ListPreparer(context.Context) (*http.Request,error) +1. PrivateCloudByRegionClient.ListResponder(*http.Response) (PrivateCloudList,error) +1. PrivateCloudByRegionClient.ListSender(*http.Request) (*http.Response,error) +1. ResourcePoolByPCClient.Get(context.Context,string,string) (ResourcePool,error) +1. ResourcePoolByPCClient.GetPreparer(context.Context,string,string) (*http.Request,error) +1. ResourcePoolByPCClient.GetResponder(*http.Response) (ResourcePool,error) +1. ResourcePoolByPCClient.GetSender(*http.Request) (*http.Response,error) +1. ResourcePoolsByPCClient.List(context.Context,string) (ResourcePoolsListResponsePage,error) +1. ResourcePoolsByPCClient.ListComplete(context.Context,string) (ResourcePoolsListResponseIterator,error) +1. ResourcePoolsByPCClient.ListPreparer(context.Context,string) (*http.Request,error) +1. ResourcePoolsByPCClient.ListResponder(*http.Response) (ResourcePoolsListResponse,error) +1. ResourcePoolsByPCClient.ListSender(*http.Request) (*http.Response,error) +1. SkusAvailabilityWithinRegionClient.List(context.Context,string) (SkuAvailabilityListResponsePage,error) +1. SkusAvailabilityWithinRegionClient.ListComplete(context.Context,string) (SkuAvailabilityListResponseIterator,error) +1. SkusAvailabilityWithinRegionClient.ListPreparer(context.Context,string) (*http.Request,error) +1. SkusAvailabilityWithinRegionClient.ListResponder(*http.Response) (SkuAvailabilityListResponse,error) +1. SkusAvailabilityWithinRegionClient.ListSender(*http.Request) (*http.Response,error) +1. UsagesWithinRegionClient.List(context.Context,string) (UsageListResponsePage,error) +1. UsagesWithinRegionClient.ListComplete(context.Context,string) (UsageListResponseIterator,error) +1. UsagesWithinRegionClient.ListPreparer(context.Context,string) (*http.Request,error) +1. UsagesWithinRegionClient.ListResponder(*http.Response) (UsageListResponse,error) +1. UsagesWithinRegionClient.ListSender(*http.Request) (*http.Response,error) +1. VirtualMachineClient.CreateOrUpdate(context.Context,string,string,VirtualMachine) (VirtualMachineCreateOrUpdateFuture,error) +1. VirtualMachineClient.CreateOrUpdatePreparer(context.Context,string,string,VirtualMachine) (*http.Request,error) +1. VirtualMachineClient.CreateOrUpdateResponder(*http.Response) (VirtualMachine,error) +1. VirtualMachineClient.CreateOrUpdateSender(*http.Request) (VirtualMachineCreateOrUpdateFuture,error) +1. VirtualMachineClient.Delete(context.Context,string,string) (VirtualMachineDeleteFuture,error) +1. VirtualMachineClient.DeletePreparer(context.Context,string,string) (*http.Request,error) +1. VirtualMachineClient.DeleteResponder(*http.Response) (autorest.Response,error) +1. VirtualMachineClient.DeleteSender(*http.Request) (VirtualMachineDeleteFuture,error) +1. VirtualMachineClient.Get(context.Context,string,string) (VirtualMachine,error) +1. VirtualMachineClient.GetPreparer(context.Context,string,string) (*http.Request,error) +1. VirtualMachineClient.GetResponder(*http.Response) (VirtualMachine,error) +1. VirtualMachineClient.GetSender(*http.Request) (*http.Response,error) +1. VirtualMachineClient.ListByResourceGroup(context.Context,string,string,*int32,string) (VirtualMachineListResponsePage,error) +1. VirtualMachineClient.ListByResourceGroupComplete(context.Context,string,string,*int32,string) (VirtualMachineListResponseIterator,error) +1. VirtualMachineClient.ListByResourceGroupPreparer(context.Context,string,string,*int32,string) (*http.Request,error) +1. VirtualMachineClient.ListByResourceGroupResponder(*http.Response) (VirtualMachineListResponse,error) +1. VirtualMachineClient.ListByResourceGroupSender(*http.Request) (*http.Response,error) +1. VirtualMachineClient.ListBySubscription(context.Context,string,*int32,string) (VirtualMachineListResponsePage,error) +1. VirtualMachineClient.ListBySubscriptionComplete(context.Context,string,*int32,string) (VirtualMachineListResponseIterator,error) +1. VirtualMachineClient.ListBySubscriptionPreparer(context.Context,string,*int32,string) (*http.Request,error) +1. VirtualMachineClient.ListBySubscriptionResponder(*http.Response) (VirtualMachineListResponse,error) +1. VirtualMachineClient.ListBySubscriptionSender(*http.Request) (*http.Response,error) +1. VirtualMachineClient.Start(context.Context,string,string) (VirtualMachineStartFuture,error) +1. VirtualMachineClient.StartPreparer(context.Context,string,string) (*http.Request,error) +1. VirtualMachineClient.StartResponder(*http.Response) (autorest.Response,error) +1. VirtualMachineClient.StartSender(*http.Request) (VirtualMachineStartFuture,error) +1. VirtualMachineClient.Stop(context.Context,string,string,*VirtualMachineStopMode,StopMode) (VirtualMachineStopFuture,error) +1. VirtualMachineClient.StopPreparer(context.Context,string,string,*VirtualMachineStopMode,StopMode) (*http.Request,error) +1. VirtualMachineClient.StopResponder(*http.Response) (autorest.Response,error) +1. VirtualMachineClient.StopSender(*http.Request) (VirtualMachineStopFuture,error) +1. VirtualMachineClient.Update(context.Context,string,string,PatchPayload) (VirtualMachineUpdateFuture,error) +1. VirtualMachineClient.UpdatePreparer(context.Context,string,string,PatchPayload) (*http.Request,error) +1. VirtualMachineClient.UpdateResponder(*http.Response) (VirtualMachine,error) +1. VirtualMachineClient.UpdateSender(*http.Request) (VirtualMachineUpdateFuture,error) +1. VirtualMachineTemplateByPCClient.Get(context.Context,string,string) (VirtualMachineTemplate,error) +1. VirtualMachineTemplateByPCClient.GetPreparer(context.Context,string,string) (*http.Request,error) +1. VirtualMachineTemplateByPCClient.GetResponder(*http.Response) (VirtualMachineTemplate,error) +1. VirtualMachineTemplateByPCClient.GetSender(*http.Request) (*http.Response,error) +1. VirtualMachineTemplatesByPCClient.List(context.Context,string,string) (VirtualMachineTemplateListResponsePage,error) +1. VirtualMachineTemplatesByPCClient.ListComplete(context.Context,string,string) (VirtualMachineTemplateListResponseIterator,error) +1. VirtualMachineTemplatesByPCClient.ListPreparer(context.Context,string,string) (*http.Request,error) +1. VirtualMachineTemplatesByPCClient.ListResponder(*http.Response) (VirtualMachineTemplateListResponse,error) +1. VirtualMachineTemplatesByPCClient.ListSender(*http.Request) (*http.Response,error) +1. VirtualNetworkByPCClient.Get(context.Context,string,string) (VirtualNetwork,error) +1. VirtualNetworkByPCClient.GetPreparer(context.Context,string,string) (*http.Request,error) +1. VirtualNetworkByPCClient.GetResponder(*http.Response) (VirtualNetwork,error) +1. VirtualNetworkByPCClient.GetSender(*http.Request) (*http.Response,error) +1. VirtualNetworksByPCClient.List(context.Context,string,string) (VirtualNetworkListResponsePage,error) +1. VirtualNetworksByPCClient.ListComplete(context.Context,string,string) (VirtualNetworkListResponseIterator,error) +1. VirtualNetworksByPCClient.ListPreparer(context.Context,string,string) (*http.Request,error) +1. VirtualNetworksByPCClient.ListResponder(*http.Response) (VirtualNetworkListResponse,error) +1. VirtualNetworksByPCClient.ListSender(*http.Request) (*http.Response,error) + +## Struct Changes + +### Removed Structs + +1. AvailableOperationsClient +1. DedicatedCloudNodeClient +1. DedicatedCloudNodeCreateOrUpdateFuture +1. DedicatedCloudServiceClient +1. DedicatedCloudServiceDeleteFuture +1. PrivateCloudByRegionClient +1. ResourcePoolByPCClient +1. ResourcePoolsByPCClient +1. SkusAvailabilityWithinRegionClient +1. UsagesWithinRegionClient +1. VirtualMachineClient +1. VirtualMachineCreateOrUpdateFuture +1. VirtualMachineDeleteFuture +1. VirtualMachineStartFuture +1. VirtualMachineStopFuture +1. VirtualMachineTemplateByPCClient +1. VirtualMachineTemplatesByPCClient +1. VirtualMachineUpdateFuture +1. VirtualNetworkByPCClient +1. VirtualNetworksByPCClient + +### Removed Struct Fields + +1. BaseClient.RegionID + +## Signature Changes + +### Funcs + +1. New + - Params + - From: string,string,string + - To: string,string +1. NewWithBaseURI + - Params + - From: string,string,string,string + - To: string,string,string + +## New Content + +### New Funcs + +1. *DedicatedCloudNodesCreateOrUpdateFuture.Result(DedicatedCloudNodesClient) (DedicatedCloudNode,error) +1. *DedicatedCloudServicesDeleteFuture.Result(DedicatedCloudServicesClient) (autorest.Response,error) +1. *VirtualMachinesCreateOrUpdateFuture.Result(VirtualMachinesClient) (VirtualMachine,error) +1. *VirtualMachinesDeleteFuture.Result(VirtualMachinesClient) (autorest.Response,error) +1. *VirtualMachinesStartFuture.Result(VirtualMachinesClient) (autorest.Response,error) +1. *VirtualMachinesStopFuture.Result(VirtualMachinesClient) (autorest.Response,error) +1. *VirtualMachinesUpdateFuture.Result(VirtualMachinesClient) (VirtualMachine,error) +1. DedicatedCloudNodesClient.CreateOrUpdate(context.Context,string,string,DedicatedCloudNode) (DedicatedCloudNodesCreateOrUpdateFuture,error) +1. DedicatedCloudNodesClient.CreateOrUpdatePreparer(context.Context,string,string,DedicatedCloudNode) (*http.Request,error) +1. DedicatedCloudNodesClient.CreateOrUpdateResponder(*http.Response) (DedicatedCloudNode,error) +1. DedicatedCloudNodesClient.CreateOrUpdateSender(*http.Request) (DedicatedCloudNodesCreateOrUpdateFuture,error) +1. DedicatedCloudNodesClient.Delete(context.Context,string,string) (autorest.Response,error) +1. DedicatedCloudNodesClient.DeletePreparer(context.Context,string,string) (*http.Request,error) +1. DedicatedCloudNodesClient.DeleteResponder(*http.Response) (autorest.Response,error) +1. DedicatedCloudNodesClient.DeleteSender(*http.Request) (*http.Response,error) +1. DedicatedCloudNodesClient.Get(context.Context,string,string) (DedicatedCloudNode,error) +1. DedicatedCloudNodesClient.GetPreparer(context.Context,string,string) (*http.Request,error) +1. DedicatedCloudNodesClient.GetResponder(*http.Response) (DedicatedCloudNode,error) +1. DedicatedCloudNodesClient.GetSender(*http.Request) (*http.Response,error) +1. DedicatedCloudNodesClient.ListByResourceGroup(context.Context,string,string,*int32,string) (DedicatedCloudNodeListResponsePage,error) +1. DedicatedCloudNodesClient.ListByResourceGroupComplete(context.Context,string,string,*int32,string) (DedicatedCloudNodeListResponseIterator,error) +1. DedicatedCloudNodesClient.ListByResourceGroupPreparer(context.Context,string,string,*int32,string) (*http.Request,error) +1. DedicatedCloudNodesClient.ListByResourceGroupResponder(*http.Response) (DedicatedCloudNodeListResponse,error) +1. DedicatedCloudNodesClient.ListByResourceGroupSender(*http.Request) (*http.Response,error) +1. DedicatedCloudNodesClient.ListBySubscription(context.Context,string,*int32,string) (DedicatedCloudNodeListResponsePage,error) +1. DedicatedCloudNodesClient.ListBySubscriptionComplete(context.Context,string,*int32,string) (DedicatedCloudNodeListResponseIterator,error) +1. DedicatedCloudNodesClient.ListBySubscriptionPreparer(context.Context,string,*int32,string) (*http.Request,error) +1. DedicatedCloudNodesClient.ListBySubscriptionResponder(*http.Response) (DedicatedCloudNodeListResponse,error) +1. DedicatedCloudNodesClient.ListBySubscriptionSender(*http.Request) (*http.Response,error) +1. DedicatedCloudNodesClient.Update(context.Context,string,string,PatchPayload) (DedicatedCloudNode,error) +1. DedicatedCloudNodesClient.UpdatePreparer(context.Context,string,string,PatchPayload) (*http.Request,error) +1. DedicatedCloudNodesClient.UpdateResponder(*http.Response) (DedicatedCloudNode,error) +1. DedicatedCloudNodesClient.UpdateSender(*http.Request) (*http.Response,error) +1. DedicatedCloudServicesClient.CreateOrUpdate(context.Context,string,string,DedicatedCloudService) (DedicatedCloudService,error) +1. DedicatedCloudServicesClient.CreateOrUpdatePreparer(context.Context,string,string,DedicatedCloudService) (*http.Request,error) +1. DedicatedCloudServicesClient.CreateOrUpdateResponder(*http.Response) (DedicatedCloudService,error) +1. DedicatedCloudServicesClient.CreateOrUpdateSender(*http.Request) (*http.Response,error) +1. DedicatedCloudServicesClient.Delete(context.Context,string,string) (DedicatedCloudServicesDeleteFuture,error) +1. DedicatedCloudServicesClient.DeletePreparer(context.Context,string,string) (*http.Request,error) +1. DedicatedCloudServicesClient.DeleteResponder(*http.Response) (autorest.Response,error) +1. DedicatedCloudServicesClient.DeleteSender(*http.Request) (DedicatedCloudServicesDeleteFuture,error) +1. DedicatedCloudServicesClient.Get(context.Context,string,string) (DedicatedCloudService,error) +1. DedicatedCloudServicesClient.GetPreparer(context.Context,string,string) (*http.Request,error) +1. DedicatedCloudServicesClient.GetResponder(*http.Response) (DedicatedCloudService,error) +1. DedicatedCloudServicesClient.GetSender(*http.Request) (*http.Response,error) +1. DedicatedCloudServicesClient.ListByResourceGroup(context.Context,string,string,*int32,string) (DedicatedCloudServiceListResponsePage,error) +1. DedicatedCloudServicesClient.ListByResourceGroupComplete(context.Context,string,string,*int32,string) (DedicatedCloudServiceListResponseIterator,error) +1. DedicatedCloudServicesClient.ListByResourceGroupPreparer(context.Context,string,string,*int32,string) (*http.Request,error) +1. DedicatedCloudServicesClient.ListByResourceGroupResponder(*http.Response) (DedicatedCloudServiceListResponse,error) +1. DedicatedCloudServicesClient.ListByResourceGroupSender(*http.Request) (*http.Response,error) +1. DedicatedCloudServicesClient.ListBySubscription(context.Context,string,*int32,string) (DedicatedCloudServiceListResponsePage,error) +1. DedicatedCloudServicesClient.ListBySubscriptionComplete(context.Context,string,*int32,string) (DedicatedCloudServiceListResponseIterator,error) +1. DedicatedCloudServicesClient.ListBySubscriptionPreparer(context.Context,string,*int32,string) (*http.Request,error) +1. DedicatedCloudServicesClient.ListBySubscriptionResponder(*http.Response) (DedicatedCloudServiceListResponse,error) +1. DedicatedCloudServicesClient.ListBySubscriptionSender(*http.Request) (*http.Response,error) +1. DedicatedCloudServicesClient.Update(context.Context,string,string,PatchPayload) (DedicatedCloudService,error) +1. DedicatedCloudServicesClient.UpdatePreparer(context.Context,string,string,PatchPayload) (*http.Request,error) +1. DedicatedCloudServicesClient.UpdateResponder(*http.Response) (DedicatedCloudService,error) +1. DedicatedCloudServicesClient.UpdateSender(*http.Request) (*http.Response,error) +1. NewDedicatedCloudNodesClient(string,string) DedicatedCloudNodesClient +1. NewDedicatedCloudNodesClientWithBaseURI(string,string,string) DedicatedCloudNodesClient +1. NewDedicatedCloudServicesClient(string,string) DedicatedCloudServicesClient +1. NewDedicatedCloudServicesClientWithBaseURI(string,string,string) DedicatedCloudServicesClient +1. NewOperationsClient(string,string) OperationsClient +1. NewOperationsClientWithBaseURI(string,string,string) OperationsClient +1. NewPrivateCloudsClient(string,string) PrivateCloudsClient +1. NewPrivateCloudsClientWithBaseURI(string,string,string) PrivateCloudsClient +1. NewResourcePoolsClient(string,string) ResourcePoolsClient +1. NewResourcePoolsClientWithBaseURI(string,string,string) ResourcePoolsClient +1. NewSkusAvailabilityClient(string,string) SkusAvailabilityClient +1. NewSkusAvailabilityClientWithBaseURI(string,string,string) SkusAvailabilityClient +1. NewUsagesClient(string,string) UsagesClient +1. NewUsagesClientWithBaseURI(string,string,string) UsagesClient +1. NewVirtualMachineTemplatesClient(string,string) VirtualMachineTemplatesClient +1. NewVirtualMachineTemplatesClientWithBaseURI(string,string,string) VirtualMachineTemplatesClient +1. NewVirtualMachinesClient(string,string) VirtualMachinesClient +1. NewVirtualMachinesClientWithBaseURI(string,string,string) VirtualMachinesClient +1. NewVirtualNetworksClient(string,string) VirtualNetworksClient +1. NewVirtualNetworksClientWithBaseURI(string,string,string) VirtualNetworksClient +1. OperationsClient.Get(context.Context,string,string) (OperationResource,error) +1. OperationsClient.GetPreparer(context.Context,string,string) (*http.Request,error) +1. OperationsClient.GetResponder(*http.Response) (OperationResource,error) +1. OperationsClient.GetSender(*http.Request) (*http.Response,error) +1. OperationsClient.List(context.Context) (AvailableOperationsListResponsePage,error) +1. OperationsClient.ListComplete(context.Context) (AvailableOperationsListResponseIterator,error) +1. OperationsClient.ListPreparer(context.Context) (*http.Request,error) +1. OperationsClient.ListResponder(*http.Response) (AvailableOperationsListResponse,error) +1. OperationsClient.ListSender(*http.Request) (*http.Response,error) +1. PrivateCloudsClient.Get(context.Context,string,string) (PrivateCloud,error) +1. PrivateCloudsClient.GetPreparer(context.Context,string,string) (*http.Request,error) +1. PrivateCloudsClient.GetResponder(*http.Response) (PrivateCloud,error) +1. PrivateCloudsClient.GetSender(*http.Request) (*http.Response,error) +1. PrivateCloudsClient.List(context.Context,string) (PrivateCloudListPage,error) +1. PrivateCloudsClient.ListComplete(context.Context,string) (PrivateCloudListIterator,error) +1. PrivateCloudsClient.ListPreparer(context.Context,string) (*http.Request,error) +1. PrivateCloudsClient.ListResponder(*http.Response) (PrivateCloudList,error) +1. PrivateCloudsClient.ListSender(*http.Request) (*http.Response,error) +1. ResourcePoolsClient.Get(context.Context,string,string,string) (ResourcePool,error) +1. ResourcePoolsClient.GetPreparer(context.Context,string,string,string) (*http.Request,error) +1. ResourcePoolsClient.GetResponder(*http.Response) (ResourcePool,error) +1. ResourcePoolsClient.GetSender(*http.Request) (*http.Response,error) +1. ResourcePoolsClient.List(context.Context,string,string) (ResourcePoolsListResponsePage,error) +1. ResourcePoolsClient.ListComplete(context.Context,string,string) (ResourcePoolsListResponseIterator,error) +1. ResourcePoolsClient.ListPreparer(context.Context,string,string) (*http.Request,error) +1. ResourcePoolsClient.ListResponder(*http.Response) (ResourcePoolsListResponse,error) +1. ResourcePoolsClient.ListSender(*http.Request) (*http.Response,error) +1. SkusAvailabilityClient.List(context.Context,string,string) (SkuAvailabilityListResponsePage,error) +1. SkusAvailabilityClient.ListComplete(context.Context,string,string) (SkuAvailabilityListResponseIterator,error) +1. SkusAvailabilityClient.ListPreparer(context.Context,string,string) (*http.Request,error) +1. SkusAvailabilityClient.ListResponder(*http.Response) (SkuAvailabilityListResponse,error) +1. SkusAvailabilityClient.ListSender(*http.Request) (*http.Response,error) +1. UsagesClient.List(context.Context,string,string) (UsageListResponsePage,error) +1. UsagesClient.ListComplete(context.Context,string,string) (UsageListResponseIterator,error) +1. UsagesClient.ListPreparer(context.Context,string,string) (*http.Request,error) +1. UsagesClient.ListResponder(*http.Response) (UsageListResponse,error) +1. UsagesClient.ListSender(*http.Request) (*http.Response,error) +1. VirtualMachineTemplatesClient.Get(context.Context,string,string,string) (VirtualMachineTemplate,error) +1. VirtualMachineTemplatesClient.GetPreparer(context.Context,string,string,string) (*http.Request,error) +1. VirtualMachineTemplatesClient.GetResponder(*http.Response) (VirtualMachineTemplate,error) +1. VirtualMachineTemplatesClient.GetSender(*http.Request) (*http.Response,error) +1. VirtualMachineTemplatesClient.List(context.Context,string,string,string) (VirtualMachineTemplateListResponsePage,error) +1. VirtualMachineTemplatesClient.ListComplete(context.Context,string,string,string) (VirtualMachineTemplateListResponseIterator,error) +1. VirtualMachineTemplatesClient.ListPreparer(context.Context,string,string,string) (*http.Request,error) +1. VirtualMachineTemplatesClient.ListResponder(*http.Response) (VirtualMachineTemplateListResponse,error) +1. VirtualMachineTemplatesClient.ListSender(*http.Request) (*http.Response,error) +1. VirtualMachinesClient.CreateOrUpdate(context.Context,string,string,VirtualMachine) (VirtualMachinesCreateOrUpdateFuture,error) +1. VirtualMachinesClient.CreateOrUpdatePreparer(context.Context,string,string,VirtualMachine) (*http.Request,error) +1. VirtualMachinesClient.CreateOrUpdateResponder(*http.Response) (VirtualMachine,error) +1. VirtualMachinesClient.CreateOrUpdateSender(*http.Request) (VirtualMachinesCreateOrUpdateFuture,error) +1. VirtualMachinesClient.Delete(context.Context,string,string) (VirtualMachinesDeleteFuture,error) +1. VirtualMachinesClient.DeletePreparer(context.Context,string,string) (*http.Request,error) +1. VirtualMachinesClient.DeleteResponder(*http.Response) (autorest.Response,error) +1. VirtualMachinesClient.DeleteSender(*http.Request) (VirtualMachinesDeleteFuture,error) +1. VirtualMachinesClient.Get(context.Context,string,string) (VirtualMachine,error) +1. VirtualMachinesClient.GetPreparer(context.Context,string,string) (*http.Request,error) +1. VirtualMachinesClient.GetResponder(*http.Response) (VirtualMachine,error) +1. VirtualMachinesClient.GetSender(*http.Request) (*http.Response,error) +1. VirtualMachinesClient.ListByResourceGroup(context.Context,string,string,*int32,string) (VirtualMachineListResponsePage,error) +1. VirtualMachinesClient.ListByResourceGroupComplete(context.Context,string,string,*int32,string) (VirtualMachineListResponseIterator,error) +1. VirtualMachinesClient.ListByResourceGroupPreparer(context.Context,string,string,*int32,string) (*http.Request,error) +1. VirtualMachinesClient.ListByResourceGroupResponder(*http.Response) (VirtualMachineListResponse,error) +1. VirtualMachinesClient.ListByResourceGroupSender(*http.Request) (*http.Response,error) +1. VirtualMachinesClient.ListBySubscription(context.Context,string,*int32,string) (VirtualMachineListResponsePage,error) +1. VirtualMachinesClient.ListBySubscriptionComplete(context.Context,string,*int32,string) (VirtualMachineListResponseIterator,error) +1. VirtualMachinesClient.ListBySubscriptionPreparer(context.Context,string,*int32,string) (*http.Request,error) +1. VirtualMachinesClient.ListBySubscriptionResponder(*http.Response) (VirtualMachineListResponse,error) +1. VirtualMachinesClient.ListBySubscriptionSender(*http.Request) (*http.Response,error) +1. VirtualMachinesClient.Start(context.Context,string,string) (VirtualMachinesStartFuture,error) +1. VirtualMachinesClient.StartPreparer(context.Context,string,string) (*http.Request,error) +1. VirtualMachinesClient.StartResponder(*http.Response) (autorest.Response,error) +1. VirtualMachinesClient.StartSender(*http.Request) (VirtualMachinesStartFuture,error) +1. VirtualMachinesClient.Stop(context.Context,string,string,*VirtualMachineStopMode,StopMode) (VirtualMachinesStopFuture,error) +1. VirtualMachinesClient.StopPreparer(context.Context,string,string,*VirtualMachineStopMode,StopMode) (*http.Request,error) +1. VirtualMachinesClient.StopResponder(*http.Response) (autorest.Response,error) +1. VirtualMachinesClient.StopSender(*http.Request) (VirtualMachinesStopFuture,error) +1. VirtualMachinesClient.Update(context.Context,string,string,PatchPayload) (VirtualMachinesUpdateFuture,error) +1. VirtualMachinesClient.UpdatePreparer(context.Context,string,string,PatchPayload) (*http.Request,error) +1. VirtualMachinesClient.UpdateResponder(*http.Response) (VirtualMachine,error) +1. VirtualMachinesClient.UpdateSender(*http.Request) (VirtualMachinesUpdateFuture,error) +1. VirtualNetworksClient.Get(context.Context,string,string,string) (VirtualNetwork,error) +1. VirtualNetworksClient.GetPreparer(context.Context,string,string,string) (*http.Request,error) +1. VirtualNetworksClient.GetResponder(*http.Response) (VirtualNetwork,error) +1. VirtualNetworksClient.GetSender(*http.Request) (*http.Response,error) +1. VirtualNetworksClient.List(context.Context,string,string,string) (VirtualNetworkListResponsePage,error) +1. VirtualNetworksClient.ListComplete(context.Context,string,string,string) (VirtualNetworkListResponseIterator,error) +1. VirtualNetworksClient.ListPreparer(context.Context,string,string,string) (*http.Request,error) +1. VirtualNetworksClient.ListResponder(*http.Response) (VirtualNetworkListResponse,error) +1. VirtualNetworksClient.ListSender(*http.Request) (*http.Response,error) + +## Struct Changes + +### New Structs + +1. DedicatedCloudNodesClient +1. DedicatedCloudNodesCreateOrUpdateFuture +1. DedicatedCloudServicesClient +1. DedicatedCloudServicesDeleteFuture +1. OperationsClient +1. PrivateCloudsClient +1. ResourcePoolsClient +1. SkusAvailabilityClient +1. UsagesClient +1. VirtualMachineTemplatesClient +1. VirtualMachinesClient +1. VirtualMachinesCreateOrUpdateFuture +1. VirtualMachinesDeleteFuture +1. VirtualMachinesStartFuture +1. VirtualMachinesStopFuture +1. VirtualMachinesUpdateFuture +1. VirtualNetworksClient diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/client.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/client.go new file mode 100644 index 000000000000..755ae354bb34 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/client.go @@ -0,0 +1,53 @@ +// 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 ( + "github.com/Azure/go-autorest/autorest" +) + +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 + SubscriptionID string + Referer string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string, referer string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID, referer) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string, subscriptionID string, referer string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + Referer: referer, + } +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/dedicatedcloudnodes.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/dedicatedcloudnodes.go new file mode 100644 index 000000000000..bd14440bc924 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/dedicatedcloudnodes.go @@ -0,0 +1,647 @@ +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" +) + +// DedicatedCloudNodesClient is the description of the new service +type DedicatedCloudNodesClient struct { + BaseClient +} + +// NewDedicatedCloudNodesClient creates an instance of the DedicatedCloudNodesClient client. +func NewDedicatedCloudNodesClient(subscriptionID string, referer string) DedicatedCloudNodesClient { + return NewDedicatedCloudNodesClientWithBaseURI(DefaultBaseURI, subscriptionID, referer) +} + +// NewDedicatedCloudNodesClientWithBaseURI creates an instance of the DedicatedCloudNodesClient client. +func NewDedicatedCloudNodesClientWithBaseURI(baseURI string, subscriptionID string, referer string) DedicatedCloudNodesClient { + return DedicatedCloudNodesClient{NewWithBaseURI(baseURI, subscriptionID, referer)} +} + +// 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 DedicatedCloudNodesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest DedicatedCloudNode) (result DedicatedCloudNodesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodesClient.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.DedicatedCloudNodesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, dedicatedCloudNodeName, dedicatedCloudNodeRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DedicatedCloudNodesClient) 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 DedicatedCloudNodesClient) CreateOrUpdateSender(req *http.Request) (future DedicatedCloudNodesCreateOrUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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 DedicatedCloudNodesClient) 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 DedicatedCloudNodesClient) Delete(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodesClient.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.DedicatedCloudNodesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, dedicatedCloudNodeName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DedicatedCloudNodesClient) 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 DedicatedCloudNodesClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DedicatedCloudNodesClient) 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 DedicatedCloudNodesClient) Get(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string) (result DedicatedCloudNode, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodesClient.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.DedicatedCloudNodesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, dedicatedCloudNodeName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "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.DedicatedCloudNodesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DedicatedCloudNodesClient) 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), + } + + 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/dedicatedCloudNodes/{dedicatedCloudNodeName}", 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 DedicatedCloudNodesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DedicatedCloudNodesClient) 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 DedicatedCloudNodesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result DedicatedCloudNodeListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodesClient.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.DedicatedCloudNodesClient", "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.DedicatedCloudNodesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dcnlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DedicatedCloudNodesClient) 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 DedicatedCloudNodesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DedicatedCloudNodesClient) 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 DedicatedCloudNodesClient) listByResourceGroupNextResults(ctx context.Context, lastResults DedicatedCloudNodeListResponse) (result DedicatedCloudNodeListResponse, err error) { + req, err := lastResults.dedicatedCloudNodeListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "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.DedicatedCloudNodesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DedicatedCloudNodesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result DedicatedCloudNodeListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodesClient.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 DedicatedCloudNodesClient) ListBySubscription(ctx context.Context, filter string, top *int32, skipToken string) (result DedicatedCloudNodeListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodesClient.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.DedicatedCloudNodesClient", "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.DedicatedCloudNodesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.dcnlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client DedicatedCloudNodesClient) 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 DedicatedCloudNodesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client DedicatedCloudNodesClient) 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 DedicatedCloudNodesClient) listBySubscriptionNextResults(ctx context.Context, lastResults DedicatedCloudNodeListResponse) (result DedicatedCloudNodeListResponse, err error) { + req, err := lastResults.dedicatedCloudNodeListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "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.DedicatedCloudNodesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client DedicatedCloudNodesClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32, skipToken string) (result DedicatedCloudNodeListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodesClient.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 DedicatedCloudNodesClient) Update(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest PatchPayload) (result DedicatedCloudNode, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodesClient.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.DedicatedCloudNodesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, dedicatedCloudNodeName, dedicatedCloudNodeRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "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.DedicatedCloudNodesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DedicatedCloudNodesClient) 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 DedicatedCloudNodesClient) UpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DedicatedCloudNodesClient) 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/v2/dedicatedcloudservices.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/dedicatedcloudservices.go new file mode 100644 index 000000000000..d92f76cfc4b1 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/dedicatedcloudservices.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" +) + +// DedicatedCloudServicesClient is the description of the new service +type DedicatedCloudServicesClient struct { + BaseClient +} + +// NewDedicatedCloudServicesClient creates an instance of the DedicatedCloudServicesClient client. +func NewDedicatedCloudServicesClient(subscriptionID string, referer string) DedicatedCloudServicesClient { + return NewDedicatedCloudServicesClientWithBaseURI(DefaultBaseURI, subscriptionID, referer) +} + +// NewDedicatedCloudServicesClientWithBaseURI creates an instance of the DedicatedCloudServicesClient client. +func NewDedicatedCloudServicesClientWithBaseURI(baseURI string, subscriptionID string, referer string) DedicatedCloudServicesClient { + return DedicatedCloudServicesClient{NewWithBaseURI(baseURI, subscriptionID, referer)} +} + +// 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 DedicatedCloudServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string, dedicatedCloudServiceRequest DedicatedCloudService) (result DedicatedCloudService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServicesClient.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.DedicatedCloudServicesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, dedicatedCloudServiceName, dedicatedCloudServiceRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServicesClient", "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.DedicatedCloudServicesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServicesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DedicatedCloudServicesClient) 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 DedicatedCloudServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DedicatedCloudServicesClient) 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 DedicatedCloudServicesClient) Delete(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string) (result DedicatedCloudServicesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServicesClient.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.DedicatedCloudServicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServicesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DedicatedCloudServicesClient) 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 DedicatedCloudServicesClient) DeleteSender(req *http.Request) (future DedicatedCloudServicesDeleteFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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 DedicatedCloudServicesClient) 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 DedicatedCloudServicesClient) Get(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string) (result DedicatedCloudService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServicesClient.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.DedicatedCloudServicesClient", "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.DedicatedCloudServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DedicatedCloudServicesClient) 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 DedicatedCloudServicesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DedicatedCloudServicesClient) 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 services within a 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 DedicatedCloudServicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result DedicatedCloudServiceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServicesClient.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.DedicatedCloudServicesClient", "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.DedicatedCloudServicesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dcslr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServicesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DedicatedCloudServicesClient) 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 DedicatedCloudServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DedicatedCloudServicesClient) 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 DedicatedCloudServicesClient) listByResourceGroupNextResults(ctx context.Context, lastResults DedicatedCloudServiceListResponse) (result DedicatedCloudServiceListResponse, err error) { + req, err := lastResults.dedicatedCloudServiceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServicesClient", "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.DedicatedCloudServicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DedicatedCloudServicesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result DedicatedCloudServiceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServicesClient.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 services within a 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 DedicatedCloudServicesClient) ListBySubscription(ctx context.Context, filter string, top *int32, skipToken string) (result DedicatedCloudServiceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServicesClient.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.DedicatedCloudServicesClient", "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.DedicatedCloudServicesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.dcslr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServicesClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client DedicatedCloudServicesClient) 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 DedicatedCloudServicesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client DedicatedCloudServicesClient) 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 DedicatedCloudServicesClient) listBySubscriptionNextResults(ctx context.Context, lastResults DedicatedCloudServiceListResponse) (result DedicatedCloudServiceListResponse, err error) { + req, err := lastResults.dedicatedCloudServiceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServicesClient", "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.DedicatedCloudServicesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServicesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client DedicatedCloudServicesClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32, skipToken string) (result DedicatedCloudServiceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServicesClient.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 DedicatedCloudServicesClient) Update(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string, dedicatedCloudServiceRequest PatchPayload) (result DedicatedCloudService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServicesClient.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.DedicatedCloudServicesClient", "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.DedicatedCloudServicesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServicesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DedicatedCloudServicesClient) 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 DedicatedCloudServicesClient) UpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DedicatedCloudServicesClient) 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/v2/go.mod b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/go.mod new file mode 100644 index 000000000000..c8d65ca6be2e --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/go.mod @@ -0,0 +1,3 @@ +module github.com/Azure/azure-sdk-for-go/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2 + +go 1.12 diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/models.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/models.go new file mode 100644 index 000000000000..b8562bc206f5 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/models.go @@ -0,0 +1,3227 @@ +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 +} + +// 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 +} + +// DedicatedCloudNodesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DedicatedCloudNodesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DedicatedCloudNodesCreateOrUpdateFuture) Result(client DedicatedCloudNodesClient) (dcn DedicatedCloudNode, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudNodesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.DedicatedCloudNodesCreateOrUpdateFuture") + 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.DedicatedCloudNodesCreateOrUpdateFuture", "Result", dcn.Response.Response, "Failure responding to request") + } + } + return +} + +// 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 +} + +// 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"` +} + +// DedicatedCloudServicesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DedicatedCloudServicesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DedicatedCloudServicesDeleteFuture) Result(client DedicatedCloudServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.DedicatedCloudServicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.DedicatedCloudServicesDeleteFuture") + return + } + ar.Response = future.Response() + 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 vcenter access + VcenterFqdn *string `json:"vcenterFqdn,omitempty"` + // VcenterRefid - Vcenter 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 - READ-ONLY; 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.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 - CloudSimple Availability Zone id + DedicatedAvailabilityZoneID *string `json:"dedicatedAvailabilityZoneId,omitempty"` + // DedicatedAvailabilityZoneName - CloudSimple Availability Zone Name + DedicatedAvailabilityZoneName *string `json:"dedicatedAvailabilityZoneName,omitempty"` + // DedicatedPlacementGroupID - CloudSimple Placement Group Id + DedicatedPlacementGroupID *string `json:"dedicatedPlacementGroupId,omitempty"` + // 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"` + // 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_PARALLEL, LSI_PARALLEL, 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 +} + +// 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 - READ-ONLY; The name of Guest OS + GuestOS *string `json:"guestOS,omitempty"` + // GuestOSType - READ-ONLY; 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"` +} + +// VirtualMachinesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachinesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesCreateOrUpdateFuture) Result(client VirtualMachinesClient) (VM VirtualMachine, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.VirtualMachinesCreateOrUpdateFuture") + 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.VirtualMachinesCreateOrUpdateFuture", "Result", VM.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesDeleteFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.VirtualMachinesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesStartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesStartFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.VirtualMachinesStartFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachinesStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesStopFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesStopFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.VirtualMachinesStopFuture") + 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"` +} + +// VirtualMachinesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualMachinesUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesUpdateFuture) Result(client VirtualMachinesClient) (VM VirtualMachine, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("vmwarecloudsimple.VirtualMachinesUpdateFuture") + 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.VirtualMachinesUpdateFuture", "Result", VM.Response.Response, "Failure responding to request") + } + } + return +} + +// 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 - READ-ONLY; The Guest OS + GuestOS *string `json:"guestOS,omitempty"` + // GuestOSType - READ-ONLY; 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"` +} + +// 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 - READ-ONLY; 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.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 ip address + IPAddresses *[]string `json:"ipAddresses,omitempty"` + // MacAddress - NIC MAC address + MacAddress *string `json:"macAddress,omitempty"` + // Network - Virtual Network + Network *VirtualNetwork `json:"network,omitempty"` + // 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 id + VirtualNicID *string `json:"virtualNicId,omitempty"` + // VirtualNicName - READ-ONLY; NIC name + VirtualNicName *string `json:"virtualNicName,omitempty"` +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/operations.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/operations.go new file mode 100644 index 000000000000..0d9056e95f88 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/operations.go @@ -0,0 +1,225 @@ +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" +) + +// OperationsClient is the description of the new service +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string, referer string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID, referer) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, referer string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID, referer)} +} + +// Get return an async operation +// Parameters: +// regionID - the region Id (westus, eastus) +// operationID - operation id +func (client OperationsClient) Get(ctx context.Context, regionID string, operationID string) (result OperationResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.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, regionID, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.OperationsClient", "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.OperationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.OperationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationsClient) GetPreparer(ctx context.Context, regionID string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "operationId": autorest.Encode("path", operationID), + "regionId": autorest.Encode("path", 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)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OperationsClient) GetResponder(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 +} + +// List return list of operations +func (client OperationsClient) List(ctx context.Context) (result AvailableOperationsListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.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.OperationsClient", "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.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.aolr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) 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 OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) 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 OperationsClient) listNextResults(ctx context.Context, lastResults AvailableOperationsListResponse) (result AvailableOperationsListResponse, err error) { + req, err := lastResults.availableOperationsListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.OperationsClient", "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.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result AvailableOperationsListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.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/v2/privateclouds.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/privateclouds.go new file mode 100644 index 000000000000..9854e510db2a --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/privateclouds.go @@ -0,0 +1,231 @@ +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" +) + +// PrivateCloudsClient is the description of the new service +type PrivateCloudsClient struct { + BaseClient +} + +// NewPrivateCloudsClient creates an instance of the PrivateCloudsClient client. +func NewPrivateCloudsClient(subscriptionID string, referer string) PrivateCloudsClient { + return NewPrivateCloudsClientWithBaseURI(DefaultBaseURI, subscriptionID, referer) +} + +// NewPrivateCloudsClientWithBaseURI creates an instance of the PrivateCloudsClient client. +func NewPrivateCloudsClientWithBaseURI(baseURI string, subscriptionID string, referer string) PrivateCloudsClient { + return PrivateCloudsClient{NewWithBaseURI(baseURI, subscriptionID, referer)} +} + +// Get returns private cloud by its name +// Parameters: +// pcName - the private cloud name +// regionID - the region Id (westus, eastus) +func (client PrivateCloudsClient) Get(ctx context.Context, pcName string, regionID string) (result PrivateCloud, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateCloudsClient.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, regionID) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.PrivateCloudsClient", "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.PrivateCloudsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.PrivateCloudsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateCloudsClient) GetPreparer(ctx context.Context, pcName string, regionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", 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)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateCloudsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateCloudsClient) GetResponder(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 +} + +// List returns list of private clouds in particular region +// Parameters: +// regionID - the region Id (westus, eastus) +func (client PrivateCloudsClient) List(ctx context.Context, regionID string) (result PrivateCloudListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateCloudsClient.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, regionID) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.PrivateCloudsClient", "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.PrivateCloudsClient", "List", resp, "Failure sending request") + return + } + + result.pcl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.PrivateCloudsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateCloudsClient) ListPreparer(ctx context.Context, regionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "regionId": autorest.Encode("path", 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 PrivateCloudsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateCloudsClient) 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 PrivateCloudsClient) listNextResults(ctx context.Context, lastResults PrivateCloudList) (result PrivateCloudList, err error) { + req, err := lastResults.privateCloudListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.PrivateCloudsClient", "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.PrivateCloudsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.PrivateCloudsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateCloudsClient) ListComplete(ctx context.Context, regionID string) (result PrivateCloudListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateCloudsClient.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, regionID) + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/resourcepools.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/resourcepools.go new file mode 100644 index 000000000000..6ec7d5d3678e --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/resourcepools.go @@ -0,0 +1,235 @@ +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" +) + +// ResourcePoolsClient is the description of the new service +type ResourcePoolsClient struct { + BaseClient +} + +// NewResourcePoolsClient creates an instance of the ResourcePoolsClient client. +func NewResourcePoolsClient(subscriptionID string, referer string) ResourcePoolsClient { + return NewResourcePoolsClientWithBaseURI(DefaultBaseURI, subscriptionID, referer) +} + +// NewResourcePoolsClientWithBaseURI creates an instance of the ResourcePoolsClient client. +func NewResourcePoolsClientWithBaseURI(baseURI string, subscriptionID string, referer string) ResourcePoolsClient { + return ResourcePoolsClient{NewWithBaseURI(baseURI, subscriptionID, referer)} +} + +// Get returns resource pool templates by its name +// Parameters: +// regionID - the region Id (westus, eastus) +// pcName - the private cloud name +// resourcePoolName - resource pool id (vsphereId) +func (client ResourcePoolsClient) Get(ctx context.Context, regionID string, pcName string, resourcePoolName string) (result ResourcePool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourcePoolsClient.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, regionID, pcName, resourcePoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolsClient", "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.ResourcePoolsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ResourcePoolsClient) GetPreparer(ctx context.Context, regionID string, pcName string, resourcePoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", 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 ResourcePoolsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ResourcePoolsClient) 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 +} + +// List returns list of resource pools in region for private cloud +// Parameters: +// regionID - the region Id (westus, eastus) +// pcName - the private cloud name +func (client ResourcePoolsClient) List(ctx context.Context, regionID string, pcName string) (result ResourcePoolsListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourcePoolsClient.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, regionID, pcName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolsClient", "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.ResourcePoolsClient", "List", resp, "Failure sending request") + return + } + + result.rplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ResourcePoolsClient) ListPreparer(ctx context.Context, regionID string, pcName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", 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 ResourcePoolsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ResourcePoolsClient) 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 ResourcePoolsClient) listNextResults(ctx context.Context, lastResults ResourcePoolsListResponse) (result ResourcePoolsListResponse, err error) { + req, err := lastResults.resourcePoolsListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolsClient", "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.ResourcePoolsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.ResourcePoolsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ResourcePoolsClient) ListComplete(ctx context.Context, regionID string, pcName string) (result ResourcePoolsListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourcePoolsClient.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, regionID, pcName) + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/skusavailability.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/skusavailability.go new file mode 100644 index 000000000000..e21ebca4196d --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/skusavailability.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" +) + +// SkusAvailabilityClient is the description of the new service +type SkusAvailabilityClient struct { + BaseClient +} + +// NewSkusAvailabilityClient creates an instance of the SkusAvailabilityClient client. +func NewSkusAvailabilityClient(subscriptionID string, referer string) SkusAvailabilityClient { + return NewSkusAvailabilityClientWithBaseURI(DefaultBaseURI, subscriptionID, referer) +} + +// NewSkusAvailabilityClientWithBaseURI creates an instance of the SkusAvailabilityClient client. +func NewSkusAvailabilityClientWithBaseURI(baseURI string, subscriptionID string, referer string) SkusAvailabilityClient { + return SkusAvailabilityClient{NewWithBaseURI(baseURI, subscriptionID, referer)} +} + +// List returns list of available resources in region +// Parameters: +// regionID - the region Id (westus, eastus) +// skuID - sku id, if no sku is passed availability for all skus will be returned +func (client SkusAvailabilityClient) List(ctx context.Context, regionID string, skuID string) (result SkuAvailabilityListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkusAvailabilityClient.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, regionID, skuID) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.SkusAvailabilityClient", "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.SkusAvailabilityClient", "List", resp, "Failure sending request") + return + } + + result.salr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.SkusAvailabilityClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SkusAvailabilityClient) ListPreparer(ctx context.Context, regionID string, skuID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "regionId": autorest.Encode("path", 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 SkusAvailabilityClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SkusAvailabilityClient) 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 SkusAvailabilityClient) listNextResults(ctx context.Context, lastResults SkuAvailabilityListResponse) (result SkuAvailabilityListResponse, err error) { + req, err := lastResults.skuAvailabilityListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.SkusAvailabilityClient", "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.SkusAvailabilityClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.SkusAvailabilityClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SkusAvailabilityClient) ListComplete(ctx context.Context, regionID string, skuID string) (result SkuAvailabilityListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkusAvailabilityClient.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, regionID, skuID) + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/usages.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/usages.go new file mode 100644 index 000000000000..71300088db19 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/usages.go @@ -0,0 +1,159 @@ +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" +) + +// UsagesClient is the description of the new service +type UsagesClient struct { + BaseClient +} + +// NewUsagesClient creates an instance of the UsagesClient client. +func NewUsagesClient(subscriptionID string, referer string) UsagesClient { + return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID, referer) +} + +// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client. +func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string, referer string) UsagesClient { + return UsagesClient{NewWithBaseURI(baseURI, subscriptionID, referer)} +} + +// List returns list of usage in region +// Parameters: +// regionID - the region Id (westus, eastus) +// 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 UsagesClient) List(ctx context.Context, regionID string, filter string) (result UsageListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.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, regionID, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.UsagesClient", "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.UsagesClient", "List", resp, "Failure sending request") + return + } + + result.ulr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.UsagesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsagesClient) ListPreparer(ctx context.Context, regionID string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "regionId": autorest.Encode("path", 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 UsagesClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsagesClient) 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 UsagesClient) listNextResults(ctx context.Context, lastResults UsageListResponse) (result UsageListResponse, err error) { + req, err := lastResults.usageListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.UsagesClient", "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.UsagesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.UsagesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client UsagesClient) ListComplete(ctx context.Context, regionID string, filter string) (result UsageListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.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, regionID, filter) + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/version.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/version.go new file mode 100644 index 000000000000..bb37b0897653 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/version.go @@ -0,0 +1,30 @@ +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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/2.0.0 vmwarecloudsimple/2019-04-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "2.0.0" +} + +// tag: services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2.0.0 diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/virtualmachines.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/virtualmachines.go new file mode 100644 index 000000000000..f6195f8bd86b --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/virtualmachines.go @@ -0,0 +1,789 @@ +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" +) + +// VirtualMachinesClient is the description of the new service +type VirtualMachinesClient struct { + BaseClient +} + +// NewVirtualMachinesClient creates an instance of the VirtualMachinesClient client. +func NewVirtualMachinesClient(subscriptionID string, referer string) VirtualMachinesClient { + return NewVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID, referer) +} + +// NewVirtualMachinesClientWithBaseURI creates an instance of the VirtualMachinesClient client. +func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string, referer string) VirtualMachinesClient { + return VirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID, referer)} +} + +// 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 VirtualMachinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest VirtualMachine) (result VirtualMachinesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.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.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.VirtualMachinesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualMachineName, virtualMachineRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachinesClient) 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 VirtualMachinesClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachinesCreateOrUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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 VirtualMachinesClient) 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 VirtualMachinesClient) Delete(ctx context.Context, resourceGroupName string, virtualMachineName string) (result VirtualMachinesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.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.VirtualMachinesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachinesClient) 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 VirtualMachinesClient) DeleteSender(req *http.Request) (future VirtualMachinesDeleteFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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 VirtualMachinesClient) 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 VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, virtualMachineName string) (result VirtualMachine, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.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.VirtualMachinesClient", "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.VirtualMachinesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachinesClient) 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 VirtualMachinesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) 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 VirtualMachinesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result VirtualMachineListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.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.VirtualMachinesClient", "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.VirtualMachinesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.vmlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VirtualMachinesClient) 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 VirtualMachinesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) 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 VirtualMachinesClient) listByResourceGroupNextResults(ctx context.Context, lastResults VirtualMachineListResponse) (result VirtualMachineListResponse, err error) { + req, err := lastResults.virtualMachineListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesClient", "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.VirtualMachinesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachinesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32, skipToken string) (result VirtualMachineListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.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 VirtualMachinesClient) ListBySubscription(ctx context.Context, filter string, top *int32, skipToken string) (result VirtualMachineListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.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.VirtualMachinesClient", "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.VirtualMachinesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.vmlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client VirtualMachinesClient) 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 VirtualMachinesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) 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 VirtualMachinesClient) listBySubscriptionNextResults(ctx context.Context, lastResults VirtualMachineListResponse) (result VirtualMachineListResponse, err error) { + req, err := lastResults.virtualMachineListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesClient", "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.VirtualMachinesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachinesClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32, skipToken string) (result VirtualMachineListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.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 VirtualMachinesClient) Start(ctx context.Context, resourceGroupName string, virtualMachineName string) (result VirtualMachinesStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.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.VirtualMachinesClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client VirtualMachinesClient) 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 VirtualMachinesClient) StartSender(req *http.Request) (future VirtualMachinesStartFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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 VirtualMachinesClient) 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 VirtualMachinesClient) Stop(ctx context.Context, resourceGroupName string, virtualMachineName string, mParameter *VirtualMachineStopMode, mode StopMode) (result VirtualMachinesStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.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.VirtualMachinesClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client VirtualMachinesClient) 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 VirtualMachinesClient) StopSender(req *http.Request) (future VirtualMachinesStopFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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 VirtualMachinesClient) 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 VirtualMachinesClient) Update(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest PatchPayload) (result VirtualMachinesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.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.VirtualMachinesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachinesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VirtualMachinesClient) 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 VirtualMachinesClient) UpdateSender(req *http.Request) (future VirtualMachinesUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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 VirtualMachinesClient) 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/v2/virtualmachinetemplates.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/virtualmachinetemplates.go new file mode 100644 index 000000000000..ef66d5e2d6aa --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/virtualmachinetemplates.go @@ -0,0 +1,237 @@ +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" +) + +// VirtualMachineTemplatesClient is the description of the new service +type VirtualMachineTemplatesClient struct { + BaseClient +} + +// NewVirtualMachineTemplatesClient creates an instance of the VirtualMachineTemplatesClient client. +func NewVirtualMachineTemplatesClient(subscriptionID string, referer string) VirtualMachineTemplatesClient { + return NewVirtualMachineTemplatesClientWithBaseURI(DefaultBaseURI, subscriptionID, referer) +} + +// NewVirtualMachineTemplatesClientWithBaseURI creates an instance of the VirtualMachineTemplatesClient client. +func NewVirtualMachineTemplatesClientWithBaseURI(baseURI string, subscriptionID string, referer string) VirtualMachineTemplatesClient { + return VirtualMachineTemplatesClient{NewWithBaseURI(baseURI, subscriptionID, referer)} +} + +// Get returns virtual machine templates by its name +// Parameters: +// regionID - the region Id (westus, eastus) +// pcName - the private cloud name +// virtualMachineTemplateName - virtual machine template id (vsphereId) +func (client VirtualMachineTemplatesClient) Get(ctx context.Context, regionID string, pcName string, virtualMachineTemplateName string) (result VirtualMachineTemplate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineTemplatesClient.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, regionID, pcName, virtualMachineTemplateName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplatesClient", "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.VirtualMachineTemplatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplatesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineTemplatesClient) GetPreparer(ctx context.Context, regionID string, pcName string, virtualMachineTemplateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", 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 VirtualMachineTemplatesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineTemplatesClient) 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 +} + +// List returns list of virtual machine templates in region for private cloud +// Parameters: +// pcName - the private cloud name +// regionID - the region Id (westus, eastus) +// resourcePoolName - resource pool used to derive vSphere cluster which contains VM templates +func (client VirtualMachineTemplatesClient) List(ctx context.Context, pcName string, regionID string, resourcePoolName string) (result VirtualMachineTemplateListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineTemplatesClient.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, regionID, resourcePoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplatesClient", "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.VirtualMachineTemplatesClient", "List", resp, "Failure sending request") + return + } + + result.vmtlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplatesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineTemplatesClient) ListPreparer(ctx context.Context, pcName string, regionID string, resourcePoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", 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 VirtualMachineTemplatesClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineTemplatesClient) 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 VirtualMachineTemplatesClient) listNextResults(ctx context.Context, lastResults VirtualMachineTemplateListResponse) (result VirtualMachineTemplateListResponse, err error) { + req, err := lastResults.virtualMachineTemplateListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplatesClient", "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.VirtualMachineTemplatesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualMachineTemplatesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineTemplatesClient) ListComplete(ctx context.Context, pcName string, regionID string, resourcePoolName string) (result VirtualMachineTemplateListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineTemplatesClient.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, regionID, resourcePoolName) + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/virtualnetworks.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/virtualnetworks.go new file mode 100644 index 000000000000..ca2631e25aeb --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/virtualnetworks.go @@ -0,0 +1,237 @@ +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" +) + +// VirtualNetworksClient is the description of the new service +type VirtualNetworksClient struct { + BaseClient +} + +// NewVirtualNetworksClient creates an instance of the VirtualNetworksClient client. +func NewVirtualNetworksClient(subscriptionID string, referer string) VirtualNetworksClient { + return NewVirtualNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID, referer) +} + +// NewVirtualNetworksClientWithBaseURI creates an instance of the VirtualNetworksClient client. +func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string, referer string) VirtualNetworksClient { + return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID, referer)} +} + +// Get return virtual network by its name +// Parameters: +// regionID - the region Id (westus, eastus) +// pcName - the private cloud name +// virtualNetworkName - virtual network id (vsphereId) +func (client VirtualNetworksClient) Get(ctx context.Context, regionID string, pcName string, virtualNetworkName string) (result VirtualNetwork, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.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, regionID, pcName, virtualNetworkName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworksClient", "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.VirtualNetworksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworksClient) GetPreparer(ctx context.Context, regionID string, pcName string, virtualNetworkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", 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 VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) 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 +} + +// List return list of virtual networks in location for private cloud +// Parameters: +// regionID - the region Id (westus, eastus) +// pcName - the private cloud name +// resourcePoolName - resource pool used to derive vSphere cluster which contains virtual networks +func (client VirtualNetworksClient) List(ctx context.Context, regionID string, pcName string, resourcePoolName string) (result VirtualNetworkListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.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, regionID, pcName, resourcePoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworksClient", "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.VirtualNetworksClient", "List", resp, "Failure sending request") + return + } + + result.vnlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworksClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualNetworksClient) ListPreparer(ctx context.Context, regionID string, pcName string, resourcePoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pcName": autorest.Encode("path", pcName), + "regionId": autorest.Encode("path", 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 VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) 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 VirtualNetworksClient) listNextResults(ctx context.Context, lastResults VirtualNetworkListResponse) (result VirtualNetworkListResponse, err error) { + req, err := lastResults.virtualNetworkListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworksClient", "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.VirtualNetworksClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "vmwarecloudsimple.VirtualNetworksClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworksClient) ListComplete(ctx context.Context, regionID string, pcName string, resourcePoolName string) (result VirtualNetworkListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.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, regionID, pcName, resourcePoolName) + return +} diff --git a/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/vmwarecloudsimpleapi/interfaces.go b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/vmwarecloudsimpleapi/interfaces.go new file mode 100644 index 000000000000..c2cdd3013b06 --- /dev/null +++ b/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple/v2/vmwarecloudsimpleapi/interfaces.go @@ -0,0 +1,116 @@ +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/v2" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + Get(ctx context.Context, regionID string, operationID string) (result vmwarecloudsimple.OperationResource, err error) + List(ctx context.Context) (result vmwarecloudsimple.AvailableOperationsListResponsePage, err error) +} + +var _ OperationsClientAPI = (*vmwarecloudsimple.OperationsClient)(nil) + +// DedicatedCloudNodesClientAPI contains the set of methods on the DedicatedCloudNodesClient type. +type DedicatedCloudNodesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest vmwarecloudsimple.DedicatedCloudNode) (result vmwarecloudsimple.DedicatedCloudNodesCreateOrUpdateFuture, 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 _ DedicatedCloudNodesClientAPI = (*vmwarecloudsimple.DedicatedCloudNodesClient)(nil) + +// DedicatedCloudServicesClientAPI contains the set of methods on the DedicatedCloudServicesClient type. +type DedicatedCloudServicesClientAPI 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.DedicatedCloudServicesDeleteFuture, 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 _ DedicatedCloudServicesClientAPI = (*vmwarecloudsimple.DedicatedCloudServicesClient)(nil) + +// SkusAvailabilityClientAPI contains the set of methods on the SkusAvailabilityClient type. +type SkusAvailabilityClientAPI interface { + List(ctx context.Context, regionID string, skuID string) (result vmwarecloudsimple.SkuAvailabilityListResponsePage, err error) +} + +var _ SkusAvailabilityClientAPI = (*vmwarecloudsimple.SkusAvailabilityClient)(nil) + +// PrivateCloudsClientAPI contains the set of methods on the PrivateCloudsClient type. +type PrivateCloudsClientAPI interface { + Get(ctx context.Context, pcName string, regionID string) (result vmwarecloudsimple.PrivateCloud, err error) + List(ctx context.Context, regionID string) (result vmwarecloudsimple.PrivateCloudListPage, err error) +} + +var _ PrivateCloudsClientAPI = (*vmwarecloudsimple.PrivateCloudsClient)(nil) + +// ResourcePoolsClientAPI contains the set of methods on the ResourcePoolsClient type. +type ResourcePoolsClientAPI interface { + Get(ctx context.Context, regionID string, pcName string, resourcePoolName string) (result vmwarecloudsimple.ResourcePool, err error) + List(ctx context.Context, regionID string, pcName string) (result vmwarecloudsimple.ResourcePoolsListResponsePage, err error) +} + +var _ ResourcePoolsClientAPI = (*vmwarecloudsimple.ResourcePoolsClient)(nil) + +// VirtualMachineTemplatesClientAPI contains the set of methods on the VirtualMachineTemplatesClient type. +type VirtualMachineTemplatesClientAPI interface { + Get(ctx context.Context, regionID string, pcName string, virtualMachineTemplateName string) (result vmwarecloudsimple.VirtualMachineTemplate, err error) + List(ctx context.Context, pcName string, regionID string, resourcePoolName string) (result vmwarecloudsimple.VirtualMachineTemplateListResponsePage, err error) +} + +var _ VirtualMachineTemplatesClientAPI = (*vmwarecloudsimple.VirtualMachineTemplatesClient)(nil) + +// VirtualNetworksClientAPI contains the set of methods on the VirtualNetworksClient type. +type VirtualNetworksClientAPI interface { + Get(ctx context.Context, regionID string, pcName string, virtualNetworkName string) (result vmwarecloudsimple.VirtualNetwork, err error) + List(ctx context.Context, regionID string, pcName string, resourcePoolName string) (result vmwarecloudsimple.VirtualNetworkListResponsePage, err error) +} + +var _ VirtualNetworksClientAPI = (*vmwarecloudsimple.VirtualNetworksClient)(nil) + +// UsagesClientAPI contains the set of methods on the UsagesClient type. +type UsagesClientAPI interface { + List(ctx context.Context, regionID string, filter string) (result vmwarecloudsimple.UsageListResponsePage, err error) +} + +var _ UsagesClientAPI = (*vmwarecloudsimple.UsagesClient)(nil) + +// VirtualMachinesClientAPI contains the set of methods on the VirtualMachinesClient type. +type VirtualMachinesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest vmwarecloudsimple.VirtualMachine) (result vmwarecloudsimple.VirtualMachinesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualMachineName string) (result vmwarecloudsimple.VirtualMachinesDeleteFuture, 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.VirtualMachinesStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, virtualMachineName string, mParameter *vmwarecloudsimple.VirtualMachineStopMode, mode vmwarecloudsimple.StopMode) (result vmwarecloudsimple.VirtualMachinesStopFuture, err error) + Update(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest vmwarecloudsimple.PatchPayload) (result vmwarecloudsimple.VirtualMachinesUpdateFuture, err error) +} + +var _ VirtualMachinesClientAPI = (*vmwarecloudsimple.VirtualMachinesClient)(nil)