diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/CHANGELOG.md b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/CHANGELOG.md index 4e7fb837b76d..7a8c4ef48b3a 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/CHANGELOG.md +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/CHANGELOG.md @@ -1,5 +1,321 @@ # Release History +## 0.3.0 (2022-04-13) +### Breaking Changes + +- Function `NewPipelineJobOperationStatusesClient` return value(s) have been changed from `(*PipelineJobOperationStatusesClient)` to `(*PipelineJobOperationStatusesClient, error)` +- Function `NewOperationResultsClient` return value(s) have been changed from `(*OperationResultsClient)` to `(*OperationResultsClient, error)` +- Function `NewEdgeModulesClient` return value(s) have been changed from `(*EdgeModulesClient)` to `(*EdgeModulesClient, error)` +- Function `NewLocationsClient` return value(s) have been changed from `(*LocationsClient)` to `(*LocationsClient, error)` +- Function `*PipelineTopologiesClient.List` return value(s) have been changed from `(*PipelineTopologiesClientListPager)` to `(*runtime.Pager[PipelineTopologiesClientListResponse])` +- Function `NewPrivateLinkResourcesClient` return value(s) have been changed from `(*PrivateLinkResourcesClient)` to `(*PrivateLinkResourcesClient, error)` +- Function `NewAccessPoliciesClient` return value(s) have been changed from `(*AccessPoliciesClient)` to `(*AccessPoliciesClient, error)` +- Function `NewPipelineTopologiesClient` return value(s) have been changed from `(*PipelineTopologiesClient)` to `(*PipelineTopologiesClient, error)` +- Function `NewVideoAnalyzersClient` return value(s) have been changed from `(*VideoAnalyzersClient)` to `(*VideoAnalyzersClient, error)` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `NewLivePipelineOperationStatusesClient` return value(s) have been changed from `(*LivePipelineOperationStatusesClient)` to `(*LivePipelineOperationStatusesClient, error)` +- Function `*VideoAnalyzersClient.BeginCreateOrUpdate` return value(s) have been changed from `(VideoAnalyzersClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[VideoAnalyzersClientCreateOrUpdateResponse], error)` +- Function `NewPrivateEndpointConnectionsClient` return value(s) have been changed from `(*PrivateEndpointConnectionsClient)` to `(*PrivateEndpointConnectionsClient, error)` +- Function `NewPrivateEndpointConnectionsOperationResultsClient` return value(s) have been changed from `(*PrivateEndpointConnectionsOperationResultsClient)` to `(*PrivateEndpointConnectionsOperationResultsClient, error)` +- Function `*PipelineJobsClient.BeginCancel` return value(s) have been changed from `(PipelineJobsClientCancelPollerResponse, error)` to `(*armruntime.Poller[PipelineJobsClientCancelResponse], error)` +- Function `*VideoAnalyzersClient.BeginUpdate` return value(s) have been changed from `(VideoAnalyzersClientUpdatePollerResponse, error)` to `(*armruntime.Poller[VideoAnalyzersClientUpdateResponse], error)` +- Function `*EdgeModulesClient.List` return value(s) have been changed from `(*EdgeModulesClientListPager)` to `(*runtime.Pager[EdgeModulesClientListResponse])` +- Function `*LivePipelinesClient.List` return value(s) have been changed from `(*LivePipelinesClientListPager)` to `(*runtime.Pager[LivePipelinesClientListResponse])` +- Function `NewPipelineJobsClient` return value(s) have been changed from `(*PipelineJobsClient)` to `(*PipelineJobsClient, error)` +- Function `NewVideosClient` return value(s) have been changed from `(*VideosClient)` to `(*VideosClient, error)` +- Function `*LivePipelinesClient.BeginDeactivate` return value(s) have been changed from `(LivePipelinesClientDeactivatePollerResponse, error)` to `(*armruntime.Poller[LivePipelinesClientDeactivateResponse], error)` +- Function `*LivePipelinesClient.BeginActivate` return value(s) have been changed from `(LivePipelinesClientActivatePollerResponse, error)` to `(*armruntime.Poller[LivePipelinesClientActivateResponse], error)` +- Function `*PipelineJobsClient.List` return value(s) have been changed from `(*PipelineJobsClientListPager)` to `(*runtime.Pager[PipelineJobsClientListResponse])` +- Function `NewOperationStatusesClient` return value(s) have been changed from `(*OperationStatusesClient)` to `(*OperationStatusesClient, error)` +- Function `NewPrivateEndpointConnectionsOperationStatusesClient` return value(s) have been changed from `(*PrivateEndpointConnectionsOperationStatusesClient)` to `(*PrivateEndpointConnectionsOperationStatusesClient, error)` +- Function `*AccessPoliciesClient.List` return value(s) have been changed from `(*AccessPoliciesClientListPager)` to `(*runtime.Pager[AccessPoliciesClientListResponse])` +- Function `*VideosClient.List` return value(s) have been changed from `(*VideosClientListPager)` to `(*runtime.Pager[VideosClientListResponse])` +- Function `NewLivePipelinesClient` return value(s) have been changed from `(*LivePipelinesClient)` to `(*LivePipelinesClient, error)` +- Function `*PipelineTopologiesClientListPager.PageResponse` has been removed +- Function `AccessPolicyEccAlgo.ToPtr` has been removed +- Function `*LivePipelinesClientListPager.NextPage` has been removed +- Function `*LivePipelinesClientDeactivatePoller.Done` has been removed +- Function `*PipelineJobsClientCancelPoller.FinalResponse` has been removed +- Function `*PipelineTopologiesClientListPager.Err` has been removed +- Function `PipelineJobState.ToPtr` has been removed +- Function `*PipelineJobsClientCancelPoller.Poll` has been removed +- Function `SKUName.ToPtr` has been removed +- Function `*PipelineJobsClientCancelPoller.Done` has been removed +- Function `*VideoAnalyzersClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*VideosClientListPager.PageResponse` has been removed +- Function `RtspTransport.ToPtr` has been removed +- Function `*LivePipelinesClientDeactivatePoller.FinalResponse` has been removed +- Function `AccessPolicyRsaAlgo.ToPtr` has been removed +- Function `*LivePipelinesClientDeactivatePoller.Poll` has been removed +- Function `*LivePipelinesClientListPager.PageResponse` has been removed +- Function `VideoAnalyzersClientUpdatePollerResponse.PollUntilDone` has been removed +- Function `LivePipelineState.ToPtr` has been removed +- Function `VideoAnalyzerEndpointType.ToPtr` has been removed +- Function `*PipelineJobsClientCancelPollerResponse.Resume` has been removed +- Function `*PipelineJobsClientListPager.PageResponse` has been removed +- Function `*VideoAnalyzersClientUpdatePoller.Done` has been removed +- Function `*VideoAnalyzersClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `PipelineJobsClientCancelPollerResponse.PollUntilDone` has been removed +- Function `LivePipelinesClientDeactivatePollerResponse.PollUntilDone` has been removed +- Function `*LivePipelinesClientListPager.Err` has been removed +- Function `PrivateEndpointConnectionProvisioningState.ToPtr` has been removed +- Function `*VideoAnalyzersClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*EdgeModulesClientListPager.Err` has been removed +- Function `CreatedByType.ToPtr` has been removed +- Function `ProvisioningState.ToPtr` has been removed +- Function `ParameterType.ToPtr` has been removed +- Function `*PipelineTopologiesClientListPager.NextPage` has been removed +- Function `ActionType.ToPtr` has been removed +- Function `VideoScaleMode.ToPtr` has been removed +- Function `*VideoAnalyzersClientUpdatePollerResponse.Resume` has been removed +- Function `VideoAnalyzersClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `SKUTier.ToPtr` has been removed +- Function `*VideoAnalyzersClientUpdatePoller.FinalResponse` has been removed +- Function `*AccessPoliciesClientListPager.Err` has been removed +- Function `*LivePipelinesClientActivatePoller.ResumeToken` has been removed +- Function `MetricAggregationType.ToPtr` has been removed +- Function `*LivePipelinesClientActivatePoller.Poll` has been removed +- Function `*VideoAnalyzersClientUpdatePoller.ResumeToken` has been removed +- Function `AccountEncryptionKeyType.ToPtr` has been removed +- Function `*PipelineJobsClientListPager.NextPage` has been removed +- Function `*LivePipelinesClientDeactivatePollerResponse.Resume` has been removed +- Function `*VideoAnalyzersClientCreateOrUpdatePoller.Poll` has been removed +- Function `*PipelineJobsClientCancelPoller.ResumeToken` has been removed +- Function `PublicNetworkAccess.ToPtr` has been removed +- Function `*AccessPoliciesClientListPager.NextPage` has been removed +- Function `*LivePipelinesClientActivatePollerResponse.Resume` has been removed +- Function `*EdgeModulesClientListPager.NextPage` has been removed +- Function `Kind.ToPtr` has been removed +- Function `PrivateEndpointServiceConnectionStatus.ToPtr` has been removed +- Function `*LivePipelinesClientDeactivatePoller.ResumeToken` has been removed +- Function `LivePipelinesClientActivatePollerResponse.PollUntilDone` has been removed +- Function `MetricUnit.ToPtr` has been removed +- Function `*PipelineJobsClientListPager.Err` has been removed +- Function `*VideoAnalyzersClientCreateOrUpdatePoller.Done` has been removed +- Function `AccessPolicyRole.ToPtr` has been removed +- Function `*LivePipelinesClientActivatePoller.Done` has been removed +- Function `VideoType.ToPtr` has been removed +- Function `*AccessPoliciesClientListPager.PageResponse` has been removed +- Function `*VideosClientListPager.Err` has been removed +- Function `*VideosClientListPager.NextPage` has been removed +- Function `EncoderSystemPresetType.ToPtr` has been removed +- Function `*VideoAnalyzersClientUpdatePoller.Poll` has been removed +- Function `*EdgeModulesClientListPager.PageResponse` has been removed +- Function `*LivePipelinesClientActivatePoller.FinalResponse` has been removed +- Function `CheckNameAvailabilityReason.ToPtr` has been removed +- Struct `AccessPoliciesClientCreateOrUpdateResult` has been removed +- Struct `AccessPoliciesClientGetResult` has been removed +- Struct `AccessPoliciesClientListPager` has been removed +- Struct `AccessPoliciesClientListResult` has been removed +- Struct `AccessPoliciesClientUpdateResult` has been removed +- Struct `EdgeModulesClientCreateOrUpdateResult` has been removed +- Struct `EdgeModulesClientGetResult` has been removed +- Struct `EdgeModulesClientListPager` has been removed +- Struct `EdgeModulesClientListProvisioningTokenResult` has been removed +- Struct `EdgeModulesClientListResult` has been removed +- Struct `LivePipelineOperationStatusesClientGetResult` has been removed +- Struct `LivePipelinesClientActivatePoller` has been removed +- Struct `LivePipelinesClientActivatePollerResponse` has been removed +- Struct `LivePipelinesClientCreateOrUpdateResult` has been removed +- Struct `LivePipelinesClientDeactivatePoller` has been removed +- Struct `LivePipelinesClientDeactivatePollerResponse` has been removed +- Struct `LivePipelinesClientGetResult` has been removed +- Struct `LivePipelinesClientListPager` has been removed +- Struct `LivePipelinesClientListResult` has been removed +- Struct `LivePipelinesClientUpdateResult` has been removed +- Struct `LocationsClientCheckNameAvailabilityResult` has been removed +- Struct `OperationResultsClientGetResult` has been removed +- Struct `OperationStatusesClientGetResult` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `PipelineJobOperationStatusesClientGetResult` has been removed +- Struct `PipelineJobsClientCancelPoller` has been removed +- Struct `PipelineJobsClientCancelPollerResponse` has been removed +- Struct `PipelineJobsClientCreateOrUpdateResult` has been removed +- Struct `PipelineJobsClientGetResult` has been removed +- Struct `PipelineJobsClientListPager` has been removed +- Struct `PipelineJobsClientListResult` has been removed +- Struct `PipelineJobsClientUpdateResult` has been removed +- Struct `PipelineTopologiesClientCreateOrUpdateResult` has been removed +- Struct `PipelineTopologiesClientGetResult` has been removed +- Struct `PipelineTopologiesClientListPager` has been removed +- Struct `PipelineTopologiesClientListResult` has been removed +- Struct `PipelineTopologiesClientUpdateResult` has been removed +- Struct `PrivateEndpointConnectionsClientCreateOrUpdateResult` has been removed +- Struct `PrivateEndpointConnectionsClientGetResult` has been removed +- Struct `PrivateEndpointConnectionsClientListResult` has been removed +- Struct `PrivateEndpointConnectionsOperationResultsClientGetResult` has been removed +- Struct `PrivateEndpointConnectionsOperationStatusesClientGetResult` has been removed +- Struct `PrivateLinkResourcesClientGetResult` has been removed +- Struct `PrivateLinkResourcesClientListResult` has been removed +- Struct `VideoAnalyzersClientCreateOrUpdatePoller` has been removed +- Struct `VideoAnalyzersClientCreateOrUpdatePollerResponse` has been removed +- Struct `VideoAnalyzersClientCreateOrUpdateResult` has been removed +- Struct `VideoAnalyzersClientGetResult` has been removed +- Struct `VideoAnalyzersClientListBySubscriptionResult` has been removed +- Struct `VideoAnalyzersClientListResult` has been removed +- Struct `VideoAnalyzersClientUpdatePoller` has been removed +- Struct `VideoAnalyzersClientUpdatePollerResponse` has been removed +- Struct `VideoAnalyzersClientUpdateResult` has been removed +- Struct `VideosClientCreateOrUpdateResult` has been removed +- Struct `VideosClientGetResult` has been removed +- Struct `VideosClientListContentTokenResult` has been removed +- Struct `VideosClientListPager` has been removed +- Struct `VideosClientListResult` has been removed +- Struct `VideosClientUpdateResult` has been removed +- Field `PipelineTopologiesClientGetResult` of struct `PipelineTopologiesClientGetResponse` has been removed +- Field `RawResponse` of struct `PipelineTopologiesClientGetResponse` has been removed +- Field `PipelineJobOperationStatusesClientGetResult` of struct `PipelineJobOperationStatusesClientGetResponse` has been removed +- Field `RawResponse` of struct `PipelineJobOperationStatusesClientGetResponse` has been removed +- Field `PipelineTopologiesClientListResult` of struct `PipelineTopologiesClientListResponse` has been removed +- Field `RawResponse` of struct `PipelineTopologiesClientListResponse` has been removed +- Field `LivePipelineOperationStatusesClientGetResult` of struct `LivePipelineOperationStatusesClientGetResponse` has been removed +- Field `RawResponse` of struct `LivePipelineOperationStatusesClientGetResponse` has been removed +- Field `RawResponse` of struct `LivePipelinesClientDeactivateResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientDeleteResponse` has been removed +- Field `PrivateLinkResourcesClientGetResult` of struct `PrivateLinkResourcesClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateLinkResourcesClientGetResponse` has been removed +- Field `LivePipelinesClientUpdateResult` of struct `LivePipelinesClientUpdateResponse` has been removed +- Field `RawResponse` of struct `LivePipelinesClientUpdateResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `PrivateLinkResourcesClientListResult` of struct `PrivateLinkResourcesClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateLinkResourcesClientListResponse` has been removed +- Field `PipelineTopologiesClientCreateOrUpdateResult` of struct `PipelineTopologiesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `PipelineTopologiesClientCreateOrUpdateResponse` has been removed +- Field `AccessPoliciesClientCreateOrUpdateResult` of struct `AccessPoliciesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `AccessPoliciesClientCreateOrUpdateResponse` has been removed +- Field `PrivateEndpointConnectionsOperationResultsClientGetResult` of struct `PrivateEndpointConnectionsOperationResultsClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsOperationResultsClientGetResponse` has been removed +- Field `VideosClientListResult` of struct `VideosClientListResponse` has been removed +- Field `RawResponse` of struct `VideosClientListResponse` has been removed +- Field `RawResponse` of struct `VideoAnalyzersClientDeleteResponse` has been removed +- Field `EdgeModulesClientCreateOrUpdateResult` of struct `EdgeModulesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `EdgeModulesClientCreateOrUpdateResponse` has been removed +- Field `VideoAnalyzersClientUpdateResult` of struct `VideoAnalyzersClientUpdateResponse` has been removed +- Field `RawResponse` of struct `VideoAnalyzersClientUpdateResponse` has been removed +- Field `RawResponse` of struct `EdgeModulesClientDeleteResponse` has been removed +- Field `OperationResultsClientGetResult` of struct `OperationResultsClientGetResponse` has been removed +- Field `RawResponse` of struct `OperationResultsClientGetResponse` has been removed +- Field `RawResponse` of struct `VideosClientDeleteResponse` has been removed +- Field `VideoAnalyzersClientListBySubscriptionResult` of struct `VideoAnalyzersClientListBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `VideoAnalyzersClientListBySubscriptionResponse` has been removed +- Field `VideoAnalyzersClientCreateOrUpdateResult` of struct `VideoAnalyzersClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `VideoAnalyzersClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `PipelineJobsClientCancelResponse` has been removed +- Field `LivePipelinesClientGetResult` of struct `LivePipelinesClientGetResponse` has been removed +- Field `RawResponse` of struct `LivePipelinesClientGetResponse` has been removed +- Field `VideoAnalyzersClientGetResult` of struct `VideoAnalyzersClientGetResponse` has been removed +- Field `RawResponse` of struct `VideoAnalyzersClientGetResponse` has been removed +- Field `VideoAnalyzersClientListResult` of struct `VideoAnalyzersClientListResponse` has been removed +- Field `RawResponse` of struct `VideoAnalyzersClientListResponse` has been removed +- Field `RawResponse` of struct `LivePipelinesClientDeleteResponse` has been removed +- Field `AccessPoliciesClientUpdateResult` of struct `AccessPoliciesClientUpdateResponse` has been removed +- Field `RawResponse` of struct `AccessPoliciesClientUpdateResponse` has been removed +- Field `PipelineJobsClientUpdateResult` of struct `PipelineJobsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `PipelineJobsClientUpdateResponse` has been removed +- Field `EdgeModulesClientListProvisioningTokenResult` of struct `EdgeModulesClientListProvisioningTokenResponse` has been removed +- Field `RawResponse` of struct `EdgeModulesClientListProvisioningTokenResponse` has been removed +- Field `EdgeModulesClientGetResult` of struct `EdgeModulesClientGetResponse` has been removed +- Field `RawResponse` of struct `EdgeModulesClientGetResponse` has been removed +- Field `PrivateEndpointConnectionsOperationStatusesClientGetResult` of struct `PrivateEndpointConnectionsOperationStatusesClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsOperationStatusesClientGetResponse` has been removed +- Field `PrivateEndpointConnectionsClientGetResult` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `PipelineTopologiesClientUpdateResult` of struct `PipelineTopologiesClientUpdateResponse` has been removed +- Field `RawResponse` of struct `PipelineTopologiesClientUpdateResponse` has been removed +- Field `RawResponse` of struct `AccessPoliciesClientDeleteResponse` has been removed +- Field `AccessPoliciesClientGetResult` of struct `AccessPoliciesClientGetResponse` has been removed +- Field `RawResponse` of struct `AccessPoliciesClientGetResponse` has been removed +- Field `LivePipelinesClientCreateOrUpdateResult` of struct `LivePipelinesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `LivePipelinesClientCreateOrUpdateResponse` has been removed +- Field `VideosClientListContentTokenResult` of struct `VideosClientListContentTokenResponse` has been removed +- Field `RawResponse` of struct `VideosClientListContentTokenResponse` has been removed +- Field `OperationStatusesClientGetResult` of struct `OperationStatusesClientGetResponse` has been removed +- Field `RawResponse` of struct `OperationStatusesClientGetResponse` has been removed +- Field `VideosClientCreateOrUpdateResult` of struct `VideosClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `VideosClientCreateOrUpdateResponse` has been removed +- Field `PrivateEndpointConnectionsClientListResult` of struct `PrivateEndpointConnectionsClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientListResponse` has been removed +- Field `RawResponse` of struct `PipelineJobsClientDeleteResponse` has been removed +- Field `PipelineJobsClientGetResult` of struct `PipelineJobsClientGetResponse` has been removed +- Field `RawResponse` of struct `PipelineJobsClientGetResponse` has been removed +- Field `VideosClientUpdateResult` of struct `VideosClientUpdateResponse` has been removed +- Field `RawResponse` of struct `VideosClientUpdateResponse` has been removed +- Field `RawResponse` of struct `LivePipelinesClientActivateResponse` has been removed +- Field `LivePipelinesClientListResult` of struct `LivePipelinesClientListResponse` has been removed +- Field `RawResponse` of struct `LivePipelinesClientListResponse` has been removed +- Field `LocationsClientCheckNameAvailabilityResult` of struct `LocationsClientCheckNameAvailabilityResponse` has been removed +- Field `RawResponse` of struct `LocationsClientCheckNameAvailabilityResponse` has been removed +- Field `AccessPoliciesClientListResult` of struct `AccessPoliciesClientListResponse` has been removed +- Field `RawResponse` of struct `AccessPoliciesClientListResponse` has been removed +- Field `RawResponse` of struct `PipelineTopologiesClientDeleteResponse` has been removed +- Field `PipelineJobsClientListResult` of struct `PipelineJobsClientListResponse` has been removed +- Field `RawResponse` of struct `PipelineJobsClientListResponse` has been removed +- Field `EdgeModulesClientListResult` of struct `EdgeModulesClientListResponse` has been removed +- Field `RawResponse` of struct `EdgeModulesClientListResponse` has been removed +- Field `PrivateEndpointConnectionsClientCreateOrUpdateResult` of struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` has been removed +- Field `PipelineJobsClientCreateOrUpdateResult` of struct `PipelineJobsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `PipelineJobsClientCreateOrUpdateResponse` has been removed +- Field `VideosClientGetResult` of struct `VideosClientGetResponse` has been removed +- Field `RawResponse` of struct `VideosClientGetResponse` has been removed + +### Features Added + +- New struct `ErrorResponse` +- New anonymous field `Collection` in struct `VideoAnalyzersClientListResponse` +- New anonymous field `CheckNameAvailabilityResponse` in struct `LocationsClientCheckNameAvailabilityResponse` +- New anonymous field `PipelineTopology` in struct `PipelineTopologiesClientGetResponse` +- New anonymous field `PrivateLinkResourceListResult` in struct `PrivateLinkResourcesClientListResponse` +- New anonymous field `OperationCollection` in struct `OperationsClientListResponse` +- New field `ResumeToken` in struct `LivePipelinesClientBeginDeactivateOptions` +- New anonymous field `VideoAnalyzer` in struct `VideoAnalyzersClientGetResponse` +- New anonymous field `EdgeModuleEntity` in struct `EdgeModulesClientGetResponse` +- New anonymous field `EdgeModuleEntityCollection` in struct `EdgeModulesClientListResponse` +- New anonymous field `PipelineJob` in struct `PipelineJobsClientUpdateResponse` +- New anonymous field `AccessPolicyEntity` in struct `AccessPoliciesClientUpdateResponse` +- New anonymous field `LivePipeline` in struct `LivePipelinesClientUpdateResponse` +- New anonymous field `VideoContentToken` in struct `VideosClientListContentTokenResponse` +- New anonymous field `EdgeModuleEntity` in struct `EdgeModulesClientCreateOrUpdateResponse` +- New anonymous field `LivePipelineCollection` in struct `LivePipelinesClientListResponse` +- New anonymous field `LivePipelineOperationStatus` in struct `LivePipelineOperationStatusesClientGetResponse` +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` +- New field `RetryAfter` in struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` +- New field `AzureAsyncOperation` in struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` +- New field `Location` in struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` +- New anonymous field `PipelineJob` in struct `PipelineJobsClientCreateOrUpdateResponse` +- New anonymous field `VideoEntityCollection` in struct `VideosClientListResponse` +- New anonymous field `VideoEntity` in struct `VideosClientCreateOrUpdateResponse` +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsOperationResultsClientGetResponse` +- New anonymous field `EdgeModuleProvisioningToken` in struct `EdgeModulesClientListProvisioningTokenResponse` +- New anonymous field `PipelineTopology` in struct `PipelineTopologiesClientUpdateResponse` +- New anonymous field `VideoAnalyzer` in struct `VideoAnalyzersClientUpdateResponse` +- New anonymous field `PipelineTopology` in struct `PipelineTopologiesClientCreateOrUpdateResponse` +- New anonymous field `PipelineJob` in struct `PipelineJobsClientGetResponse` +- New anonymous field `PrivateLinkResource` in struct `PrivateLinkResourcesClientGetResponse` +- New anonymous field `LivePipeline` in struct `LivePipelinesClientCreateOrUpdateResponse` +- New field `ResumeToken` in struct `LivePipelinesClientBeginActivateOptions` +- New anonymous field `PipelineJobCollection` in struct `PipelineJobsClientListResponse` +- New field `ResumeToken` in struct `VideoAnalyzersClientBeginUpdateOptions` +- New anonymous field `PrivateEndpointConnectionOperationStatus` in struct `PrivateEndpointConnectionsOperationStatusesClientGetResponse` +- New field `ResumeToken` in struct `PipelineJobsClientBeginCancelOptions` +- New anonymous field `LivePipeline` in struct `LivePipelinesClientGetResponse` +- New anonymous field `PrivateEndpointConnectionListResult` in struct `PrivateEndpointConnectionsClientListResponse` +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsClientGetResponse` +- New anonymous field `AccessPolicyEntityCollection` in struct `AccessPoliciesClientListResponse` +- New anonymous field `AccessPolicyEntity` in struct `AccessPoliciesClientGetResponse` +- New anonymous field `VideoAnalyzer` in struct `VideoAnalyzersClientCreateOrUpdateResponse` +- New anonymous field `PipelineJobOperationStatus` in struct `PipelineJobOperationStatusesClientGetResponse` +- New anonymous field `VideoEntity` in struct `VideosClientGetResponse` +- New field `ResumeToken` in struct `VideoAnalyzersClientBeginCreateOrUpdateOptions` +- New anonymous field `Collection` in struct `VideoAnalyzersClientListBySubscriptionResponse` +- New anonymous field `OperationStatus` in struct `OperationStatusesClientGetResponse` +- New anonymous field `VideoEntity` in struct `VideosClientUpdateResponse` +- New anonymous field `VideoAnalyzer` in struct `OperationResultsClientGetResponse` +- New anonymous field `AccessPolicyEntity` in struct `AccessPoliciesClientCreateOrUpdateResponse` +- New anonymous field `PipelineTopologyCollection` in struct `PipelineTopologiesClientListResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/README.md b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/README.md index e3242e1afd8b..8861ac2336d0 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/README.md +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/README.md @@ -11,7 +11,7 @@ The `armvideoanalyzer` module provides operations for working with Azure Video A ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Video Analyzer modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -client := armvideoanalyzer.NewVideoAnalyzersClient(, cred, nil) +client, err := armvideoanalyzer.NewVideoAnalyzersClient(, cred, nil) ``` You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armvideoanalyzer.NewVideoAnalyzersClient(, cred, &options) +client, err := armvideoanalyzer.NewVideoAnalyzersClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/autorest.md b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/autorest.md index 1c3a59f1aa71..8e13b404291b 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/autorest.md +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/cf47fa91b882618a1043e3aeb5803b3a7397cd08/specification/videoanalyzer/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/cf47fa91b882618a1043e3aeb5803b3a7397cd08/specification/videoanalyzer/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/videoanalyzer/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/videoanalyzer/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/go.mod b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/go.mod index f83a7f3eb077..0b04d4fb219c 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/go.mod +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/go.sum b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/go.sum +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_accesspolicies_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_accesspolicies_client_test.go index 903a58e70092..af2885ab2881 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_accesspolicies_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_accesspolicies_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,58 +17,74 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/access-policy-list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/access-policy-list.json func ExampleAccessPoliciesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewAccessPoliciesClient("", cred, nil) + client, err := armvideoanalyzer.NewAccessPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", - &armvideoanalyzer.AccessPoliciesClientListOptions{Top: to.Int32Ptr(2)}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + &armvideoanalyzer.AccessPoliciesClientListOptions{Top: to.Ptr[int32](2)}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/access-policy-get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/access-policy-get.json func ExampleAccessPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewAccessPoliciesClient("", cred, nil) + client, err := armvideoanalyzer.NewAccessPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccessPoliciesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/access-policy-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/access-policy-create.json func ExampleAccessPoliciesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewAccessPoliciesClient("", cred, nil) + client, err := armvideoanalyzer.NewAccessPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", @@ -76,72 +92,85 @@ func ExampleAccessPoliciesClient_CreateOrUpdate() { armvideoanalyzer.AccessPolicyEntity{ Properties: &armvideoanalyzer.AccessPolicyProperties{ Authentication: &armvideoanalyzer.JwtAuthentication{ - Type: to.StringPtr(""), + Type: to.Ptr(""), Audiences: []*string{ - to.StringPtr("audience1")}, + to.Ptr("audience1")}, Claims: []*armvideoanalyzer.TokenClaim{ { - Name: to.StringPtr(""), - Value: to.StringPtr(""), + Name: to.Ptr(""), + Value: to.Ptr(""), }, { - Name: to.StringPtr(""), - Value: to.StringPtr(""), + Name: to.Ptr(""), + Value: to.Ptr(""), }}, Issuers: []*string{ - to.StringPtr("issuer1"), - to.StringPtr("issuer2")}, + to.Ptr("issuer1"), + to.Ptr("issuer2")}, Keys: []armvideoanalyzer.TokenKeyClassification{ &armvideoanalyzer.RsaTokenKey{ - Type: to.StringPtr(""), - Kid: to.StringPtr(""), - Alg: armvideoanalyzer.AccessPolicyRsaAlgo("RS256").ToPtr(), - E: to.StringPtr(""), - N: to.StringPtr(""), + Type: to.Ptr(""), + Kid: to.Ptr(""), + Alg: to.Ptr(armvideoanalyzer.AccessPolicyRsaAlgoRS256), + E: to.Ptr(""), + N: to.Ptr(""), }, &armvideoanalyzer.EccTokenKey{ - Type: to.StringPtr(""), - Kid: to.StringPtr(""), - Alg: armvideoanalyzer.AccessPolicyEccAlgo("ES256").ToPtr(), - X: to.StringPtr(""), - Y: to.StringPtr(""), + Type: to.Ptr(""), + Kid: to.Ptr(""), + Alg: to.Ptr(armvideoanalyzer.AccessPolicyEccAlgoES256), + X: to.Ptr(""), + Y: to.Ptr(""), }}, }, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccessPoliciesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/access-policy-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/access-policy-delete.json func ExampleAccessPoliciesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewAccessPoliciesClient("", cred, nil) + client, err := armvideoanalyzer.NewAccessPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/access-policy-patch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/access-policy-patch.json func ExampleAccessPoliciesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewAccessPoliciesClient("", cred, nil) + client, err := armvideoanalyzer.NewAccessPoliciesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", @@ -149,42 +178,44 @@ func ExampleAccessPoliciesClient_Update() { armvideoanalyzer.AccessPolicyEntity{ Properties: &armvideoanalyzer.AccessPolicyProperties{ Authentication: &armvideoanalyzer.JwtAuthentication{ - Type: to.StringPtr(""), + Type: to.Ptr(""), Audiences: []*string{ - to.StringPtr("audience1")}, + to.Ptr("audience1")}, Claims: []*armvideoanalyzer.TokenClaim{ { - Name: to.StringPtr(""), - Value: to.StringPtr(""), + Name: to.Ptr(""), + Value: to.Ptr(""), }, { - Name: to.StringPtr(""), - Value: to.StringPtr(""), + Name: to.Ptr(""), + Value: to.Ptr(""), }}, Issuers: []*string{ - to.StringPtr("issuer1"), - to.StringPtr("issuer2")}, + to.Ptr("issuer1"), + to.Ptr("issuer2")}, Keys: []armvideoanalyzer.TokenKeyClassification{ &armvideoanalyzer.RsaTokenKey{ - Type: to.StringPtr(""), - Kid: to.StringPtr(""), - Alg: armvideoanalyzer.AccessPolicyRsaAlgo("RS256").ToPtr(), - E: to.StringPtr(""), - N: to.StringPtr(""), + Type: to.Ptr(""), + Kid: to.Ptr(""), + Alg: to.Ptr(armvideoanalyzer.AccessPolicyRsaAlgoRS256), + E: to.Ptr(""), + N: to.Ptr(""), }, &armvideoanalyzer.EccTokenKey{ - Type: to.StringPtr(""), - Kid: to.StringPtr(""), - Alg: armvideoanalyzer.AccessPolicyEccAlgo("ES256").ToPtr(), - X: to.StringPtr(""), - Y: to.StringPtr(""), + Type: to.Ptr(""), + Kid: to.Ptr(""), + Alg: to.Ptr(armvideoanalyzer.AccessPolicyEccAlgoES256), + X: to.Ptr(""), + Y: to.Ptr(""), }}, }, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccessPoliciesClientUpdateResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_edgemodules_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_edgemodules_client_test.go index 092a80cd56d5..60b25c798434 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_edgemodules_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_edgemodules_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,58 +19,74 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/edge-modules-list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/edge-modules-list.json func ExampleEdgeModulesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewEdgeModulesClient("", cred, nil) + client, err := armvideoanalyzer.NewEdgeModulesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", &armvideoanalyzer.EdgeModulesClientListOptions{Top: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/edge-modules-get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/edge-modules-get.json func ExampleEdgeModulesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewEdgeModulesClient("", cred, nil) + client, err := armvideoanalyzer.NewEdgeModulesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.EdgeModulesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/edge-modules-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/edge-modules-create.json func ExampleEdgeModulesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewEdgeModulesClient("", cred, nil) + client, err := armvideoanalyzer.NewEdgeModulesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", @@ -78,47 +94,62 @@ func ExampleEdgeModulesClient_CreateOrUpdate() { armvideoanalyzer.EdgeModuleEntity{}, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.EdgeModulesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/edge-modules-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/edge-modules-delete.json func ExampleEdgeModulesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewEdgeModulesClient("", cred, nil) + client, err := armvideoanalyzer.NewEdgeModulesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/edge-modules-listProvisioningToken.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/edge-modules-listProvisioningToken.json func ExampleEdgeModulesClient_ListProvisioningToken() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewEdgeModulesClient("", cred, nil) + client, err := armvideoanalyzer.NewEdgeModulesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListProvisioningToken(ctx, "", "", "", armvideoanalyzer.ListProvisioningTokenInput{ - ExpirationDate: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-23T11:04:49.0526841-08:00"); return t }()), + ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-23T11:04:49.0526841-08:00"); return t }()), }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.EdgeModulesClientListProvisioningTokenResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_livepipelineoperationstatuses_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_livepipelineoperationstatuses_client_test.go index d42c23622d26..3d24ea5f46ac 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_livepipelineoperationstatuses_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_livepipelineoperationstatuses_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,14 +16,19 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-operation-status-get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-operation-status-get.json func ExampleLivePipelineOperationStatusesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewLivePipelineOperationStatusesClient("", cred, nil) + client, err := armvideoanalyzer.NewLivePipelineOperationStatusesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", @@ -31,7 +36,9 @@ func ExampleLivePipelineOperationStatusesClient_Get() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.LivePipelineOperationStatusesClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_livepipelines_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_livepipelines_client_test.go index e5102a54082f..cf8abf529910 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_livepipelines_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_livepipelines_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,165 +19,210 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-list.json func ExampleLivePipelinesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + client, err := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", &armvideoanalyzer.LivePipelinesClientListOptions{Filter: nil, - Top: to.Int32Ptr(2), + Top: to.Ptr[int32](2), }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-get-by-name.json func ExampleLivePipelinesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + client, err := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.LivePipelinesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-create.json func ExampleLivePipelinesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + client, err := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", "", armvideoanalyzer.LivePipeline{ Properties: &armvideoanalyzer.LivePipelineProperties{ - Description: to.StringPtr(""), - BitrateKbps: to.Int32Ptr(500), + Description: to.Ptr(""), + BitrateKbps: to.Ptr[int32](500), Parameters: []*armvideoanalyzer.ParameterDefinition{ { - Name: to.StringPtr(""), - Value: to.StringPtr(""), + Name: to.Ptr(""), + Value: to.Ptr(""), }}, - TopologyName: to.StringPtr(""), + TopologyName: to.Ptr(""), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.LivePipelinesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-delete.json func ExampleLivePipelinesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + client, err := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-patch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-patch.json func ExampleLivePipelinesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + client, err := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", "", armvideoanalyzer.LivePipelineUpdate{ Properties: &armvideoanalyzer.LivePipelinePropertiesUpdate{ - Description: to.StringPtr(""), + Description: to.Ptr(""), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.LivePipelinesClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-activate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-activate.json func ExampleLivePipelinesClient_BeginActivate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + client, err := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginActivate(ctx, "", "", "", - nil) + &armvideoanalyzer.LivePipelinesClientBeginActivateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-deactivate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/live-pipeline-deactivate.json func ExampleLivePipelinesClient_BeginDeactivate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + client, err := armvideoanalyzer.NewLivePipelinesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDeactivate(ctx, "", "", "", - nil) + &armvideoanalyzer.LivePipelinesClientBeginDeactivateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_locations_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_locations_client_test.go index 63247160c54b..b8c4f48a9a02 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_locations_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_locations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,23 +17,30 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/accounts-check-name-availability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/accounts-check-name-availability.json func ExampleLocationsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewLocationsClient("", cred, nil) + client, err := armvideoanalyzer.NewLocationsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CheckNameAvailability(ctx, "", armvideoanalyzer.CheckNameAvailabilityRequest{ - Name: to.StringPtr(""), - Type: to.StringPtr(""), + Name: to.Ptr(""), + Type: to.Ptr(""), }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.LocationsClientCheckNameAvailabilityResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_operations_client_test.go index fcd4f2315f54..d858c1516b28 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_operations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,18 +16,25 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/operations-list-all.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/operations-list-all.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewOperationsClient(cred, nil) + client, err := armvideoanalyzer.NewOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.OperationsClientListResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_pipelinejoboperationstatuses_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_pipelinejoboperationstatuses_client_test.go index ba1eacc4817a..c53a0bf5496a 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_pipelinejoboperationstatuses_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_pipelinejoboperationstatuses_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,14 +16,19 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-operation-status-get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-operation-status-get.json func ExamplePipelineJobOperationStatusesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPipelineJobOperationStatusesClient("", cred, nil) + client, err := armvideoanalyzer.NewPipelineJobOperationStatusesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", @@ -31,7 +36,9 @@ func ExamplePipelineJobOperationStatusesClient_Get() { "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PipelineJobOperationStatusesClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_pipelinejobs_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_pipelinejobs_client_test.go index cdf927c42649..48006af9715f 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_pipelinejobs_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_pipelinejobs_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,146 +19,184 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-list.json func ExamplePipelineJobsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPipelineJobsClient("", cred, nil) + client, err := armvideoanalyzer.NewPipelineJobsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", &armvideoanalyzer.PipelineJobsClientListOptions{Filter: nil, - Top: to.Int32Ptr(2), + Top: to.Ptr[int32](2), }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-get-by-name.json func ExamplePipelineJobsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPipelineJobsClient("", cred, nil) + client, err := armvideoanalyzer.NewPipelineJobsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PipelineJobsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-create.json func ExamplePipelineJobsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPipelineJobsClient("", cred, nil) + client, err := armvideoanalyzer.NewPipelineJobsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", "", armvideoanalyzer.PipelineJob{ Properties: &armvideoanalyzer.PipelineJobProperties{ - Description: to.StringPtr(""), + Description: to.Ptr(""), Parameters: []*armvideoanalyzer.ParameterDefinition{ { - Name: to.StringPtr(""), - Value: to.StringPtr(""), + Name: to.Ptr(""), + Value: to.Ptr(""), }, { - Name: to.StringPtr(""), - Value: to.StringPtr(""), + Name: to.Ptr(""), + Value: to.Ptr(""), }}, - TopologyName: to.StringPtr(""), + TopologyName: to.Ptr(""), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PipelineJobsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-delete.json func ExamplePipelineJobsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPipelineJobsClient("", cred, nil) + client, err := armvideoanalyzer.NewPipelineJobsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-patch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-patch.json func ExamplePipelineJobsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPipelineJobsClient("", cred, nil) + client, err := armvideoanalyzer.NewPipelineJobsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "", "", "", armvideoanalyzer.PipelineJobUpdate{ Properties: &armvideoanalyzer.PipelineJobPropertiesUpdate{ - Description: to.StringPtr(""), + Description: to.Ptr(""), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PipelineJobsClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-cancel.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-job-cancel.json func ExamplePipelineJobsClient_BeginCancel() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPipelineJobsClient("", cred, nil) + client, err := armvideoanalyzer.NewPipelineJobsClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCancel(ctx, "", "", "", - nil) + &armvideoanalyzer.PipelineJobsClientBeginCancelOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_pipelinetopologies_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_pipelinetopologies_client_test.go index 518abd4cd058..dea41d6941c3 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_pipelinetopologies_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_pipelinetopologies_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,165 +17,196 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-topology-list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-topology-list.json func ExamplePipelineTopologiesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPipelineTopologiesClient("", cred, nil) + client, err := armvideoanalyzer.NewPipelineTopologiesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("", "", &armvideoanalyzer.PipelineTopologiesClientListOptions{Filter: nil, - Top: to.Int32Ptr(2), + Top: to.Ptr[int32](2), }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-topology-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-topology-get-by-name.json func ExamplePipelineTopologiesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPipelineTopologiesClient("", cred, nil) + client, err := armvideoanalyzer.NewPipelineTopologiesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "", "", "", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PipelineTopologiesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-topology-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-topology-create.json func ExamplePipelineTopologiesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPipelineTopologiesClient("", cred, nil) + client, err := armvideoanalyzer.NewPipelineTopologiesClient("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "", "", "", armvideoanalyzer.PipelineTopology{ - Kind: armvideoanalyzer.Kind("Live").ToPtr(), + Kind: to.Ptr(armvideoanalyzer.KindLive), Properties: &armvideoanalyzer.PipelineTopologyProperties{ - Description: to.StringPtr(""), + Description: to.Ptr(""), Parameters: []*armvideoanalyzer.ParameterDeclaration{ { - Name: to.StringPtr(""), - Type: armvideoanalyzer.ParameterType("String").ToPtr(), - Description: to.StringPtr(""), - Default: to.StringPtr(""), + Name: to.Ptr(""), + Type: to.Ptr(armvideoanalyzer.ParameterTypeString), + Description: to.Ptr(""), + Default: to.Ptr(""), }, { - Name: to.StringPtr(""), - Type: armvideoanalyzer.ParameterType("SecretString").ToPtr(), - Description: to.StringPtr(""), - Default: to.StringPtr(""), + Name: to.Ptr(""), + Type: to.Ptr(armvideoanalyzer.ParameterTypeSecretString), + Description: to.Ptr(""), + Default: to.Ptr(""), }}, Sinks: []armvideoanalyzer.SinkNodeBaseClassification{ &armvideoanalyzer.VideoSink{ - Name: to.StringPtr(""), - Type: to.StringPtr(""), + Name: to.Ptr(""), + Type: to.Ptr(""), Inputs: []*armvideoanalyzer.NodeInput{ { - NodeName: to.StringPtr(""), + NodeName: to.Ptr(""), }}, VideoCreationProperties: &armvideoanalyzer.VideoCreationProperties{ - Description: to.StringPtr(""), - SegmentLength: to.StringPtr(""), - Title: to.StringPtr(""), + Description: to.Ptr("<description>"), + SegmentLength: to.Ptr("<segment-length>"), + Title: to.Ptr("<title>"), }, - VideoName: to.StringPtr("<video-name>"), + VideoName: to.Ptr("<video-name>"), VideoPublishingOptions: &armvideoanalyzer.VideoPublishingOptions{ - DisableArchive: to.StringPtr("<disable-archive>"), - DisableRtspPublishing: to.StringPtr("<disable-rtsp-publishing>"), + DisableArchive: to.Ptr("<disable-archive>"), + DisableRtspPublishing: to.Ptr("<disable-rtsp-publishing>"), }, }}, Sources: []armvideoanalyzer.SourceNodeBaseClassification{ &armvideoanalyzer.RtspSource{ - Name: to.StringPtr("<name>"), - Type: to.StringPtr("<type>"), + Name: to.Ptr("<name>"), + Type: to.Ptr("<type>"), Endpoint: &armvideoanalyzer.UnsecuredEndpoint{ - Type: to.StringPtr("<type>"), + Type: to.Ptr("<type>"), Credentials: &armvideoanalyzer.UsernamePasswordCredentials{ - Type: to.StringPtr("<type>"), - Password: to.StringPtr("<password>"), - Username: to.StringPtr("<username>"), + Type: to.Ptr("<type>"), + Password: to.Ptr("<password>"), + Username: to.Ptr("<username>"), }, - URL: to.StringPtr("<url>"), + URL: to.Ptr("<url>"), }, - Transport: armvideoanalyzer.RtspTransport("Http").ToPtr(), + Transport: to.Ptr(armvideoanalyzer.RtspTransportHTTP), }}, }, SKU: &armvideoanalyzer.SKU{ - Name: armvideoanalyzer.SKUName("Live_S1").ToPtr(), + Name: to.Ptr(armvideoanalyzer.SKUNameLiveS1), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PipelineTopologiesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-topology-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-topology-delete.json func ExamplePipelineTopologiesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPipelineTopologiesClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewPipelineTopologiesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "<resource-group-name>", "<account-name>", "<pipeline-topology-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-topology-patch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/pipeline-topology-patch.json func ExamplePipelineTopologiesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPipelineTopologiesClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewPipelineTopologiesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "<resource-group-name>", "<account-name>", "<pipeline-topology-name>", armvideoanalyzer.PipelineTopologyUpdate{ Properties: &armvideoanalyzer.PipelineTopologyPropertiesUpdate{ - Description: to.StringPtr("<description>"), + Description: to.Ptr("<description>"), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PipelineTopologiesClientUpdateResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privateendpointconnections_client_test.go index 4241e96717f7..c8f1d69fa6b4 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privateendpointconnections_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privateendpointconnections_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,51 +17,70 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-endpoint-connection-list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-endpoint-connection-list.json func ExamplePrivateEndpointConnectionsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, "<resource-group-name>", "<account-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientListResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-endpoint-connection-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-endpoint-connection-get-by-name.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<account-name>", "<name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-endpoint-connection-put.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-endpoint-connection-put.json func ExamplePrivateEndpointConnectionsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.CreateOrUpdate(ctx, "<resource-group-name>", "<account-name>", @@ -69,31 +88,38 @@ func ExamplePrivateEndpointConnectionsClient_CreateOrUpdate() { armvideoanalyzer.PrivateEndpointConnection{ Properties: &armvideoanalyzer.PrivateEndpointConnectionProperties{ PrivateLinkServiceConnectionState: &armvideoanalyzer.PrivateLinkServiceConnectionState{ - Description: to.StringPtr("<description>"), - Status: armvideoanalyzer.PrivateEndpointServiceConnectionStatus("Approved").ToPtr(), + Description: to.Ptr("<description>"), + Status: to.Ptr(armvideoanalyzer.PrivateEndpointServiceConnectionStatusApproved), }, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-endpoint-connection-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-endpoint-connection-delete.json func ExamplePrivateEndpointConnectionsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "<resource-group-name>", "<account-name>", "<name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privateendpointconnectionsoperationresults_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privateendpointconnectionsoperationresults_client_test.go index 54e330577d66..df601f993a8a 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privateendpointconnectionsoperationresults_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privateendpointconnectionsoperationresults_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,14 +16,19 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-endpoint-connection-operation-result-by-id.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-endpoint-connection-operation-result-by-id.json func ExamplePrivateEndpointConnectionsOperationResultsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPrivateEndpointConnectionsOperationResultsClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewPrivateEndpointConnectionsOperationResultsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<account-name>", @@ -31,7 +36,9 @@ func ExamplePrivateEndpointConnectionsOperationResultsClient_Get() { "<operation-id>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsOperationResultsClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privateendpointconnectionsoperationstatuses_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privateendpointconnectionsoperationstatuses_client_test.go index 02c1f80270c0..1ae8be0ac51e 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privateendpointconnectionsoperationstatuses_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privateendpointconnectionsoperationstatuses_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,14 +16,19 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-endpoint-connection-operation-status-by-id-terminal-state.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-endpoint-connection-operation-status-by-id-terminal-state.json func ExamplePrivateEndpointConnectionsOperationStatusesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPrivateEndpointConnectionsOperationStatusesClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewPrivateEndpointConnectionsOperationStatusesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<account-name>", @@ -31,7 +36,9 @@ func ExamplePrivateEndpointConnectionsOperationStatusesClient_Get() { "<operation-id>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsOperationStatusesClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privatelinkresources_client_test.go index 001346344465..fb62bc9642f6 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privatelinkresources_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_privatelinkresources_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,39 +16,53 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-link-resources-list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-link-resources-list.json func ExamplePrivateLinkResourcesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPrivateLinkResourcesClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewPrivateLinkResourcesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, "<resource-group-name>", "<account-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateLinkResourcesClientListResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-link-resources-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-private-link-resources-get-by-name.json func ExamplePrivateLinkResourcesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewPrivateLinkResourcesClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewPrivateLinkResourcesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<account-name>", "<name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateLinkResourcesClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videoanalyzeroperationresults_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videoanalyzeroperationresults_client_test.go index 6e74ec5c3c1a..d5c53b03aeb7 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videoanalyzeroperationresults_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videoanalyzeroperationresults_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,20 +16,27 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-operation-result-by-id.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-operation-result-by-id.json func ExampleOperationResultsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewOperationResultsClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewOperationResultsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<location-name>", "<operation-id>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.OperationResultsClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videoanalyzeroperationstatuses_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videoanalyzeroperationstatuses_client_test.go index 053d481b510b..2e0c9e9676b5 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videoanalyzeroperationstatuses_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videoanalyzeroperationstatuses_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,20 +16,27 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-operation-status-by-id-non-terminal-state-failed.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-operation-status-by-id-non-terminal-state-failed.json func ExampleOperationStatusesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewOperationStatusesClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewOperationStatusesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<location-name>", "<operation-id>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.OperationStatusesClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videoanalyzers_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videoanalyzers_client_test.go index c94508b7fc4c..037813f8110a 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videoanalyzers_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videoanalyzers_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,60 +19,79 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-accounts-list-all-accounts.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-accounts-list-all-accounts.json func ExampleVideoAnalyzersClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewVideoAnalyzersClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewVideoAnalyzersClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, "<resource-group-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VideoAnalyzersClientListResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-accounts-get-by-name.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-accounts-get-by-name.json func ExampleVideoAnalyzersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewVideoAnalyzersClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewVideoAnalyzersClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<account-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VideoAnalyzersClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-accounts-create-or-update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-accounts-create-or-update.json func ExampleVideoAnalyzersClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewVideoAnalyzersClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewVideoAnalyzersClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "<resource-group-name>", "<account-name>", armvideoanalyzer.VideoAnalyzer{ - Location: to.StringPtr("<location>"), + Location: to.Ptr("<location>"), Tags: map[string]*string{ - "tag1": to.StringPtr("value1"), - "tag2": to.StringPtr("value2"), + "tag1": to.Ptr("value1"), + "tag2": to.Ptr("value2"), }, Identity: &armvideoanalyzer.Identity{ - Type: to.StringPtr("<type>"), + Type: to.Ptr("<type>"), UserAssignedIdentities: map[string]*armvideoanalyzer.UserAssignedManagedIdentity{ "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}, "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2": {}, @@ -81,96 +100,119 @@ func ExampleVideoAnalyzersClient_BeginCreateOrUpdate() { }, Properties: &armvideoanalyzer.Properties{ Encryption: &armvideoanalyzer.AccountEncryption{ - Type: armvideoanalyzer.AccountEncryptionKeyType("SystemKey").ToPtr(), + Type: to.Ptr(armvideoanalyzer.AccountEncryptionKeyTypeSystemKey), }, IotHubs: []*armvideoanalyzer.IotHub{ { - ID: to.StringPtr("<id>"), + ID: to.Ptr("<id>"), Identity: &armvideoanalyzer.ResourceIdentity{ - UserAssignedIdentity: to.StringPtr("<user-assigned-identity>"), + UserAssignedIdentity: to.Ptr("<user-assigned-identity>"), }, }, { - ID: to.StringPtr("<id>"), + ID: to.Ptr("<id>"), Identity: &armvideoanalyzer.ResourceIdentity{ - UserAssignedIdentity: to.StringPtr("<user-assigned-identity>"), + UserAssignedIdentity: to.Ptr("<user-assigned-identity>"), }, }}, StorageAccounts: []*armvideoanalyzer.StorageAccount{ { - ID: to.StringPtr("<id>"), + ID: to.Ptr("<id>"), Identity: &armvideoanalyzer.ResourceIdentity{ - UserAssignedIdentity: to.StringPtr("<user-assigned-identity>"), + UserAssignedIdentity: to.Ptr("<user-assigned-identity>"), }, }}, }, }, - nil) + &armvideoanalyzer.VideoAnalyzersClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.VideoAnalyzersClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-accounts-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-accounts-delete.json func ExampleVideoAnalyzersClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewVideoAnalyzersClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewVideoAnalyzersClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "<resource-group-name>", "<account-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-accounts-update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-accounts-update.json func ExampleVideoAnalyzersClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewVideoAnalyzersClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewVideoAnalyzersClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginUpdate(ctx, "<resource-group-name>", "<account-name>", armvideoanalyzer.Update{ Tags: map[string]*string{ - "key1": to.StringPtr("value3"), + "key1": to.Ptr("value3"), }, }, - nil) + &armvideoanalyzer.VideoAnalyzersClientBeginUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-accounts-subscription-list-all-accounts.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-accounts-subscription-list-all-accounts.json func ExampleVideoAnalyzersClient_ListBySubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewVideoAnalyzersClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewVideoAnalyzersClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListBySubscription(ctx, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VideoAnalyzersClientListBySubscriptionResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videos_client_test.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videos_client_test.go index 3475560f0d68..328b09bd773d 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videos_client_test.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/ze_generated_example_videos_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,132 +17,170 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/videoanalyzer/armvideoanalyzer" ) -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-list.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-list.json func ExampleVideosClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewVideosClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewVideosClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<resource-group-name>", "<account-name>", - &armvideoanalyzer.VideosClientListOptions{Top: to.Int32Ptr(2)}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + &armvideoanalyzer.VideosClientListOptions{Top: to.Ptr[int32](2)}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-get.json func ExampleVideosClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewVideosClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewVideosClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<account-name>", "<video-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VideosClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-create.json func ExampleVideosClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewVideosClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewVideosClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "<resource-group-name>", "<account-name>", "<video-name>", armvideoanalyzer.VideoEntity{ Properties: &armvideoanalyzer.VideoProperties{ - Description: to.StringPtr("<description>"), - Title: to.StringPtr("<title>"), + Description: to.Ptr("<description>"), + Title: to.Ptr("<title>"), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VideosClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-delete.json func ExampleVideosClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewVideosClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewVideosClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "<resource-group-name>", "<account-name>", "<video-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-patch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-patch.json func ExampleVideosClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewVideosClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewVideosClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "<resource-group-name>", "<account-name>", "<video-name>", armvideoanalyzer.VideoEntity{ Properties: &armvideoanalyzer.VideoProperties{ - Description: to.StringPtr("<description>"), + Description: to.Ptr("<description>"), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VideosClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-listContentToken.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-listContentToken.json func ExampleVideosClient_ListContentToken() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvideoanalyzer.NewVideosClient("<subscription-id>", cred, nil) + client, err := armvideoanalyzer.NewVideosClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListContentToken(ctx, "<resource-group-name>", "<account-name>", "<video-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VideosClientListContentTokenResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_accesspolicies_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_accesspolicies_client.go index cb4977298c4c..e43c1d0f3d25 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_accesspolicies_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_accesspolicies_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type AccessPoliciesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewAccessPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccessPoliciesClient { +func NewAccessPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessPoliciesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &AccessPoliciesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Creates a new access policy resource or updates an existing one with the given name. @@ -105,7 +110,7 @@ func (client *AccessPoliciesClient) createOrUpdateCreateRequest(ctx context.Cont // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *AccessPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (AccessPoliciesClientCreateOrUpdateResponse, error) { - result := AccessPoliciesClientCreateOrUpdateResponse{RawResponse: resp} + result := AccessPoliciesClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccessPolicyEntity); err != nil { return AccessPoliciesClientCreateOrUpdateResponse{}, err } @@ -130,7 +135,7 @@ func (client *AccessPoliciesClient) Delete(ctx context.Context, resourceGroupNam if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return AccessPoliciesClientDeleteResponse{}, runtime.NewResponseError(resp) } - return AccessPoliciesClientDeleteResponse{RawResponse: resp}, nil + return AccessPoliciesClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -216,7 +221,7 @@ func (client *AccessPoliciesClient) getCreateRequest(ctx context.Context, resour // getHandleResponse handles the Get response. func (client *AccessPoliciesClient) getHandleResponse(resp *http.Response) (AccessPoliciesClientGetResponse, error) { - result := AccessPoliciesClientGetResponse{RawResponse: resp} + result := AccessPoliciesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccessPolicyEntity); err != nil { return AccessPoliciesClientGetResponse{}, err } @@ -228,16 +233,32 @@ func (client *AccessPoliciesClient) getHandleResponse(resp *http.Response) (Acce // resourceGroupName - The name of the resource group. The name is case insensitive. // accountName - The Azure Video Analyzer account name. // options - AccessPoliciesClientListOptions contains the optional parameters for the AccessPoliciesClient.List method. -func (client *AccessPoliciesClient) List(resourceGroupName string, accountName string, options *AccessPoliciesClientListOptions) *AccessPoliciesClientListPager { - return &AccessPoliciesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *AccessPoliciesClient) List(resourceGroupName string, accountName string, options *AccessPoliciesClientListOptions) *runtime.Pager[AccessPoliciesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[AccessPoliciesClientListResponse]{ + More: func(page AccessPoliciesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp AccessPoliciesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.AccessPolicyEntityCollection.NextLink) + Fetcher: func(ctx context.Context, page *AccessPoliciesClientListResponse) (AccessPoliciesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessPoliciesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccessPoliciesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessPoliciesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -271,7 +292,7 @@ func (client *AccessPoliciesClient) listCreateRequest(ctx context.Context, resou // listHandleResponse handles the List response. func (client *AccessPoliciesClient) listHandleResponse(resp *http.Response) (AccessPoliciesClientListResponse, error) { - result := AccessPoliciesClientListResponse{RawResponse: resp} + result := AccessPoliciesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccessPolicyEntityCollection); err != nil { return AccessPoliciesClientListResponse{}, err } @@ -332,7 +353,7 @@ func (client *AccessPoliciesClient) updateCreateRequest(ctx context.Context, res // updateHandleResponse handles the Update response. func (client *AccessPoliciesClient) updateHandleResponse(resp *http.Response) (AccessPoliciesClientUpdateResponse, error) { - result := AccessPoliciesClientUpdateResponse{RawResponse: resp} + result := AccessPoliciesClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccessPolicyEntity); err != nil { return AccessPoliciesClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_constants.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_constants.go index d1b01e945af0..b885ec4c10ef 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_constants.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armvideoanalyzer const ( moduleName = "armvideoanalyzer" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // AccessPolicyEccAlgo - Elliptical curve algorithm to be used: ES256, ES384 or ES512. @@ -34,11 +34,6 @@ func PossibleAccessPolicyEccAlgoValues() []AccessPolicyEccAlgo { } } -// ToPtr returns a *AccessPolicyEccAlgo pointing to the current value. -func (c AccessPolicyEccAlgo) ToPtr() *AccessPolicyEccAlgo { - return &c -} - // AccessPolicyRole - Defines the access level granted by this policy. type AccessPolicyRole string @@ -54,11 +49,6 @@ func PossibleAccessPolicyRoleValues() []AccessPolicyRole { } } -// ToPtr returns a *AccessPolicyRole pointing to the current value. -func (c AccessPolicyRole) ToPtr() *AccessPolicyRole { - return &c -} - // AccessPolicyRsaAlgo - RSA algorithm to be used: RS256, RS384 or RS512. type AccessPolicyRsaAlgo string @@ -80,11 +70,6 @@ func PossibleAccessPolicyRsaAlgoValues() []AccessPolicyRsaAlgo { } } -// ToPtr returns a *AccessPolicyRsaAlgo pointing to the current value. -func (c AccessPolicyRsaAlgo) ToPtr() *AccessPolicyRsaAlgo { - return &c -} - // AccountEncryptionKeyType - The type of key used to encrypt the Account Key. type AccountEncryptionKeyType string @@ -103,11 +88,6 @@ func PossibleAccountEncryptionKeyTypeValues() []AccountEncryptionKeyType { } } -// ToPtr returns a *AccountEncryptionKeyType pointing to the current value. -func (c AccountEncryptionKeyType) ToPtr() *AccountEncryptionKeyType { - return &c -} - // ActionType - Indicates the action type. type ActionType string @@ -123,11 +103,6 @@ func PossibleActionTypeValues() []ActionType { } } -// ToPtr returns a *ActionType pointing to the current value. -func (c ActionType) ToPtr() *ActionType { - return &c -} - // CheckNameAvailabilityReason - The reason why the given name is not available. type CheckNameAvailabilityReason string @@ -144,11 +119,6 @@ func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { } } -// ToPtr returns a *CheckNameAvailabilityReason pointing to the current value. -func (c CheckNameAvailabilityReason) ToPtr() *CheckNameAvailabilityReason { - return &c -} - // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -169,11 +139,6 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// ToPtr returns a *CreatedByType pointing to the current value. -func (c CreatedByType) ToPtr() *CreatedByType { - return &c -} - // EncoderSystemPresetType - Name of the built-in encoding preset. type EncoderSystemPresetType string @@ -210,11 +175,6 @@ func PossibleEncoderSystemPresetTypeValues() []EncoderSystemPresetType { } } -// ToPtr returns a *EncoderSystemPresetType pointing to the current value. -func (c EncoderSystemPresetType) ToPtr() *EncoderSystemPresetType { - return &c -} - // Kind - Topology kind. type Kind string @@ -233,11 +193,6 @@ func PossibleKindValues() []Kind { } } -// ToPtr returns a *Kind pointing to the current value. -func (c Kind) ToPtr() *Kind { - return &c -} - // LivePipelineState - Current state of the pipeline (read-only). type LivePipelineState string @@ -264,11 +219,6 @@ func PossibleLivePipelineStateValues() []LivePipelineState { } } -// ToPtr returns a *LivePipelineState pointing to the current value. -func (c LivePipelineState) ToPtr() *LivePipelineState { - return &c -} - // MetricAggregationType - The metric aggregation type type MetricAggregationType string @@ -290,11 +240,6 @@ func PossibleMetricAggregationTypeValues() []MetricAggregationType { } } -// ToPtr returns a *MetricAggregationType pointing to the current value. -func (c MetricAggregationType) ToPtr() *MetricAggregationType { - return &c -} - // MetricUnit - The metric unit type MetricUnit string @@ -316,11 +261,6 @@ func PossibleMetricUnitValues() []MetricUnit { } } -// ToPtr returns a *MetricUnit pointing to the current value. -func (c MetricUnit) ToPtr() *MetricUnit { - return &c -} - // ParameterType - Type of the parameter. type ParameterType string @@ -348,11 +288,6 @@ func PossibleParameterTypeValues() []ParameterType { } } -// ToPtr returns a *ParameterType pointing to the current value. -func (c ParameterType) ToPtr() *ParameterType { - return &c -} - // PipelineJobState - Current state of the pipeline (read-only). type PipelineJobState string @@ -377,11 +312,6 @@ func PossiblePipelineJobStateValues() []PipelineJobState { } } -// ToPtr returns a *PipelineJobState pointing to the current value. -func (c PipelineJobState) ToPtr() *PipelineJobState { - return &c -} - // PrivateEndpointConnectionProvisioningState - The current provisioning state. type PrivateEndpointConnectionProvisioningState string @@ -402,11 +332,6 @@ func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpoin } } -// ToPtr returns a *PrivateEndpointConnectionProvisioningState pointing to the current value. -func (c PrivateEndpointConnectionProvisioningState) ToPtr() *PrivateEndpointConnectionProvisioningState { - return &c -} - // PrivateEndpointServiceConnectionStatus - The private endpoint connection status. type PrivateEndpointServiceConnectionStatus string @@ -425,11 +350,6 @@ func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointSer } } -// ToPtr returns a *PrivateEndpointServiceConnectionStatus pointing to the current value. -func (c PrivateEndpointServiceConnectionStatus) ToPtr() *PrivateEndpointServiceConnectionStatus { - return &c -} - // ProvisioningState - Provisioning state of the Video Analyzer account. type ProvisioningState string @@ -451,11 +371,6 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// ToPtr returns a *ProvisioningState pointing to the current value. -func (c ProvisioningState) ToPtr() *ProvisioningState { - return &c -} - // PublicNetworkAccess - Whether or not public network access is allowed for resources under the Video Analyzer account. type PublicNetworkAccess string @@ -474,11 +389,6 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { } } -// ToPtr returns a *PublicNetworkAccess pointing to the current value. -func (c PublicNetworkAccess) ToPtr() *PublicNetworkAccess { - return &c -} - // RtspTransport - Network transport utilized by the RTSP and RTP exchange: TCP or HTTP. When using TCP, the RTP packets are // interleaved on the TCP RTSP connection. When using HTTP, the RTSP messages are exchanged // through long lived HTTP connections, and the RTP packages are interleaved in the HTTP connections alongside the RTSP messages. @@ -500,11 +410,6 @@ func PossibleRtspTransportValues() []RtspTransport { } } -// ToPtr returns a *RtspTransport pointing to the current value. -func (c RtspTransport) ToPtr() *RtspTransport { - return &c -} - // SKUName - The SKU name. type SKUName string @@ -524,11 +429,6 @@ func PossibleSKUNameValues() []SKUName { } } -// ToPtr returns a *SKUName pointing to the current value. -func (c SKUName) ToPtr() *SKUName { - return &c -} - // SKUTier - The SKU tier. type SKUTier string @@ -544,11 +444,6 @@ func PossibleSKUTierValues() []SKUTier { } } -// ToPtr returns a *SKUTier pointing to the current value. -func (c SKUTier) ToPtr() *SKUTier { - return &c -} - // VideoAnalyzerEndpointType - The type of the endpoint. type VideoAnalyzerEndpointType string @@ -564,11 +459,6 @@ func PossibleVideoAnalyzerEndpointTypeValues() []VideoAnalyzerEndpointType { } } -// ToPtr returns a *VideoAnalyzerEndpointType pointing to the current value. -func (c VideoAnalyzerEndpointType) ToPtr() *VideoAnalyzerEndpointType { - return &c -} - // VideoScaleMode - Describes the video scaling mode to be applied. Default mode is 'Pad'. If the mode is 'Pad' or 'Stretch' // then both width and height must be specified. Else if the mode is 'PreserveAspectRatio' then // only one of width or height need be provided. @@ -595,11 +485,6 @@ func PossibleVideoScaleModeValues() []VideoScaleMode { } } -// ToPtr returns a *VideoScaleMode pointing to the current value. -func (c VideoScaleMode) ToPtr() *VideoScaleMode { - return &c -} - // VideoType - Video content type. Different content types are suitable for different applications and scenarios. type VideoType string @@ -623,8 +508,3 @@ func PossibleVideoTypeValues() []VideoType { VideoTypeFile, } } - -// ToPtr returns a *VideoType pointing to the current value. -func (c VideoType) ToPtr() *VideoType { - return &c -} diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_edgemodules_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_edgemodules_client.go index d6ae14d09c45..fd7c5cc4aaea 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_edgemodules_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_edgemodules_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type EdgeModulesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewEdgeModulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *EdgeModulesClient { +func NewEdgeModulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EdgeModulesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &EdgeModulesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Creates a new edge module or updates an existing one. An edge module resource enables a single instance @@ -110,7 +115,7 @@ func (client *EdgeModulesClient) createOrUpdateCreateRequest(ctx context.Context // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *EdgeModulesClient) createOrUpdateHandleResponse(resp *http.Response) (EdgeModulesClientCreateOrUpdateResponse, error) { - result := EdgeModulesClientCreateOrUpdateResponse{RawResponse: resp} + result := EdgeModulesClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.EdgeModuleEntity); err != nil { return EdgeModulesClientCreateOrUpdateResponse{}, err } @@ -137,7 +142,7 @@ func (client *EdgeModulesClient) Delete(ctx context.Context, resourceGroupName s if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return EdgeModulesClientDeleteResponse{}, runtime.NewResponseError(resp) } - return EdgeModulesClientDeleteResponse{RawResponse: resp}, nil + return EdgeModulesClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -223,7 +228,7 @@ func (client *EdgeModulesClient) getCreateRequest(ctx context.Context, resourceG // getHandleResponse handles the Get response. func (client *EdgeModulesClient) getHandleResponse(resp *http.Response) (EdgeModulesClientGetResponse, error) { - result := EdgeModulesClientGetResponse{RawResponse: resp} + result := EdgeModulesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.EdgeModuleEntity); err != nil { return EdgeModulesClientGetResponse{}, err } @@ -235,16 +240,32 @@ func (client *EdgeModulesClient) getHandleResponse(resp *http.Response) (EdgeMod // resourceGroupName - The name of the resource group. The name is case insensitive. // accountName - The Azure Video Analyzer account name. // options - EdgeModulesClientListOptions contains the optional parameters for the EdgeModulesClient.List method. -func (client *EdgeModulesClient) List(resourceGroupName string, accountName string, options *EdgeModulesClientListOptions) *EdgeModulesClientListPager { - return &EdgeModulesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *EdgeModulesClient) List(resourceGroupName string, accountName string, options *EdgeModulesClientListOptions) *runtime.Pager[EdgeModulesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[EdgeModulesClientListResponse]{ + More: func(page EdgeModulesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp EdgeModulesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.EdgeModuleEntityCollection.NextLink) + Fetcher: func(ctx context.Context, page *EdgeModulesClientListResponse) (EdgeModulesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return EdgeModulesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return EdgeModulesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return EdgeModulesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -278,7 +299,7 @@ func (client *EdgeModulesClient) listCreateRequest(ctx context.Context, resource // listHandleResponse handles the List response. func (client *EdgeModulesClient) listHandleResponse(resp *http.Response) (EdgeModulesClientListResponse, error) { - result := EdgeModulesClientListResponse{RawResponse: resp} + result := EdgeModulesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.EdgeModuleEntityCollection); err != nil { return EdgeModulesClientListResponse{}, err } @@ -346,7 +367,7 @@ func (client *EdgeModulesClient) listProvisioningTokenCreateRequest(ctx context. // listProvisioningTokenHandleResponse handles the ListProvisioningToken response. func (client *EdgeModulesClient) listProvisioningTokenHandleResponse(resp *http.Response) (EdgeModulesClientListProvisioningTokenResponse, error) { - result := EdgeModulesClientListProvisioningTokenResponse{RawResponse: resp} + result := EdgeModulesClientListProvisioningTokenResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.EdgeModuleProvisioningToken); err != nil { return EdgeModulesClientListProvisioningTokenResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_livepipelineoperationstatuses_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_livepipelineoperationstatuses_client.go index 01c847f1b7a6..9d10a515ecd8 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_livepipelineoperationstatuses_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_livepipelineoperationstatuses_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type LivePipelineOperationStatusesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewLivePipelineOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LivePipelineOperationStatusesClient { +func NewLivePipelineOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LivePipelineOperationStatusesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &LivePipelineOperationStatusesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get the operation status of a live pipeline. @@ -108,7 +113,7 @@ func (client *LivePipelineOperationStatusesClient) getCreateRequest(ctx context. // getHandleResponse handles the Get response. func (client *LivePipelineOperationStatusesClient) getHandleResponse(resp *http.Response) (LivePipelineOperationStatusesClientGetResponse, error) { - result := LivePipelineOperationStatusesClientGetResponse{RawResponse: resp} + result := LivePipelineOperationStatusesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.LivePipelineOperationStatus); err != nil { return LivePipelineOperationStatusesClientGetResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_livepipelines_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_livepipelines_client.go index 0628ecf5a167..922381a9592b 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_livepipelines_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_livepipelines_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type LivePipelinesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewLivePipelinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LivePipelinesClient { +func NewLivePipelinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LivePipelinesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &LivePipelinesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // BeginActivate - Activates a live pipeline with the given name. @@ -57,22 +62,16 @@ func NewLivePipelinesClient(subscriptionID string, credential azcore.TokenCreden // livePipelineName - Live pipeline unique identifier. // options - LivePipelinesClientBeginActivateOptions contains the optional parameters for the LivePipelinesClient.BeginActivate // method. -func (client *LivePipelinesClient) BeginActivate(ctx context.Context, resourceGroupName string, accountName string, livePipelineName string, options *LivePipelinesClientBeginActivateOptions) (LivePipelinesClientActivatePollerResponse, error) { - resp, err := client.activate(ctx, resourceGroupName, accountName, livePipelineName, options) - if err != nil { - return LivePipelinesClientActivatePollerResponse{}, err - } - result := LivePipelinesClientActivatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("LivePipelinesClient.Activate", "", resp, client.pl) - if err != nil { - return LivePipelinesClientActivatePollerResponse{}, err - } - result.Poller = &LivePipelinesClientActivatePoller{ - pt: pt, +func (client *LivePipelinesClient) BeginActivate(ctx context.Context, resourceGroupName string, accountName string, livePipelineName string, options *LivePipelinesClientBeginActivateOptions) (*armruntime.Poller[LivePipelinesClientActivateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.activate(ctx, resourceGroupName, accountName, livePipelineName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[LivePipelinesClientActivateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[LivePipelinesClientActivateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Activate - Activates a live pipeline with the given name. @@ -177,7 +176,7 @@ func (client *LivePipelinesClient) createOrUpdateCreateRequest(ctx context.Conte // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *LivePipelinesClient) createOrUpdateHandleResponse(resp *http.Response) (LivePipelinesClientCreateOrUpdateResponse, error) { - result := LivePipelinesClientCreateOrUpdateResponse{RawResponse: resp} + result := LivePipelinesClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.LivePipeline); err != nil { return LivePipelinesClientCreateOrUpdateResponse{}, err } @@ -191,22 +190,16 @@ func (client *LivePipelinesClient) createOrUpdateHandleResponse(resp *http.Respo // livePipelineName - Live pipeline unique identifier. // options - LivePipelinesClientBeginDeactivateOptions contains the optional parameters for the LivePipelinesClient.BeginDeactivate // method. -func (client *LivePipelinesClient) BeginDeactivate(ctx context.Context, resourceGroupName string, accountName string, livePipelineName string, options *LivePipelinesClientBeginDeactivateOptions) (LivePipelinesClientDeactivatePollerResponse, error) { - resp, err := client.deactivate(ctx, resourceGroupName, accountName, livePipelineName, options) - if err != nil { - return LivePipelinesClientDeactivatePollerResponse{}, err - } - result := LivePipelinesClientDeactivatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("LivePipelinesClient.Deactivate", "", resp, client.pl) - if err != nil { - return LivePipelinesClientDeactivatePollerResponse{}, err - } - result.Poller = &LivePipelinesClientDeactivatePoller{ - pt: pt, +func (client *LivePipelinesClient) BeginDeactivate(ctx context.Context, resourceGroupName string, accountName string, livePipelineName string, options *LivePipelinesClientBeginDeactivateOptions) (*armruntime.Poller[LivePipelinesClientDeactivateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deactivate(ctx, resourceGroupName, accountName, livePipelineName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[LivePipelinesClientDeactivateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[LivePipelinesClientDeactivateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Deactivate - Deactivates a live pipeline with the given name. @@ -274,7 +267,7 @@ func (client *LivePipelinesClient) Delete(ctx context.Context, resourceGroupName if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return LivePipelinesClientDeleteResponse{}, runtime.NewResponseError(resp) } - return LivePipelinesClientDeleteResponse{RawResponse: resp}, nil + return LivePipelinesClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -361,7 +354,7 @@ func (client *LivePipelinesClient) getCreateRequest(ctx context.Context, resourc // getHandleResponse handles the Get response. func (client *LivePipelinesClient) getHandleResponse(resp *http.Response) (LivePipelinesClientGetResponse, error) { - result := LivePipelinesClientGetResponse{RawResponse: resp} + result := LivePipelinesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.LivePipeline); err != nil { return LivePipelinesClientGetResponse{}, err } @@ -373,16 +366,32 @@ func (client *LivePipelinesClient) getHandleResponse(resp *http.Response) (LiveP // resourceGroupName - The name of the resource group. The name is case insensitive. // accountName - The Azure Video Analyzer account name. // options - LivePipelinesClientListOptions contains the optional parameters for the LivePipelinesClient.List method. -func (client *LivePipelinesClient) List(resourceGroupName string, accountName string, options *LivePipelinesClientListOptions) *LivePipelinesClientListPager { - return &LivePipelinesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *LivePipelinesClient) List(resourceGroupName string, accountName string, options *LivePipelinesClientListOptions) *runtime.Pager[LivePipelinesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[LivePipelinesClientListResponse]{ + More: func(page LivePipelinesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp LivePipelinesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.LivePipelineCollection.NextLink) + Fetcher: func(ctx context.Context, page *LivePipelinesClientListResponse) (LivePipelinesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LivePipelinesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LivePipelinesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LivePipelinesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -419,7 +428,7 @@ func (client *LivePipelinesClient) listCreateRequest(ctx context.Context, resour // listHandleResponse handles the List response. func (client *LivePipelinesClient) listHandleResponse(resp *http.Response) (LivePipelinesClientListResponse, error) { - result := LivePipelinesClientListResponse{RawResponse: resp} + result := LivePipelinesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.LivePipelineCollection); err != nil { return LivePipelinesClientListResponse{}, err } @@ -482,7 +491,7 @@ func (client *LivePipelinesClient) updateCreateRequest(ctx context.Context, reso // updateHandleResponse handles the Update response. func (client *LivePipelinesClient) updateHandleResponse(resp *http.Response) (LivePipelinesClientUpdateResponse, error) { - result := LivePipelinesClientUpdateResponse{RawResponse: resp} + result := LivePipelinesClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.LivePipeline); err != nil { return LivePipelinesClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_locations_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_locations_client.go index cf530dc479c5..784e451ec928 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_locations_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_locations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type LocationsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationsClient { +func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &LocationsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CheckNameAvailability - Checks whether the Video Analyzer resource name is available. @@ -94,7 +99,7 @@ func (client *LocationsClient) checkNameAvailabilityCreateRequest(ctx context.Co // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. func (client *LocationsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (LocationsClientCheckNameAvailabilityResponse, error) { - result := LocationsClientCheckNameAvailabilityResponse{RawResponse: resp} + result := LocationsClientCheckNameAvailabilityResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { return LocationsClientCheckNameAvailabilityResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_models.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_models.go index 75e1b07fdd81..bbe033034cb1 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_models.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armvideoanalyzer -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // AccessPoliciesClientCreateOrUpdateOptions contains the optional parameters for the AccessPoliciesClient.CreateOrUpdate // method. @@ -61,17 +56,6 @@ type AccessPolicyEntity struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AccessPolicyEntity. -func (a AccessPolicyEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - // AccessPolicyEntityCollection - A collection of AccessPolicyEntity items. type AccessPolicyEntityCollection struct { // A link to the next page of the collection (when the collection contains too many results to return in one response). @@ -81,14 +65,6 @@ type AccessPolicyEntityCollection struct { Value []*AccessPolicyEntity `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AccessPolicyEntityCollection. -func (a AccessPolicyEntityCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - // AccessPolicyProperties - Application level properties for the access policy resource. type AccessPolicyProperties struct { // Authentication method to be used when validating client API access. @@ -98,37 +74,6 @@ type AccessPolicyProperties struct { Role *AccessPolicyRole `json:"role,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AccessPolicyProperties. -func (a AccessPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authentication", a.Authentication) - populate(objectMap, "role", a.Role) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AccessPolicyProperties. -func (a *AccessPolicyProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "authentication": - a.Authentication, err = unmarshalAuthenticationBaseClassification(val) - delete(rawMsg, key) - case "role": - err = unpopulate(val, &a.Role) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AccountEncryption - Defines how the Video Analyzer account is (optionally) encrypted. type AccountEncryption struct { // REQUIRED; The type of key used to encrypt the Account Key. @@ -155,45 +100,6 @@ type AudioEncoderAac struct { BitrateKbps *string `json:"bitrateKbps,omitempty"` } -// GetAudioEncoderBase implements the AudioEncoderBaseClassification interface for type AudioEncoderAac. -func (a *AudioEncoderAac) GetAudioEncoderBase() *AudioEncoderBase { - return &AudioEncoderBase{ - Type: a.Type, - BitrateKbps: a.BitrateKbps, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AudioEncoderAac. -func (a AudioEncoderAac) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "bitrateKbps", a.BitrateKbps) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.AudioEncoderAac" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AudioEncoderAac. -func (a *AudioEncoderAac) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "bitrateKbps": - err = unpopulate(val, &a.BitrateKbps) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &a.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AudioEncoderBaseClassification provides polymorphic access to related types. // Call the interface's GetAudioEncoderBase() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -215,9 +121,6 @@ type AudioEncoderBase struct { BitrateKbps *string `json:"bitrateKbps,omitempty"` } -// GetAudioEncoderBase implements the AudioEncoderBaseClassification interface for type AudioEncoderBase. -func (a *AudioEncoderBase) GetAudioEncoderBase() *AudioEncoderBase { return a } - // AuthenticationBaseClassification provides polymorphic access to related types. // Call the interface's GetAuthenticationBase() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -233,9 +136,6 @@ type AuthenticationBase struct { Type *string `json:"@type,omitempty"` } -// GetAuthenticationBase implements the AuthenticationBaseClassification interface for type AuthenticationBase. -func (a *AuthenticationBase) GetAuthenticationBase() *AuthenticationBase { return a } - // CertificateSourceClassification provides polymorphic access to related types. // Call the interface's GetCertificateSource() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -251,9 +151,6 @@ type CertificateSource struct { Type *string `json:"@type,omitempty"` } -// GetCertificateSource implements the CertificateSourceClassification interface for type CertificateSource. -func (c *CertificateSource) GetCertificateSource() *CertificateSource { return c } - // CheckNameAvailabilityRequest - The check availability request body. type CheckNameAvailabilityRequest struct { // The name of the resource for which availability needs to be checked. @@ -281,13 +178,6 @@ type Collection struct { Value []*VideoAnalyzer `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type Collection. -func (c Collection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - // CredentialsBaseClassification provides polymorphic access to related types. // Call the interface's GetCredentialsBase() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -303,9 +193,6 @@ type CredentialsBase struct { Type *string `json:"@type,omitempty"` } -// GetCredentialsBase implements the CredentialsBaseClassification interface for type CredentialsBase. -func (c *CredentialsBase) GetCredentialsBase() *CredentialsBase { return c } - // EccTokenKey - Required validation properties for tokens generated with Elliptical Curve algorithm. type EccTokenKey struct { // REQUIRED; Elliptical curve algorithm to be used: ES256, ES384 or ES512. @@ -324,57 +211,6 @@ type EccTokenKey struct { Y *string `json:"y,omitempty"` } -// GetTokenKey implements the TokenKeyClassification interface for type EccTokenKey. -func (e *EccTokenKey) GetTokenKey() *TokenKey { - return &TokenKey{ - Type: e.Type, - Kid: e.Kid, - } -} - -// MarshalJSON implements the json.Marshaller interface for type EccTokenKey. -func (e EccTokenKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alg", e.Alg) - populate(objectMap, "kid", e.Kid) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.EccTokenKey" - populate(objectMap, "x", e.X) - populate(objectMap, "y", e.Y) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EccTokenKey. -func (e *EccTokenKey) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "alg": - err = unpopulate(val, &e.Alg) - delete(rawMsg, key) - case "kid": - err = unpopulate(val, &e.Kid) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &e.Type) - delete(rawMsg, key) - case "x": - err = unpopulate(val, &e.X) - delete(rawMsg, key) - case "y": - err = unpopulate(val, &e.Y) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // EdgeModuleEntity - The representation of an edge module. type EdgeModuleEntity struct { // The resource properties. @@ -402,14 +238,6 @@ type EdgeModuleEntityCollection struct { Value []*EdgeModuleEntity `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type EdgeModuleEntityCollection. -func (e EdgeModuleEntityCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@nextLink", e.NextLink) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - // EdgeModuleProperties - Application level properties for the edge module resource. type EdgeModuleProperties struct { // READ-ONLY; Internal ID generated for the instance of the Video Analyzer edge module. @@ -433,37 +261,6 @@ type EdgeModuleProvisioningToken struct { Token *string `json:"token,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type EdgeModuleProvisioningToken. -func (e EdgeModuleProvisioningToken) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "expirationDate", e.ExpirationDate) - populate(objectMap, "token", e.Token) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EdgeModuleProvisioningToken. -func (e *EdgeModuleProvisioningToken) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "expirationDate": - err = unpopulateTimeRFC3339(val, &e.ExpirationDate) - delete(rawMsg, key) - case "token": - err = unpopulate(val, &e.Token) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // EdgeModulesClientCreateOrUpdateOptions contains the optional parameters for the EdgeModulesClient.CreateOrUpdate method. type EdgeModulesClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -504,48 +301,6 @@ type EncoderCustomPreset struct { VideoEncoder VideoEncoderBaseClassification `json:"videoEncoder,omitempty"` } -// GetEncoderPresetBase implements the EncoderPresetBaseClassification interface for type EncoderCustomPreset. -func (e *EncoderCustomPreset) GetEncoderPresetBase() *EncoderPresetBase { - return &EncoderPresetBase{ - Type: e.Type, - } -} - -// MarshalJSON implements the json.Marshaller interface for type EncoderCustomPreset. -func (e EncoderCustomPreset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "audioEncoder", e.AudioEncoder) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.EncoderCustomPreset" - populate(objectMap, "videoEncoder", e.VideoEncoder) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EncoderCustomPreset. -func (e *EncoderCustomPreset) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "audioEncoder": - e.AudioEncoder, err = unmarshalAudioEncoderBaseClassification(val) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &e.Type) - delete(rawMsg, key) - case "videoEncoder": - e.VideoEncoder, err = unmarshalVideoEncoderBaseClassification(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // EncoderPresetBaseClassification provides polymorphic access to related types. // Call the interface's GetEncoderPresetBase() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -562,9 +317,6 @@ type EncoderPresetBase struct { Type *string `json:"@type,omitempty"` } -// GetEncoderPresetBase implements the EncoderPresetBaseClassification interface for type EncoderPresetBase. -func (e *EncoderPresetBase) GetEncoderPresetBase() *EncoderPresetBase { return e } - // EncoderProcessor - Encoder processor allows for encoding of the input content. For example, it can used to change the resolution // from 4K to 1280x720. type EncoderProcessor struct { @@ -581,62 +333,6 @@ type EncoderProcessor struct { Type *string `json:"@type,omitempty"` } -// GetNodeBase implements the NodeBaseClassification interface for type EncoderProcessor. -func (e *EncoderProcessor) GetNodeBase() *NodeBase { - return &NodeBase{ - Type: e.Type, - Name: e.Name, - } -} - -// GetProcessorNodeBase implements the ProcessorNodeBaseClassification interface for type EncoderProcessor. -func (e *EncoderProcessor) GetProcessorNodeBase() *ProcessorNodeBase { - return &ProcessorNodeBase{ - Inputs: e.Inputs, - Type: e.Type, - Name: e.Name, - } -} - -// MarshalJSON implements the json.Marshaller interface for type EncoderProcessor. -func (e EncoderProcessor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "inputs", e.Inputs) - populate(objectMap, "name", e.Name) - populate(objectMap, "preset", e.Preset) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.EncoderProcessor" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EncoderProcessor. -func (e *EncoderProcessor) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "inputs": - err = unpopulate(val, &e.Inputs) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &e.Name) - delete(rawMsg, key) - case "preset": - e.Preset, err = unmarshalEncoderPresetBaseClassification(val) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &e.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // EncoderSystemPreset - Describes a built-in preset for encoding the input content using the encoder processor. type EncoderSystemPreset struct { // REQUIRED; Name of the built-in encoding preset. @@ -646,44 +342,6 @@ type EncoderSystemPreset struct { Type *string `json:"@type,omitempty"` } -// GetEncoderPresetBase implements the EncoderPresetBaseClassification interface for type EncoderSystemPreset. -func (e *EncoderSystemPreset) GetEncoderPresetBase() *EncoderPresetBase { - return &EncoderPresetBase{ - Type: e.Type, - } -} - -// MarshalJSON implements the json.Marshaller interface for type EncoderSystemPreset. -func (e EncoderSystemPreset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", e.Name) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.EncoderSystemPreset" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EncoderSystemPreset. -func (e *EncoderSystemPreset) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, &e.Name) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &e.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // Endpoint - The endpoint details. type Endpoint struct { // REQUIRED; The type of the endpoint. @@ -718,48 +376,6 @@ type EndpointBase struct { Tunnel TunnelBaseClassification `json:"tunnel,omitempty"` } -// GetEndpointBase implements the EndpointBaseClassification interface for type EndpointBase. -func (e *EndpointBase) GetEndpointBase() *EndpointBase { return e } - -// MarshalJSON implements the json.Marshaller interface for type EndpointBase. -func (e EndpointBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "credentials", e.Credentials) - populate(objectMap, "tunnel", e.Tunnel) - objectMap["@type"] = e.Type - populate(objectMap, "url", e.URL) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointBase. -func (e *EndpointBase) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "credentials": - e.Credentials, err = unmarshalCredentialsBaseClassification(val) - delete(rawMsg, key) - case "tunnel": - e.Tunnel, err = unmarshalTunnelBaseClassification(val) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &e.Type) - delete(rawMsg, key) - case "url": - err = unpopulate(val, &e.URL) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -787,15 +403,11 @@ type ErrorDetail struct { Target *string `json:"target,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail `json:"error,omitempty"` } // GroupLevelAccessControl - Group level network access control. @@ -813,14 +425,6 @@ type Identity struct { UserAssignedIdentities map[string]*UserAssignedManagedIdentity `json:"userAssignedIdentities,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "type", i.Type) - populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) - return json.Marshal(objectMap) -} - // IotHub - The IoT Hub details. type IotHub struct { // REQUIRED; The IoT Hub resource identifier. @@ -852,56 +456,6 @@ type JwtAuthentication struct { Keys []TokenKeyClassification `json:"keys,omitempty"` } -// GetAuthenticationBase implements the AuthenticationBaseClassification interface for type JwtAuthentication. -func (j *JwtAuthentication) GetAuthenticationBase() *AuthenticationBase { - return &AuthenticationBase{ - Type: j.Type, - } -} - -// MarshalJSON implements the json.Marshaller interface for type JwtAuthentication. -func (j JwtAuthentication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "audiences", j.Audiences) - populate(objectMap, "claims", j.Claims) - populate(objectMap, "issuers", j.Issuers) - populate(objectMap, "keys", j.Keys) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.JwtAuthentication" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JwtAuthentication. -func (j *JwtAuthentication) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "audiences": - err = unpopulate(val, &j.Audiences) - delete(rawMsg, key) - case "claims": - err = unpopulate(val, &j.Claims) - delete(rawMsg, key) - case "issuers": - err = unpopulate(val, &j.Issuers) - delete(rawMsg, key) - case "keys": - j.Keys, err = unmarshalTokenKeyClassificationArray(val) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &j.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // KeyVaultProperties - The details for accessing the encryption keys in Key Vault. type KeyVaultProperties struct { // REQUIRED; The URL of the Key Vault key used to encrypt the account. The key may either be versioned (for example https://vault/keys/mykey/version1) @@ -921,33 +475,6 @@ type ListProvisioningTokenInput struct { ExpirationDate *time.Time `json:"expirationDate,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ListProvisioningTokenInput. -func (l ListProvisioningTokenInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "expirationDate", l.ExpirationDate) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ListProvisioningTokenInput. -func (l *ListProvisioningTokenInput) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "expirationDate": - err = unpopulateTimeRFC3339(val, &l.ExpirationDate) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // LivePipeline - Live pipeline represents a unique instance of a live topology, used for real-time ingestion, archiving and // publishing of content for a unique RTSP camera. type LivePipeline struct { @@ -976,14 +503,6 @@ type LivePipelineCollection struct { Value []*LivePipeline `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type LivePipelineCollection. -func (l LivePipelineCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@nextLink", l.NextLink) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - // LivePipelineOperationStatus - Used for tracking the status of an operation on the live pipeline. type LivePipelineOperationStatus struct { // READ-ONLY; The error details for the live pipeline operation. @@ -1028,17 +547,6 @@ type LivePipelineProperties struct { State *LivePipelineState `json:"state,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type LivePipelineProperties. -func (l LivePipelineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "bitrateKbps", l.BitrateKbps) - populate(objectMap, "description", l.Description) - populate(objectMap, "parameters", l.Parameters) - populate(objectMap, "state", l.State) - populate(objectMap, "topologyName", l.TopologyName) - return json.Marshal(objectMap) -} - // LivePipelinePropertiesUpdate - Live pipeline properties. type LivePipelinePropertiesUpdate struct { // Maximum bitrate capacity in Kbps reserved for the live pipeline. The allowed range is from 500 to 3000 Kbps in increments @@ -1065,17 +573,6 @@ type LivePipelinePropertiesUpdate struct { State *LivePipelineState `json:"state,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type LivePipelinePropertiesUpdate. -func (l LivePipelinePropertiesUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "bitrateKbps", l.BitrateKbps) - populate(objectMap, "description", l.Description) - populate(objectMap, "parameters", l.Parameters) - populate(objectMap, "state", l.State) - populate(objectMap, "topologyName", l.TopologyName) - return json.Marshal(objectMap) -} - // LivePipelineUpdate - Live pipeline represents a unique instance of a live topology, used for real-time ingestion, archiving // and publishing of content for a unique RTSP camera. type LivePipelineUpdate struct { @@ -1095,26 +592,17 @@ type LivePipelineUpdate struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type LivePipelineUpdate. -func (l LivePipelineUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", l.ID) - populate(objectMap, "name", l.Name) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "systemData", l.SystemData) - populate(objectMap, "type", l.Type) - return json.Marshal(objectMap) -} - // LivePipelinesClientBeginActivateOptions contains the optional parameters for the LivePipelinesClient.BeginActivate method. type LivePipelinesClientBeginActivateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // LivePipelinesClientBeginDeactivateOptions contains the optional parameters for the LivePipelinesClient.BeginDeactivate // method. type LivePipelinesClientBeginDeactivateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // LivePipelinesClientCreateOrUpdateOptions contains the optional parameters for the LivePipelinesClient.CreateOrUpdate method. @@ -1221,24 +709,6 @@ type MetricSpecification struct { Unit *MetricUnit `json:"unit,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. -func (m MetricSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregationType", m.AggregationType) - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "displayDescription", m.DisplayDescription) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "enableRegionalMdmAccount", m.EnableRegionalMdmAccount) - populate(objectMap, "lockAggregationType", m.LockAggregationType) - populate(objectMap, "name", m.Name) - populate(objectMap, "sourceMdmAccount", m.SourceMdmAccount) - populate(objectMap, "sourceMdmNamespace", m.SourceMdmNamespace) - populate(objectMap, "supportedAggregationTypes", m.SupportedAggregationTypes) - populate(objectMap, "supportedTimeGrainTypes", m.SupportedTimeGrainTypes) - populate(objectMap, "unit", m.Unit) - return json.Marshal(objectMap) -} - // NetworkAccessControl - Network access control for video analyzer account. type NetworkAccessControl struct { // Public network access for consumption group. @@ -1269,9 +739,6 @@ type NodeBase struct { Type *string `json:"@type,omitempty"` } -// GetNodeBase implements the NodeBaseClassification interface for type NodeBase. -func (n *NodeBase) GetNodeBase() *NodeBase { return n } - // NodeInput - Describes an input signal to be used on a pipeline node. type NodeInput struct { // REQUIRED; The name of the upstream node in the pipeline which output is used as input of the current node. @@ -1305,13 +772,6 @@ type OperationCollection struct { Value []*Operation `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OperationCollection. -func (o OperationCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationDisplay - Operation details. type OperationDisplay struct { // The operation description. @@ -1399,44 +859,6 @@ type PemCertificateList struct { Type *string `json:"@type,omitempty"` } -// GetCertificateSource implements the CertificateSourceClassification interface for type PemCertificateList. -func (p *PemCertificateList) GetCertificateSource() *CertificateSource { - return &CertificateSource{ - Type: p.Type, - } -} - -// MarshalJSON implements the json.Marshaller interface for type PemCertificateList. -func (p PemCertificateList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "certificates", p.Certificates) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.PemCertificateList" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PemCertificateList. -func (p *PemCertificateList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "certificates": - err = unpopulate(val, &p.Certificates) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &p.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // PipelineJob - Pipeline job represents a unique instance of a batch topology, used for offline processing of selected portions // of archived content. type PipelineJob struct { @@ -1465,14 +887,6 @@ type PipelineJobCollection struct { Value []*PipelineJob `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PipelineJobCollection. -func (p PipelineJobCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PipelineJobError - Details about the error for a failed pipeline job. type PipelineJobError struct { // The error code. @@ -1525,53 +939,6 @@ type PipelineJobProperties struct { State *PipelineJobState `json:"state,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PipelineJobProperties. -func (p PipelineJobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", p.Description) - populate(objectMap, "error", p.Error) - populateTimeRFC3339(objectMap, "expiration", p.Expiration) - populate(objectMap, "parameters", p.Parameters) - populate(objectMap, "state", p.State) - populate(objectMap, "topologyName", p.TopologyName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineJobProperties. -func (p *PipelineJobProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, &p.Description) - delete(rawMsg, key) - case "error": - err = unpopulate(val, &p.Error) - delete(rawMsg, key) - case "expiration": - err = unpopulateTimeRFC3339(val, &p.Expiration) - delete(rawMsg, key) - case "parameters": - err = unpopulate(val, &p.Parameters) - delete(rawMsg, key) - case "state": - err = unpopulate(val, &p.State) - delete(rawMsg, key) - case "topologyName": - err = unpopulate(val, &p.TopologyName) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // PipelineJobPropertiesUpdate - Pipeline job properties. type PipelineJobPropertiesUpdate struct { // An optional description for the pipeline. @@ -1597,53 +964,6 @@ type PipelineJobPropertiesUpdate struct { State *PipelineJobState `json:"state,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PipelineJobPropertiesUpdate. -func (p PipelineJobPropertiesUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", p.Description) - populate(objectMap, "error", p.Error) - populateTimeRFC3339(objectMap, "expiration", p.Expiration) - populate(objectMap, "parameters", p.Parameters) - populate(objectMap, "state", p.State) - populate(objectMap, "topologyName", p.TopologyName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineJobPropertiesUpdate. -func (p *PipelineJobPropertiesUpdate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, &p.Description) - delete(rawMsg, key) - case "error": - err = unpopulate(val, &p.Error) - delete(rawMsg, key) - case "expiration": - err = unpopulateTimeRFC3339(val, &p.Expiration) - delete(rawMsg, key) - case "parameters": - err = unpopulate(val, &p.Parameters) - delete(rawMsg, key) - case "state": - err = unpopulate(val, &p.State) - delete(rawMsg, key) - case "topologyName": - err = unpopulate(val, &p.TopologyName) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // PipelineJobUpdate - Pipeline job represents a unique instance of a batch topology, used for offline processing of selected // portions of archived content. type PipelineJobUpdate struct { @@ -1663,20 +983,10 @@ type PipelineJobUpdate struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PipelineJobUpdate. -func (p PipelineJobUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - // PipelineJobsClientBeginCancelOptions contains the optional parameters for the PipelineJobsClient.BeginCancel method. type PipelineJobsClientBeginCancelOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // PipelineJobsClientCreateOrUpdateOptions contains the optional parameters for the PipelineJobsClient.CreateOrUpdate method. @@ -1783,14 +1093,6 @@ type PipelineTopologyCollection struct { Value []*PipelineTopology `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PipelineTopologyCollection. -func (p PipelineTopologyCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PipelineTopologyProperties - Describes the properties of a pipeline topology. type PipelineTopologyProperties struct { // REQUIRED; List of the topology sink nodes. Sink nodes allow pipeline data to be stored or exported. @@ -1812,49 +1114,6 @@ type PipelineTopologyProperties struct { Processors []ProcessorNodeBaseClassification `json:"processors,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PipelineTopologyProperties. -func (p PipelineTopologyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", p.Description) - populate(objectMap, "parameters", p.Parameters) - populate(objectMap, "processors", p.Processors) - populate(objectMap, "sinks", p.Sinks) - populate(objectMap, "sources", p.Sources) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineTopologyProperties. -func (p *PipelineTopologyProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, &p.Description) - delete(rawMsg, key) - case "parameters": - err = unpopulate(val, &p.Parameters) - delete(rawMsg, key) - case "processors": - p.Processors, err = unmarshalProcessorNodeBaseClassificationArray(val) - delete(rawMsg, key) - case "sinks": - p.Sinks, err = unmarshalSinkNodeBaseClassificationArray(val) - delete(rawMsg, key) - case "sources": - p.Sources, err = unmarshalSourceNodeBaseClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // PipelineTopologyPropertiesUpdate - Describes the properties of a pipeline topology. type PipelineTopologyPropertiesUpdate struct { // An optional description of the pipeline topology. It is recommended that the expected use of the topology to be described @@ -1876,49 +1135,6 @@ type PipelineTopologyPropertiesUpdate struct { Sources []SourceNodeBaseClassification `json:"sources,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PipelineTopologyPropertiesUpdate. -func (p PipelineTopologyPropertiesUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", p.Description) - populate(objectMap, "parameters", p.Parameters) - populate(objectMap, "processors", p.Processors) - populate(objectMap, "sinks", p.Sinks) - populate(objectMap, "sources", p.Sources) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineTopologyPropertiesUpdate. -func (p *PipelineTopologyPropertiesUpdate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, &p.Description) - delete(rawMsg, key) - case "parameters": - err = unpopulate(val, &p.Parameters) - delete(rawMsg, key) - case "processors": - p.Processors, err = unmarshalProcessorNodeBaseClassificationArray(val) - delete(rawMsg, key) - case "sinks": - p.Sinks, err = unmarshalSinkNodeBaseClassificationArray(val) - delete(rawMsg, key) - case "sources": - p.Sources, err = unmarshalSourceNodeBaseClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // PipelineTopologyUpdate - Pipeline topology describes the processing steps to be applied when processing content for a particular // outcome. The topology should be defined according to the scenario to be achieved and can be // reused across many pipeline instances which share the same processing characteristics. For instance, a pipeline topology @@ -1955,19 +1171,6 @@ type PipelineTopologyUpdate struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PipelineTopologyUpdate. -func (p PipelineTopologyUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "kind", p.Kind) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "sku", p.SKU) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - // PrivateEndpoint - The Private Endpoint resource. type PrivateEndpoint struct { // READ-ONLY; The ARM identifier for Private Endpoint @@ -1998,13 +1201,6 @@ type PrivateEndpointConnectionListResult struct { Value []*PrivateEndpointConnection `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. -func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PrivateEndpointConnectionOperationStatus - Status of private endpoint connection operation. type PrivateEndpointConnectionOperationStatus struct { // REQUIRED; Operation identifier. @@ -2098,13 +1294,6 @@ type PrivateLinkResourceListResult struct { Value []*PrivateLinkResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. -func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PrivateLinkResourceProperties - Properties of a private link resource. type PrivateLinkResourceProperties struct { // The private link resource Private link DNS zone name. @@ -2117,15 +1306,6 @@ type PrivateLinkResourceProperties struct { RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) - return json.Marshal(objectMap) -} - // PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. type PrivateLinkResourcesClientGetOptions struct { // placeholder for future optional parameters @@ -2171,52 +1351,6 @@ type ProcessorNodeBase struct { Type *string `json:"@type,omitempty"` } -// GetNodeBase implements the NodeBaseClassification interface for type ProcessorNodeBase. -func (p *ProcessorNodeBase) GetNodeBase() *NodeBase { - return &NodeBase{ - Type: p.Type, - Name: p.Name, - } -} - -// GetProcessorNodeBase implements the ProcessorNodeBaseClassification interface for type ProcessorNodeBase. -func (p *ProcessorNodeBase) GetProcessorNodeBase() *ProcessorNodeBase { return p } - -// MarshalJSON implements the json.Marshaller interface for type ProcessorNodeBase. -func (p ProcessorNodeBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "inputs", p.Inputs) - populate(objectMap, "name", p.Name) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.ProcessorNodeBase" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessorNodeBase. -func (p *ProcessorNodeBase) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "inputs": - err = unpopulate(val, &p.Inputs) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &p.Name) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &p.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // Properties - The properties of the Video Analyzer account. type Properties struct { // REQUIRED; The storage accounts for this resource. @@ -2244,20 +1378,6 @@ type Properties struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Properties. -func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "encryption", p.Encryption) - populate(objectMap, "endpoints", p.Endpoints) - populate(objectMap, "iotHubs", p.IotHubs) - populate(objectMap, "networkAccessControl", p.NetworkAccessControl) - populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) - populate(objectMap, "storageAccounts", p.StorageAccounts) - return json.Marshal(objectMap) -} - // PropertiesUpdate - The properties of the Video Analyzer account. type PropertiesUpdate struct { // The account encryption properties. @@ -2285,20 +1405,6 @@ type PropertiesUpdate struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PropertiesUpdate. -func (p PropertiesUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "encryption", p.Encryption) - populate(objectMap, "endpoints", p.Endpoints) - populate(objectMap, "iotHubs", p.IotHubs) - populate(objectMap, "networkAccessControl", p.NetworkAccessControl) - populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) - populate(objectMap, "storageAccounts", p.StorageAccounts) - return json.Marshal(objectMap) -} - // ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a // location type ProxyResource struct { @@ -2354,57 +1460,6 @@ type RsaTokenKey struct { Type *string `json:"@type,omitempty"` } -// GetTokenKey implements the TokenKeyClassification interface for type RsaTokenKey. -func (r *RsaTokenKey) GetTokenKey() *TokenKey { - return &TokenKey{ - Type: r.Type, - Kid: r.Kid, - } -} - -// MarshalJSON implements the json.Marshaller interface for type RsaTokenKey. -func (r RsaTokenKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alg", r.Alg) - populate(objectMap, "e", r.E) - populate(objectMap, "kid", r.Kid) - populate(objectMap, "n", r.N) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.RsaTokenKey" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RsaTokenKey. -func (r *RsaTokenKey) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "alg": - err = unpopulate(val, &r.Alg) - delete(rawMsg, key) - case "e": - err = unpopulate(val, &r.E) - delete(rawMsg, key) - case "kid": - err = unpopulate(val, &r.Kid) - delete(rawMsg, key) - case "n": - err = unpopulate(val, &r.N) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &r.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // RtspSource - RTSP source allows for media from an RTSP camera or generic RTSP server to be ingested into a pipeline. type RtspSource struct { // REQUIRED; RTSP endpoint information for Video Analyzer to connect to. This contains the required information for Video @@ -2423,61 +1478,6 @@ type RtspSource struct { Transport *RtspTransport `json:"transport,omitempty"` } -// GetNodeBase implements the NodeBaseClassification interface for type RtspSource. -func (r *RtspSource) GetNodeBase() *NodeBase { - return &NodeBase{ - Type: r.Type, - Name: r.Name, - } -} - -// GetSourceNodeBase implements the SourceNodeBaseClassification interface for type RtspSource. -func (r *RtspSource) GetSourceNodeBase() *SourceNodeBase { - return &SourceNodeBase{ - Type: r.Type, - Name: r.Name, - } -} - -// MarshalJSON implements the json.Marshaller interface for type RtspSource. -func (r RtspSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "endpoint", r.Endpoint) - populate(objectMap, "name", r.Name) - populate(objectMap, "transport", r.Transport) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.RtspSource" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RtspSource. -func (r *RtspSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - r.Endpoint, err = unmarshalEndpointBaseClassification(val) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &r.Name) - delete(rawMsg, key) - case "transport": - err = unpopulate(val, &r.Transport) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &r.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // SKU - The SKU details. type SKU struct { // REQUIRED; The SKU name. @@ -2499,48 +1499,6 @@ type SecureIotDeviceRemoteTunnel struct { Type *string `json:"@type,omitempty"` } -// GetTunnelBase implements the TunnelBaseClassification interface for type SecureIotDeviceRemoteTunnel. -func (s *SecureIotDeviceRemoteTunnel) GetTunnelBase() *TunnelBase { - return &TunnelBase{ - Type: s.Type, - } -} - -// MarshalJSON implements the json.Marshaller interface for type SecureIotDeviceRemoteTunnel. -func (s SecureIotDeviceRemoteTunnel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "deviceId", s.DeviceID) - populate(objectMap, "iotHubName", s.IotHubName) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.SecureIotDeviceRemoteTunnel" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecureIotDeviceRemoteTunnel. -func (s *SecureIotDeviceRemoteTunnel) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "deviceId": - err = unpopulate(val, &s.DeviceID) - delete(rawMsg, key) - case "iotHubName": - err = unpopulate(val, &s.IotHubName) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &s.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ServiceSpecification - The service metric specifications. type ServiceSpecification struct { // READ-ONLY; List of log specifications. @@ -2550,14 +1508,6 @@ type ServiceSpecification struct { MetricSpecifications []*MetricSpecification `json:"metricSpecifications,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. -func (s ServiceSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "logSpecifications", s.LogSpecifications) - populate(objectMap, "metricSpecifications", s.MetricSpecifications) - return json.Marshal(objectMap) -} - // SinkNodeBaseClassification provides polymorphic access to related types. // Call the interface's GetSinkNodeBase() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -2580,52 +1530,6 @@ type SinkNodeBase struct { Type *string `json:"@type,omitempty"` } -// GetNodeBase implements the NodeBaseClassification interface for type SinkNodeBase. -func (s *SinkNodeBase) GetNodeBase() *NodeBase { - return &NodeBase{ - Type: s.Type, - Name: s.Name, - } -} - -// GetSinkNodeBase implements the SinkNodeBaseClassification interface for type SinkNodeBase. -func (s *SinkNodeBase) GetSinkNodeBase() *SinkNodeBase { return s } - -// MarshalJSON implements the json.Marshaller interface for type SinkNodeBase. -func (s SinkNodeBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "inputs", s.Inputs) - populate(objectMap, "name", s.Name) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.SinkNodeBase" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SinkNodeBase. -func (s *SinkNodeBase) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "inputs": - err = unpopulate(val, &s.Inputs) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &s.Name) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &s.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // SourceNodeBaseClassification provides polymorphic access to related types. // Call the interface's GetSourceNodeBase() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -2645,48 +1549,6 @@ type SourceNodeBase struct { Type *string `json:"@type,omitempty"` } -// GetNodeBase implements the NodeBaseClassification interface for type SourceNodeBase. -func (s *SourceNodeBase) GetNodeBase() *NodeBase { - return &NodeBase{ - Type: s.Type, - Name: s.Name, - } -} - -// GetSourceNodeBase implements the SourceNodeBaseClassification interface for type SourceNodeBase. -func (s *SourceNodeBase) GetSourceNodeBase() *SourceNodeBase { return s } - -// MarshalJSON implements the json.Marshaller interface for type SourceNodeBase. -func (s SourceNodeBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", s.Name) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.SourceNodeBase" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SourceNodeBase. -func (s *SourceNodeBase) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, &s.Name) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &s.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // StorageAccount - The details about the associated storage account. type StorageAccount struct { // REQUIRED; The ID of the storage account resource. Video Analyzer relies on tables, queues, and blobs. The primary storage @@ -2722,53 +1584,6 @@ type SystemData struct { LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // TLSEndpoint - TLS endpoint describes an endpoint that the pipeline can connect to over TLS transport (data is encrypted // in transit). type TLSEndpoint struct { @@ -2793,63 +1608,6 @@ type TLSEndpoint struct { ValidationOptions *TLSValidationOptions `json:"validationOptions,omitempty"` } -// GetEndpointBase implements the EndpointBaseClassification interface for type TLSEndpoint. -func (t *TLSEndpoint) GetEndpointBase() *EndpointBase { - return &EndpointBase{ - Type: t.Type, - Credentials: t.Credentials, - URL: t.URL, - Tunnel: t.Tunnel, - } -} - -// MarshalJSON implements the json.Marshaller interface for type TLSEndpoint. -func (t TLSEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "credentials", t.Credentials) - populate(objectMap, "trustedCertificates", t.TrustedCertificates) - populate(objectMap, "tunnel", t.Tunnel) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.TlsEndpoint" - populate(objectMap, "url", t.URL) - populate(objectMap, "validationOptions", t.ValidationOptions) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TLSEndpoint. -func (t *TLSEndpoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "credentials": - t.Credentials, err = unmarshalCredentialsBaseClassification(val) - delete(rawMsg, key) - case "trustedCertificates": - t.TrustedCertificates, err = unmarshalCertificateSourceClassification(val) - delete(rawMsg, key) - case "tunnel": - t.Tunnel, err = unmarshalTunnelBaseClassification(val) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &t.Type) - delete(rawMsg, key) - case "url": - err = unpopulate(val, &t.URL) - delete(rawMsg, key) - case "validationOptions": - err = unpopulate(val, &t.ValidationOptions) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // TLSValidationOptions - Options for controlling the validation of TLS endpoints. type TLSValidationOptions struct { // When set to 'true' causes the certificate subject name validation to be skipped. Default is 'false'. @@ -2874,9 +1632,6 @@ type TimeSequenceBase struct { Type *string `json:"@type,omitempty"` } -// GetTimeSequenceBase implements the TimeSequenceBaseClassification interface for type TimeSequenceBase. -func (t *TimeSequenceBase) GetTimeSequenceBase() *TimeSequenceBase { return t } - // TokenClaim - Properties for expected token claims. type TokenClaim struct { // REQUIRED; Name of the claim which must be present on the token. @@ -2904,9 +1659,6 @@ type TokenKey struct { Type *string `json:"@type,omitempty"` } -// GetTokenKey implements the TokenKeyClassification interface for type TokenKey. -func (t *TokenKey) GetTokenKey() *TokenKey { return t } - // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { @@ -2929,18 +1681,6 @@ type TrackedResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - // TunnelBaseClassification provides polymorphic access to related types. // Call the interface's GetTunnelBase() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -2956,9 +1696,6 @@ type TunnelBase struct { Type *string `json:"@type,omitempty"` } -// GetTunnelBase implements the TunnelBaseClassification interface for type TunnelBase. -func (t *TunnelBase) GetTunnelBase() *TunnelBase { return t } - // UnsecuredEndpoint - Unsecured endpoint describes an endpoint that the pipeline can connect to over clear transport (no // encryption in transit). type UnsecuredEndpoint struct { @@ -2976,55 +1713,6 @@ type UnsecuredEndpoint struct { Tunnel TunnelBaseClassification `json:"tunnel,omitempty"` } -// GetEndpointBase implements the EndpointBaseClassification interface for type UnsecuredEndpoint. -func (u *UnsecuredEndpoint) GetEndpointBase() *EndpointBase { - return &EndpointBase{ - Type: u.Type, - Credentials: u.Credentials, - URL: u.URL, - Tunnel: u.Tunnel, - } -} - -// MarshalJSON implements the json.Marshaller interface for type UnsecuredEndpoint. -func (u UnsecuredEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "credentials", u.Credentials) - populate(objectMap, "tunnel", u.Tunnel) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.UnsecuredEndpoint" - populate(objectMap, "url", u.URL) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UnsecuredEndpoint. -func (u *UnsecuredEndpoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "credentials": - u.Credentials, err = unmarshalCredentialsBaseClassification(val) - delete(rawMsg, key) - case "tunnel": - u.Tunnel, err = unmarshalTunnelBaseClassification(val) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &u.Type) - delete(rawMsg, key) - case "url": - err = unpopulate(val, &u.URL) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // Update - The update operation for a Video Analyzer account. type Update struct { // The identities associated to the Video Analyzer resource. @@ -3037,15 +1725,6 @@ type Update struct { Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type Update. -func (u Update) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", u.Identity) - populate(objectMap, "properties", u.Properties) - populate(objectMap, "tags", u.Tags) - return json.Marshal(objectMap) -} - // UserAssignedManagedIdentity - The details of the user assigned managed identity used by the Video Analyzer resource. type UserAssignedManagedIdentity struct { // READ-ONLY; The client ID. @@ -3069,48 +1748,6 @@ type UsernamePasswordCredentials struct { Username *string `json:"username,omitempty"` } -// GetCredentialsBase implements the CredentialsBaseClassification interface for type UsernamePasswordCredentials. -func (u *UsernamePasswordCredentials) GetCredentialsBase() *CredentialsBase { - return &CredentialsBase{ - Type: u.Type, - } -} - -// MarshalJSON implements the json.Marshaller interface for type UsernamePasswordCredentials. -func (u UsernamePasswordCredentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "password", u.Password) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.UsernamePasswordCredentials" - populate(objectMap, "username", u.Username) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UsernamePasswordCredentials. -func (u *UsernamePasswordCredentials) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "password": - err = unpopulate(val, &u.Password) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &u.Type) - delete(rawMsg, key) - case "username": - err = unpopulate(val, &u.Username) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // VideoAnalyzer - The Video Analyzer account. type VideoAnalyzer struct { // REQUIRED; The geo-location where the resource lives @@ -3138,29 +1775,17 @@ type VideoAnalyzer struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type VideoAnalyzer. -func (v VideoAnalyzer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", v.ID) - populate(objectMap, "identity", v.Identity) - populate(objectMap, "location", v.Location) - populate(objectMap, "name", v.Name) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "systemData", v.SystemData) - populate(objectMap, "tags", v.Tags) - populate(objectMap, "type", v.Type) - return json.Marshal(objectMap) -} - // VideoAnalyzersClientBeginCreateOrUpdateOptions contains the optional parameters for the VideoAnalyzersClient.BeginCreateOrUpdate // method. type VideoAnalyzersClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // VideoAnalyzersClientBeginUpdateOptions contains the optional parameters for the VideoAnalyzersClient.BeginUpdate method. type VideoAnalyzersClientBeginUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // VideoAnalyzersClientDeleteOptions contains the optional parameters for the VideoAnalyzersClient.Delete method. @@ -3204,37 +1829,6 @@ type VideoContentToken struct { Token *string `json:"token,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type VideoContentToken. -func (v VideoContentToken) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "expirationDate", v.ExpirationDate) - populate(objectMap, "token", v.Token) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VideoContentToken. -func (v *VideoContentToken) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "expirationDate": - err = unpopulateTimeRFC3339(val, &v.ExpirationDate) - delete(rawMsg, key) - case "token": - err = unpopulate(val, &v.Token) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // VideoContentUrls - Set of URLs to the video content. type VideoContentUrls struct { // Video archive streaming base URL. The archived content can be automatically played by the Azure Video Analyzer player widget. @@ -3316,9 +1910,6 @@ type VideoEncoderBase struct { Scale *VideoScale `json:"scale,omitempty"` } -// GetVideoEncoderBase implements the VideoEncoderBaseClassification interface for type VideoEncoderBase. -func (v *VideoEncoderBase) GetVideoEncoderBase() *VideoEncoderBase { return v } - // VideoEncoderH264 - A custom preset for encoding video with the H.264 (AVC) codec. type VideoEncoderH264 struct { // REQUIRED; The discriminator for derived types. @@ -3336,55 +1927,6 @@ type VideoEncoderH264 struct { Scale *VideoScale `json:"scale,omitempty"` } -// GetVideoEncoderBase implements the VideoEncoderBaseClassification interface for type VideoEncoderH264. -func (v *VideoEncoderH264) GetVideoEncoderBase() *VideoEncoderBase { - return &VideoEncoderBase{ - Type: v.Type, - BitrateKbps: v.BitrateKbps, - FrameRate: v.FrameRate, - Scale: v.Scale, - } -} - -// MarshalJSON implements the json.Marshaller interface for type VideoEncoderH264. -func (v VideoEncoderH264) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "bitrateKbps", v.BitrateKbps) - populate(objectMap, "frameRate", v.FrameRate) - populate(objectMap, "scale", v.Scale) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.VideoEncoderH264" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VideoEncoderH264. -func (v *VideoEncoderH264) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "bitrateKbps": - err = unpopulate(val, &v.BitrateKbps) - delete(rawMsg, key) - case "frameRate": - err = unpopulate(val, &v.FrameRate) - delete(rawMsg, key) - case "scale": - err = unpopulate(val, &v.Scale) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &v.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // VideoEntity - Represents a video resource within Azure Video Analyzer. Videos can be ingested from RTSP cameras through // live pipelines or can be created by exporting sequences from existing captured video through a // pipeline job. Videos ingested through live pipelines can be streamed through Azure Video Analyzer Player Widget or compatible @@ -3406,17 +1948,6 @@ type VideoEntity struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type VideoEntity. -func (v VideoEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", v.ID) - populate(objectMap, "name", v.Name) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "systemData", v.SystemData) - populate(objectMap, "type", v.Type) - return json.Marshal(objectMap) -} - // VideoEntityCollection - A collection of VideoEntity items. type VideoEntityCollection struct { // A link to the next page of the collection (when the collection contains too many results to return in one response). @@ -3426,14 +1957,6 @@ type VideoEntityCollection struct { Value []*VideoEntity `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type VideoEntityCollection. -func (v VideoEntityCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "@nextLink", v.NextLink) - populate(objectMap, "value", v.Value) - return json.Marshal(objectMap) -} - // VideoFlags - Video flags contain information about the available video actions and its dynamic properties based on the // current video state. type VideoFlags struct { @@ -3538,44 +2061,6 @@ type VideoSequenceAbsoluteTimeMarkers struct { Type *string `json:"@type,omitempty"` } -// GetTimeSequenceBase implements the TimeSequenceBaseClassification interface for type VideoSequenceAbsoluteTimeMarkers. -func (v *VideoSequenceAbsoluteTimeMarkers) GetTimeSequenceBase() *TimeSequenceBase { - return &TimeSequenceBase{ - Type: v.Type, - } -} - -// MarshalJSON implements the json.Marshaller interface for type VideoSequenceAbsoluteTimeMarkers. -func (v VideoSequenceAbsoluteTimeMarkers) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "ranges", v.Ranges) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.VideoSequenceAbsoluteTimeMarkers" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VideoSequenceAbsoluteTimeMarkers. -func (v *VideoSequenceAbsoluteTimeMarkers) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "ranges": - err = unpopulate(val, &v.Ranges) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &v.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // VideoSink - Video sink in a live topology allows for video and audio to be captured, optionally archived, and published // via a video resource. If archiving is enabled, this results in a video of type 'archive'. If // used in a batch topology, this allows for video and audio to be stored as a file, and published via a video resource of @@ -3602,70 +2087,6 @@ type VideoSink struct { VideoPublishingOptions *VideoPublishingOptions `json:"videoPublishingOptions,omitempty"` } -// GetNodeBase implements the NodeBaseClassification interface for type VideoSink. -func (v *VideoSink) GetNodeBase() *NodeBase { - return &NodeBase{ - Type: v.Type, - Name: v.Name, - } -} - -// GetSinkNodeBase implements the SinkNodeBaseClassification interface for type VideoSink. -func (v *VideoSink) GetSinkNodeBase() *SinkNodeBase { - return &SinkNodeBase{ - Inputs: v.Inputs, - Type: v.Type, - Name: v.Name, - } -} - -// MarshalJSON implements the json.Marshaller interface for type VideoSink. -func (v VideoSink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "inputs", v.Inputs) - populate(objectMap, "name", v.Name) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.VideoSink" - populate(objectMap, "videoCreationProperties", v.VideoCreationProperties) - populate(objectMap, "videoName", v.VideoName) - populate(objectMap, "videoPublishingOptions", v.VideoPublishingOptions) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VideoSink. -func (v *VideoSink) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "inputs": - err = unpopulate(val, &v.Inputs) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &v.Name) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &v.Type) - delete(rawMsg, key) - case "videoCreationProperties": - err = unpopulate(val, &v.VideoCreationProperties) - delete(rawMsg, key) - case "videoName": - err = unpopulate(val, &v.VideoName) - delete(rawMsg, key) - case "videoPublishingOptions": - err = unpopulate(val, &v.VideoPublishingOptions) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // VideoSource - Video source allows for content from a Video Analyzer video resource to be ingested into a pipeline. Currently // supported only with batch pipelines. type VideoSource struct { @@ -3682,61 +2103,6 @@ type VideoSource struct { VideoName *string `json:"videoName,omitempty"` } -// GetNodeBase implements the NodeBaseClassification interface for type VideoSource. -func (v *VideoSource) GetNodeBase() *NodeBase { - return &NodeBase{ - Type: v.Type, - Name: v.Name, - } -} - -// GetSourceNodeBase implements the SourceNodeBaseClassification interface for type VideoSource. -func (v *VideoSource) GetSourceNodeBase() *SourceNodeBase { - return &SourceNodeBase{ - Type: v.Type, - Name: v.Name, - } -} - -// MarshalJSON implements the json.Marshaller interface for type VideoSource. -func (v VideoSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", v.Name) - populate(objectMap, "timeSequences", v.TimeSequences) - objectMap["@type"] = "#Microsoft.VideoAnalyzer.VideoSource" - populate(objectMap, "videoName", v.VideoName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VideoSource. -func (v *VideoSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, &v.Name) - delete(rawMsg, key) - case "timeSequences": - v.TimeSequences, err = unmarshalTimeSequenceBaseClassification(val) - delete(rawMsg, key) - case "@type": - err = unpopulate(val, &v.Type) - delete(rawMsg, key) - case "videoName": - err = unpopulate(val, &v.VideoName) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // VideosClientCreateOrUpdateOptions contains the optional parameters for the VideosClient.CreateOrUpdate method. type VideosClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -3768,20 +2134,3 @@ type VideosClientListOptions struct { type VideosClientUpdateOptions struct { // placeholder for future optional parameters } - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_models_serde.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_models_serde.go new file mode 100644 index 000000000000..f75eb822a8e0 --- /dev/null +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_models_serde.go @@ -0,0 +1,1673 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armvideoanalyzer + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AccessPolicyEntity. +func (a AccessPolicyEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AccessPolicyEntityCollection. +func (a AccessPolicyEntityCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AccessPolicyProperties. +func (a AccessPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authentication", a.Authentication) + populate(objectMap, "role", a.Role) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessPolicyProperties. +func (a *AccessPolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "authentication": + a.Authentication, err = unmarshalAuthenticationBaseClassification(val) + delete(rawMsg, key) + case "role": + err = unpopulate(val, &a.Role) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetAudioEncoderBase implements the AudioEncoderBaseClassification interface for type AudioEncoderAac. +func (a *AudioEncoderAac) GetAudioEncoderBase() *AudioEncoderBase { + return &AudioEncoderBase{ + Type: a.Type, + BitrateKbps: a.BitrateKbps, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AudioEncoderAac. +func (a AudioEncoderAac) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bitrateKbps", a.BitrateKbps) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.AudioEncoderAac" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AudioEncoderAac. +func (a *AudioEncoderAac) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "bitrateKbps": + err = unpopulate(val, &a.BitrateKbps) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &a.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetAudioEncoderBase implements the AudioEncoderBaseClassification interface for type AudioEncoderBase. +func (a *AudioEncoderBase) GetAudioEncoderBase() *AudioEncoderBase { return a } + +// GetAuthenticationBase implements the AuthenticationBaseClassification interface for type AuthenticationBase. +func (a *AuthenticationBase) GetAuthenticationBase() *AuthenticationBase { return a } + +// GetCertificateSource implements the CertificateSourceClassification interface for type CertificateSource. +func (c *CertificateSource) GetCertificateSource() *CertificateSource { return c } + +// MarshalJSON implements the json.Marshaller interface for type Collection. +func (c Collection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// GetCredentialsBase implements the CredentialsBaseClassification interface for type CredentialsBase. +func (c *CredentialsBase) GetCredentialsBase() *CredentialsBase { return c } + +// GetTokenKey implements the TokenKeyClassification interface for type EccTokenKey. +func (e *EccTokenKey) GetTokenKey() *TokenKey { + return &TokenKey{ + Type: e.Type, + Kid: e.Kid, + } +} + +// MarshalJSON implements the json.Marshaller interface for type EccTokenKey. +func (e EccTokenKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alg", e.Alg) + populate(objectMap, "kid", e.Kid) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.EccTokenKey" + populate(objectMap, "x", e.X) + populate(objectMap, "y", e.Y) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EccTokenKey. +func (e *EccTokenKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "alg": + err = unpopulate(val, &e.Alg) + delete(rawMsg, key) + case "kid": + err = unpopulate(val, &e.Kid) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &e.Type) + delete(rawMsg, key) + case "x": + err = unpopulate(val, &e.X) + delete(rawMsg, key) + case "y": + err = unpopulate(val, &e.Y) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EdgeModuleEntityCollection. +func (e EdgeModuleEntityCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type EdgeModuleProvisioningToken. +func (e EdgeModuleProvisioningToken) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "expirationDate", e.ExpirationDate) + populate(objectMap, "token", e.Token) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EdgeModuleProvisioningToken. +func (e *EdgeModuleProvisioningToken) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "expirationDate": + err = unpopulateTimeRFC3339(val, &e.ExpirationDate) + delete(rawMsg, key) + case "token": + err = unpopulate(val, &e.Token) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetEncoderPresetBase implements the EncoderPresetBaseClassification interface for type EncoderCustomPreset. +func (e *EncoderCustomPreset) GetEncoderPresetBase() *EncoderPresetBase { + return &EncoderPresetBase{ + Type: e.Type, + } +} + +// MarshalJSON implements the json.Marshaller interface for type EncoderCustomPreset. +func (e EncoderCustomPreset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "audioEncoder", e.AudioEncoder) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.EncoderCustomPreset" + populate(objectMap, "videoEncoder", e.VideoEncoder) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncoderCustomPreset. +func (e *EncoderCustomPreset) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "audioEncoder": + e.AudioEncoder, err = unmarshalAudioEncoderBaseClassification(val) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &e.Type) + delete(rawMsg, key) + case "videoEncoder": + e.VideoEncoder, err = unmarshalVideoEncoderBaseClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetEncoderPresetBase implements the EncoderPresetBaseClassification interface for type EncoderPresetBase. +func (e *EncoderPresetBase) GetEncoderPresetBase() *EncoderPresetBase { return e } + +// GetNodeBase implements the NodeBaseClassification interface for type EncoderProcessor. +func (e *EncoderProcessor) GetNodeBase() *NodeBase { + return &NodeBase{ + Type: e.Type, + Name: e.Name, + } +} + +// GetProcessorNodeBase implements the ProcessorNodeBaseClassification interface for type EncoderProcessor. +func (e *EncoderProcessor) GetProcessorNodeBase() *ProcessorNodeBase { + return &ProcessorNodeBase{ + Inputs: e.Inputs, + Type: e.Type, + Name: e.Name, + } +} + +// MarshalJSON implements the json.Marshaller interface for type EncoderProcessor. +func (e EncoderProcessor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inputs", e.Inputs) + populate(objectMap, "name", e.Name) + populate(objectMap, "preset", e.Preset) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.EncoderProcessor" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncoderProcessor. +func (e *EncoderProcessor) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "inputs": + err = unpopulate(val, &e.Inputs) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &e.Name) + delete(rawMsg, key) + case "preset": + e.Preset, err = unmarshalEncoderPresetBaseClassification(val) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &e.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetEncoderPresetBase implements the EncoderPresetBaseClassification interface for type EncoderSystemPreset. +func (e *EncoderSystemPreset) GetEncoderPresetBase() *EncoderPresetBase { + return &EncoderPresetBase{ + Type: e.Type, + } +} + +// MarshalJSON implements the json.Marshaller interface for type EncoderSystemPreset. +func (e EncoderSystemPreset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", e.Name) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.EncoderSystemPreset" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncoderSystemPreset. +func (e *EncoderSystemPreset) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, &e.Name) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &e.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetEndpointBase implements the EndpointBaseClassification interface for type EndpointBase. +func (e *EndpointBase) GetEndpointBase() *EndpointBase { return e } + +// MarshalJSON implements the json.Marshaller interface for type EndpointBase. +func (e EndpointBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "credentials", e.Credentials) + populate(objectMap, "tunnel", e.Tunnel) + objectMap["@type"] = e.Type + populate(objectMap, "url", e.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointBase. +func (e *EndpointBase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "credentials": + e.Credentials, err = unmarshalCredentialsBaseClassification(val) + delete(rawMsg, key) + case "tunnel": + e.Tunnel, err = unmarshalTunnelBaseClassification(val) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &e.Type) + delete(rawMsg, key) + case "url": + err = unpopulate(val, &e.URL) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// GetAuthenticationBase implements the AuthenticationBaseClassification interface for type JwtAuthentication. +func (j *JwtAuthentication) GetAuthenticationBase() *AuthenticationBase { + return &AuthenticationBase{ + Type: j.Type, + } +} + +// MarshalJSON implements the json.Marshaller interface for type JwtAuthentication. +func (j JwtAuthentication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "audiences", j.Audiences) + populate(objectMap, "claims", j.Claims) + populate(objectMap, "issuers", j.Issuers) + populate(objectMap, "keys", j.Keys) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.JwtAuthentication" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JwtAuthentication. +func (j *JwtAuthentication) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "audiences": + err = unpopulate(val, &j.Audiences) + delete(rawMsg, key) + case "claims": + err = unpopulate(val, &j.Claims) + delete(rawMsg, key) + case "issuers": + err = unpopulate(val, &j.Issuers) + delete(rawMsg, key) + case "keys": + j.Keys, err = unmarshalTokenKeyClassificationArray(val) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &j.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListProvisioningTokenInput. +func (l ListProvisioningTokenInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "expirationDate", l.ExpirationDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListProvisioningTokenInput. +func (l *ListProvisioningTokenInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "expirationDate": + err = unpopulateTimeRFC3339(val, &l.ExpirationDate) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LivePipelineCollection. +func (l LivePipelineCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type LivePipelineProperties. +func (l LivePipelineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bitrateKbps", l.BitrateKbps) + populate(objectMap, "description", l.Description) + populate(objectMap, "parameters", l.Parameters) + populate(objectMap, "state", l.State) + populate(objectMap, "topologyName", l.TopologyName) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type LivePipelinePropertiesUpdate. +func (l LivePipelinePropertiesUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bitrateKbps", l.BitrateKbps) + populate(objectMap, "description", l.Description) + populate(objectMap, "parameters", l.Parameters) + populate(objectMap, "state", l.State) + populate(objectMap, "topologyName", l.TopologyName) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type LivePipelineUpdate. +func (l LivePipelineUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. +func (m MetricSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "enableRegionalMdmAccount", m.EnableRegionalMdmAccount) + populate(objectMap, "lockAggregationType", m.LockAggregationType) + populate(objectMap, "name", m.Name) + populate(objectMap, "sourceMdmAccount", m.SourceMdmAccount) + populate(objectMap, "sourceMdmNamespace", m.SourceMdmNamespace) + populate(objectMap, "supportedAggregationTypes", m.SupportedAggregationTypes) + populate(objectMap, "supportedTimeGrainTypes", m.SupportedTimeGrainTypes) + populate(objectMap, "unit", m.Unit) + return json.Marshal(objectMap) +} + +// GetNodeBase implements the NodeBaseClassification interface for type NodeBase. +func (n *NodeBase) GetNodeBase() *NodeBase { return n } + +// MarshalJSON implements the json.Marshaller interface for type OperationCollection. +func (o OperationCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// GetCertificateSource implements the CertificateSourceClassification interface for type PemCertificateList. +func (p *PemCertificateList) GetCertificateSource() *CertificateSource { + return &CertificateSource{ + Type: p.Type, + } +} + +// MarshalJSON implements the json.Marshaller interface for type PemCertificateList. +func (p PemCertificateList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificates", p.Certificates) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.PemCertificateList" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PemCertificateList. +func (p *PemCertificateList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "certificates": + err = unpopulate(val, &p.Certificates) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &p.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PipelineJobCollection. +func (p PipelineJobCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PipelineJobProperties. +func (p PipelineJobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", p.Description) + populate(objectMap, "error", p.Error) + populateTimeRFC3339(objectMap, "expiration", p.Expiration) + populate(objectMap, "parameters", p.Parameters) + populate(objectMap, "state", p.State) + populate(objectMap, "topologyName", p.TopologyName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineJobProperties. +func (p *PipelineJobProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, &p.Description) + delete(rawMsg, key) + case "error": + err = unpopulate(val, &p.Error) + delete(rawMsg, key) + case "expiration": + err = unpopulateTimeRFC3339(val, &p.Expiration) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, &p.Parameters) + delete(rawMsg, key) + case "state": + err = unpopulate(val, &p.State) + delete(rawMsg, key) + case "topologyName": + err = unpopulate(val, &p.TopologyName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PipelineJobPropertiesUpdate. +func (p PipelineJobPropertiesUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", p.Description) + populate(objectMap, "error", p.Error) + populateTimeRFC3339(objectMap, "expiration", p.Expiration) + populate(objectMap, "parameters", p.Parameters) + populate(objectMap, "state", p.State) + populate(objectMap, "topologyName", p.TopologyName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineJobPropertiesUpdate. +func (p *PipelineJobPropertiesUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, &p.Description) + delete(rawMsg, key) + case "error": + err = unpopulate(val, &p.Error) + delete(rawMsg, key) + case "expiration": + err = unpopulateTimeRFC3339(val, &p.Expiration) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, &p.Parameters) + delete(rawMsg, key) + case "state": + err = unpopulate(val, &p.State) + delete(rawMsg, key) + case "topologyName": + err = unpopulate(val, &p.TopologyName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PipelineJobUpdate. +func (p PipelineJobUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PipelineTopologyCollection. +func (p PipelineTopologyCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PipelineTopologyProperties. +func (p PipelineTopologyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", p.Description) + populate(objectMap, "parameters", p.Parameters) + populate(objectMap, "processors", p.Processors) + populate(objectMap, "sinks", p.Sinks) + populate(objectMap, "sources", p.Sources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineTopologyProperties. +func (p *PipelineTopologyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, &p.Description) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, &p.Parameters) + delete(rawMsg, key) + case "processors": + p.Processors, err = unmarshalProcessorNodeBaseClassificationArray(val) + delete(rawMsg, key) + case "sinks": + p.Sinks, err = unmarshalSinkNodeBaseClassificationArray(val) + delete(rawMsg, key) + case "sources": + p.Sources, err = unmarshalSourceNodeBaseClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PipelineTopologyPropertiesUpdate. +func (p PipelineTopologyPropertiesUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", p.Description) + populate(objectMap, "parameters", p.Parameters) + populate(objectMap, "processors", p.Processors) + populate(objectMap, "sinks", p.Sinks) + populate(objectMap, "sources", p.Sources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineTopologyPropertiesUpdate. +func (p *PipelineTopologyPropertiesUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, &p.Description) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, &p.Parameters) + delete(rawMsg, key) + case "processors": + p.Processors, err = unmarshalProcessorNodeBaseClassificationArray(val) + delete(rawMsg, key) + case "sinks": + p.Sinks, err = unmarshalSinkNodeBaseClassificationArray(val) + delete(rawMsg, key) + case "sources": + p.Sources, err = unmarshalSourceNodeBaseClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PipelineTopologyUpdate. +func (p PipelineTopologyUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "kind", p.Kind) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "sku", p.SKU) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// GetNodeBase implements the NodeBaseClassification interface for type ProcessorNodeBase. +func (p *ProcessorNodeBase) GetNodeBase() *NodeBase { + return &NodeBase{ + Type: p.Type, + Name: p.Name, + } +} + +// GetProcessorNodeBase implements the ProcessorNodeBaseClassification interface for type ProcessorNodeBase. +func (p *ProcessorNodeBase) GetProcessorNodeBase() *ProcessorNodeBase { return p } + +// MarshalJSON implements the json.Marshaller interface for type ProcessorNodeBase. +func (p ProcessorNodeBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inputs", p.Inputs) + populate(objectMap, "name", p.Name) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.ProcessorNodeBase" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessorNodeBase. +func (p *ProcessorNodeBase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "inputs": + err = unpopulate(val, &p.Inputs) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &p.Name) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &p.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encryption", p.Encryption) + populate(objectMap, "endpoints", p.Endpoints) + populate(objectMap, "iotHubs", p.IotHubs) + populate(objectMap, "networkAccessControl", p.NetworkAccessControl) + populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) + populate(objectMap, "storageAccounts", p.StorageAccounts) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PropertiesUpdate. +func (p PropertiesUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encryption", p.Encryption) + populate(objectMap, "endpoints", p.Endpoints) + populate(objectMap, "iotHubs", p.IotHubs) + populate(objectMap, "networkAccessControl", p.NetworkAccessControl) + populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) + populate(objectMap, "storageAccounts", p.StorageAccounts) + return json.Marshal(objectMap) +} + +// GetTokenKey implements the TokenKeyClassification interface for type RsaTokenKey. +func (r *RsaTokenKey) GetTokenKey() *TokenKey { + return &TokenKey{ + Type: r.Type, + Kid: r.Kid, + } +} + +// MarshalJSON implements the json.Marshaller interface for type RsaTokenKey. +func (r RsaTokenKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alg", r.Alg) + populate(objectMap, "e", r.E) + populate(objectMap, "kid", r.Kid) + populate(objectMap, "n", r.N) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.RsaTokenKey" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RsaTokenKey. +func (r *RsaTokenKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "alg": + err = unpopulate(val, &r.Alg) + delete(rawMsg, key) + case "e": + err = unpopulate(val, &r.E) + delete(rawMsg, key) + case "kid": + err = unpopulate(val, &r.Kid) + delete(rawMsg, key) + case "n": + err = unpopulate(val, &r.N) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &r.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetNodeBase implements the NodeBaseClassification interface for type RtspSource. +func (r *RtspSource) GetNodeBase() *NodeBase { + return &NodeBase{ + Type: r.Type, + Name: r.Name, + } +} + +// GetSourceNodeBase implements the SourceNodeBaseClassification interface for type RtspSource. +func (r *RtspSource) GetSourceNodeBase() *SourceNodeBase { + return &SourceNodeBase{ + Type: r.Type, + Name: r.Name, + } +} + +// MarshalJSON implements the json.Marshaller interface for type RtspSource. +func (r RtspSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpoint", r.Endpoint) + populate(objectMap, "name", r.Name) + populate(objectMap, "transport", r.Transport) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.RtspSource" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RtspSource. +func (r *RtspSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "endpoint": + r.Endpoint, err = unmarshalEndpointBaseClassification(val) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &r.Name) + delete(rawMsg, key) + case "transport": + err = unpopulate(val, &r.Transport) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &r.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetTunnelBase implements the TunnelBaseClassification interface for type SecureIotDeviceRemoteTunnel. +func (s *SecureIotDeviceRemoteTunnel) GetTunnelBase() *TunnelBase { + return &TunnelBase{ + Type: s.Type, + } +} + +// MarshalJSON implements the json.Marshaller interface for type SecureIotDeviceRemoteTunnel. +func (s SecureIotDeviceRemoteTunnel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deviceId", s.DeviceID) + populate(objectMap, "iotHubName", s.IotHubName) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.SecureIotDeviceRemoteTunnel" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecureIotDeviceRemoteTunnel. +func (s *SecureIotDeviceRemoteTunnel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "deviceId": + err = unpopulate(val, &s.DeviceID) + delete(rawMsg, key) + case "iotHubName": + err = unpopulate(val, &s.IotHubName) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &s.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. +func (s ServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logSpecifications", s.LogSpecifications) + populate(objectMap, "metricSpecifications", s.MetricSpecifications) + return json.Marshal(objectMap) +} + +// GetNodeBase implements the NodeBaseClassification interface for type SinkNodeBase. +func (s *SinkNodeBase) GetNodeBase() *NodeBase { + return &NodeBase{ + Type: s.Type, + Name: s.Name, + } +} + +// GetSinkNodeBase implements the SinkNodeBaseClassification interface for type SinkNodeBase. +func (s *SinkNodeBase) GetSinkNodeBase() *SinkNodeBase { return s } + +// MarshalJSON implements the json.Marshaller interface for type SinkNodeBase. +func (s SinkNodeBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inputs", s.Inputs) + populate(objectMap, "name", s.Name) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.SinkNodeBase" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SinkNodeBase. +func (s *SinkNodeBase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "inputs": + err = unpopulate(val, &s.Inputs) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &s.Name) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &s.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetNodeBase implements the NodeBaseClassification interface for type SourceNodeBase. +func (s *SourceNodeBase) GetNodeBase() *NodeBase { + return &NodeBase{ + Type: s.Type, + Name: s.Name, + } +} + +// GetSourceNodeBase implements the SourceNodeBaseClassification interface for type SourceNodeBase. +func (s *SourceNodeBase) GetSourceNodeBase() *SourceNodeBase { return s } + +// MarshalJSON implements the json.Marshaller interface for type SourceNodeBase. +func (s SourceNodeBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.SourceNodeBase" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceNodeBase. +func (s *SourceNodeBase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, &s.Name) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &s.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetEndpointBase implements the EndpointBaseClassification interface for type TLSEndpoint. +func (t *TLSEndpoint) GetEndpointBase() *EndpointBase { + return &EndpointBase{ + Type: t.Type, + Credentials: t.Credentials, + URL: t.URL, + Tunnel: t.Tunnel, + } +} + +// MarshalJSON implements the json.Marshaller interface for type TLSEndpoint. +func (t TLSEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "credentials", t.Credentials) + populate(objectMap, "trustedCertificates", t.TrustedCertificates) + populate(objectMap, "tunnel", t.Tunnel) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.TlsEndpoint" + populate(objectMap, "url", t.URL) + populate(objectMap, "validationOptions", t.ValidationOptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TLSEndpoint. +func (t *TLSEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "credentials": + t.Credentials, err = unmarshalCredentialsBaseClassification(val) + delete(rawMsg, key) + case "trustedCertificates": + t.TrustedCertificates, err = unmarshalCertificateSourceClassification(val) + delete(rawMsg, key) + case "tunnel": + t.Tunnel, err = unmarshalTunnelBaseClassification(val) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &t.Type) + delete(rawMsg, key) + case "url": + err = unpopulate(val, &t.URL) + delete(rawMsg, key) + case "validationOptions": + err = unpopulate(val, &t.ValidationOptions) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetTimeSequenceBase implements the TimeSequenceBaseClassification interface for type TimeSequenceBase. +func (t *TimeSequenceBase) GetTimeSequenceBase() *TimeSequenceBase { return t } + +// GetTokenKey implements the TokenKeyClassification interface for type TokenKey. +func (t *TokenKey) GetTokenKey() *TokenKey { return t } + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// GetTunnelBase implements the TunnelBaseClassification interface for type TunnelBase. +func (t *TunnelBase) GetTunnelBase() *TunnelBase { return t } + +// GetEndpointBase implements the EndpointBaseClassification interface for type UnsecuredEndpoint. +func (u *UnsecuredEndpoint) GetEndpointBase() *EndpointBase { + return &EndpointBase{ + Type: u.Type, + Credentials: u.Credentials, + URL: u.URL, + Tunnel: u.Tunnel, + } +} + +// MarshalJSON implements the json.Marshaller interface for type UnsecuredEndpoint. +func (u UnsecuredEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "credentials", u.Credentials) + populate(objectMap, "tunnel", u.Tunnel) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.UnsecuredEndpoint" + populate(objectMap, "url", u.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UnsecuredEndpoint. +func (u *UnsecuredEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "credentials": + u.Credentials, err = unmarshalCredentialsBaseClassification(val) + delete(rawMsg, key) + case "tunnel": + u.Tunnel, err = unmarshalTunnelBaseClassification(val) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &u.Type) + delete(rawMsg, key) + case "url": + err = unpopulate(val, &u.URL) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Update. +func (u Update) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", u.Identity) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "tags", u.Tags) + return json.Marshal(objectMap) +} + +// GetCredentialsBase implements the CredentialsBaseClassification interface for type UsernamePasswordCredentials. +func (u *UsernamePasswordCredentials) GetCredentialsBase() *CredentialsBase { + return &CredentialsBase{ + Type: u.Type, + } +} + +// MarshalJSON implements the json.Marshaller interface for type UsernamePasswordCredentials. +func (u UsernamePasswordCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "password", u.Password) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.UsernamePasswordCredentials" + populate(objectMap, "username", u.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UsernamePasswordCredentials. +func (u *UsernamePasswordCredentials) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "password": + err = unpopulate(val, &u.Password) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &u.Type) + delete(rawMsg, key) + case "username": + err = unpopulate(val, &u.Username) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VideoAnalyzer. +func (v VideoAnalyzer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "identity", v.Identity) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type VideoContentToken. +func (v VideoContentToken) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "expirationDate", v.ExpirationDate) + populate(objectMap, "token", v.Token) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoContentToken. +func (v *VideoContentToken) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "expirationDate": + err = unpopulateTimeRFC3339(val, &v.ExpirationDate) + delete(rawMsg, key) + case "token": + err = unpopulate(val, &v.Token) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetVideoEncoderBase implements the VideoEncoderBaseClassification interface for type VideoEncoderBase. +func (v *VideoEncoderBase) GetVideoEncoderBase() *VideoEncoderBase { return v } + +// GetVideoEncoderBase implements the VideoEncoderBaseClassification interface for type VideoEncoderH264. +func (v *VideoEncoderH264) GetVideoEncoderBase() *VideoEncoderBase { + return &VideoEncoderBase{ + Type: v.Type, + BitrateKbps: v.BitrateKbps, + FrameRate: v.FrameRate, + Scale: v.Scale, + } +} + +// MarshalJSON implements the json.Marshaller interface for type VideoEncoderH264. +func (v VideoEncoderH264) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bitrateKbps", v.BitrateKbps) + populate(objectMap, "frameRate", v.FrameRate) + populate(objectMap, "scale", v.Scale) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.VideoEncoderH264" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoEncoderH264. +func (v *VideoEncoderH264) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "bitrateKbps": + err = unpopulate(val, &v.BitrateKbps) + delete(rawMsg, key) + case "frameRate": + err = unpopulate(val, &v.FrameRate) + delete(rawMsg, key) + case "scale": + err = unpopulate(val, &v.Scale) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &v.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VideoEntity. +func (v VideoEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type VideoEntityCollection. +func (v VideoEntityCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// GetTimeSequenceBase implements the TimeSequenceBaseClassification interface for type VideoSequenceAbsoluteTimeMarkers. +func (v *VideoSequenceAbsoluteTimeMarkers) GetTimeSequenceBase() *TimeSequenceBase { + return &TimeSequenceBase{ + Type: v.Type, + } +} + +// MarshalJSON implements the json.Marshaller interface for type VideoSequenceAbsoluteTimeMarkers. +func (v VideoSequenceAbsoluteTimeMarkers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ranges", v.Ranges) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.VideoSequenceAbsoluteTimeMarkers" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoSequenceAbsoluteTimeMarkers. +func (v *VideoSequenceAbsoluteTimeMarkers) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "ranges": + err = unpopulate(val, &v.Ranges) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &v.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetNodeBase implements the NodeBaseClassification interface for type VideoSink. +func (v *VideoSink) GetNodeBase() *NodeBase { + return &NodeBase{ + Type: v.Type, + Name: v.Name, + } +} + +// GetSinkNodeBase implements the SinkNodeBaseClassification interface for type VideoSink. +func (v *VideoSink) GetSinkNodeBase() *SinkNodeBase { + return &SinkNodeBase{ + Inputs: v.Inputs, + Type: v.Type, + Name: v.Name, + } +} + +// MarshalJSON implements the json.Marshaller interface for type VideoSink. +func (v VideoSink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inputs", v.Inputs) + populate(objectMap, "name", v.Name) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.VideoSink" + populate(objectMap, "videoCreationProperties", v.VideoCreationProperties) + populate(objectMap, "videoName", v.VideoName) + populate(objectMap, "videoPublishingOptions", v.VideoPublishingOptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoSink. +func (v *VideoSink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "inputs": + err = unpopulate(val, &v.Inputs) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &v.Name) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &v.Type) + delete(rawMsg, key) + case "videoCreationProperties": + err = unpopulate(val, &v.VideoCreationProperties) + delete(rawMsg, key) + case "videoName": + err = unpopulate(val, &v.VideoName) + delete(rawMsg, key) + case "videoPublishingOptions": + err = unpopulate(val, &v.VideoPublishingOptions) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetNodeBase implements the NodeBaseClassification interface for type VideoSource. +func (v *VideoSource) GetNodeBase() *NodeBase { + return &NodeBase{ + Type: v.Type, + Name: v.Name, + } +} + +// GetSourceNodeBase implements the SourceNodeBaseClassification interface for type VideoSource. +func (v *VideoSource) GetSourceNodeBase() *SourceNodeBase { + return &SourceNodeBase{ + Type: v.Type, + Name: v.Name, + } +} + +// MarshalJSON implements the json.Marshaller interface for type VideoSource. +func (v VideoSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "timeSequences", v.TimeSequences) + objectMap["@type"] = "#Microsoft.VideoAnalyzer.VideoSource" + populate(objectMap, "videoName", v.VideoName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoSource. +func (v *VideoSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, &v.Name) + delete(rawMsg, key) + case "timeSequences": + v.TimeSequences, err = unmarshalTimeSequenceBaseClassification(val) + delete(rawMsg, key) + case "@type": + err = unpopulate(val, &v.Type) + delete(rawMsg, key) + case "videoName": + err = unpopulate(val, &v.VideoName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_operationresults_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_operationresults_client.go index 1d680e2c9b55..be9850c2a7dc 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_operationresults_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_operationresults_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type OperationResultsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationResultsClient { +func NewOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationResultsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationResultsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get video analyzer operation result. @@ -97,7 +102,7 @@ func (client *OperationResultsClient) getCreateRequest(ctx context.Context, loca // getHandleResponse handles the Get response. func (client *OperationResultsClient) getHandleResponse(resp *http.Response) (OperationResultsClientGetResponse, error) { - result := OperationResultsClientGetResponse{RawResponse: resp} + result := OperationResultsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VideoAnalyzer); err != nil { return OperationResultsClientGetResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_operations_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_operations_client.go index 3476990af8c3..e5e667f9633b 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_operations_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,19 +29,23 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // List - Lists all the Media operations. @@ -77,7 +82,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationCollection); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_operationstatuses_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_operationstatuses_client.go index 4a36a62a926e..b55ca60d6f7c 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_operationstatuses_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_operationstatuses_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type OperationStatusesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationStatusesClient { +func NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationStatusesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get video analyzer operation status. @@ -97,7 +102,7 @@ func (client *OperationStatusesClient) getCreateRequest(ctx context.Context, loc // getHandleResponse handles the Get response. func (client *OperationStatusesClient) getHandleResponse(resp *http.Response) (OperationStatusesClientGetResponse, error) { - result := OperationStatusesClientGetResponse{RawResponse: resp} + result := OperationStatusesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { return OperationStatusesClientGetResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pagers.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pagers.go deleted file mode 100644 index 01a305e24478..000000000000 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pagers.go +++ /dev/null @@ -1,341 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armvideoanalyzer - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// AccessPoliciesClientListPager provides operations for iterating over paged responses. -type AccessPoliciesClientListPager struct { - client *AccessPoliciesClient - current AccessPoliciesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, AccessPoliciesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *AccessPoliciesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *AccessPoliciesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.AccessPolicyEntityCollection.NextLink == nil || len(*p.current.AccessPolicyEntityCollection.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current AccessPoliciesClientListResponse page. -func (p *AccessPoliciesClientListPager) PageResponse() AccessPoliciesClientListResponse { - return p.current -} - -// EdgeModulesClientListPager provides operations for iterating over paged responses. -type EdgeModulesClientListPager struct { - client *EdgeModulesClient - current EdgeModulesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, EdgeModulesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *EdgeModulesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *EdgeModulesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.EdgeModuleEntityCollection.NextLink == nil || len(*p.current.EdgeModuleEntityCollection.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current EdgeModulesClientListResponse page. -func (p *EdgeModulesClientListPager) PageResponse() EdgeModulesClientListResponse { - return p.current -} - -// LivePipelinesClientListPager provides operations for iterating over paged responses. -type LivePipelinesClientListPager struct { - client *LivePipelinesClient - current LivePipelinesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, LivePipelinesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *LivePipelinesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *LivePipelinesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.LivePipelineCollection.NextLink == nil || len(*p.current.LivePipelineCollection.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current LivePipelinesClientListResponse page. -func (p *LivePipelinesClientListPager) PageResponse() LivePipelinesClientListResponse { - return p.current -} - -// PipelineJobsClientListPager provides operations for iterating over paged responses. -type PipelineJobsClientListPager struct { - client *PipelineJobsClient - current PipelineJobsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PipelineJobsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PipelineJobsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *PipelineJobsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PipelineJobCollection.NextLink == nil || len(*p.current.PipelineJobCollection.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PipelineJobsClientListResponse page. -func (p *PipelineJobsClientListPager) PageResponse() PipelineJobsClientListResponse { - return p.current -} - -// PipelineTopologiesClientListPager provides operations for iterating over paged responses. -type PipelineTopologiesClientListPager struct { - client *PipelineTopologiesClient - current PipelineTopologiesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PipelineTopologiesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PipelineTopologiesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *PipelineTopologiesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PipelineTopologyCollection.NextLink == nil || len(*p.current.PipelineTopologyCollection.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PipelineTopologiesClientListResponse page. -func (p *PipelineTopologiesClientListPager) PageResponse() PipelineTopologiesClientListResponse { - return p.current -} - -// VideosClientListPager provides operations for iterating over paged responses. -type VideosClientListPager struct { - client *VideosClient - current VideosClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, VideosClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *VideosClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *VideosClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.VideoEntityCollection.NextLink == nil || len(*p.current.VideoEntityCollection.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current VideosClientListResponse page. -func (p *VideosClientListPager) PageResponse() VideosClientListResponse { - return p.current -} diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pipelinejoboperationstatuses_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pipelinejoboperationstatuses_client.go index 713e16b45065..16cb23387d4d 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pipelinejoboperationstatuses_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pipelinejoboperationstatuses_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type PipelineJobOperationStatusesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPipelineJobOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PipelineJobOperationStatusesClient { +func NewPipelineJobOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PipelineJobOperationStatusesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PipelineJobOperationStatusesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get the operation status of a pipeline job with the given operationId. @@ -108,7 +113,7 @@ func (client *PipelineJobOperationStatusesClient) getCreateRequest(ctx context.C // getHandleResponse handles the Get response. func (client *PipelineJobOperationStatusesClient) getHandleResponse(resp *http.Response) (PipelineJobOperationStatusesClientGetResponse, error) { - result := PipelineJobOperationStatusesClientGetResponse{RawResponse: resp} + result := PipelineJobOperationStatusesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PipelineJobOperationStatus); err != nil { return PipelineJobOperationStatusesClientGetResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pipelinejobs_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pipelinejobs_client.go index 59ce2f4626c9..b4d0817dda0c 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pipelinejobs_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pipelinejobs_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type PipelineJobsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPipelineJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PipelineJobsClient { +func NewPipelineJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PipelineJobsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PipelineJobsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCancel - Cancels a pipeline job with the given name. @@ -57,22 +62,16 @@ func NewPipelineJobsClient(subscriptionID string, credential azcore.TokenCredent // pipelineJobName - The pipeline job name. // options - PipelineJobsClientBeginCancelOptions contains the optional parameters for the PipelineJobsClient.BeginCancel // method. -func (client *PipelineJobsClient) BeginCancel(ctx context.Context, resourceGroupName string, accountName string, pipelineJobName string, options *PipelineJobsClientBeginCancelOptions) (PipelineJobsClientCancelPollerResponse, error) { - resp, err := client.cancel(ctx, resourceGroupName, accountName, pipelineJobName, options) - if err != nil { - return PipelineJobsClientCancelPollerResponse{}, err - } - result := PipelineJobsClientCancelPollerResponse{ - RawResponse: resp, +func (client *PipelineJobsClient) BeginCancel(ctx context.Context, resourceGroupName string, accountName string, pipelineJobName string, options *PipelineJobsClientBeginCancelOptions) (*armruntime.Poller[PipelineJobsClientCancelResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.cancel(ctx, resourceGroupName, accountName, pipelineJobName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[PipelineJobsClientCancelResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[PipelineJobsClientCancelResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("PipelineJobsClient.Cancel", "", resp, client.pl) - if err != nil { - return PipelineJobsClientCancelPollerResponse{}, err - } - result.Poller = &PipelineJobsClientCancelPoller{ - pt: pt, - } - return result, nil } // Cancel - Cancels a pipeline job with the given name. @@ -177,7 +176,7 @@ func (client *PipelineJobsClient) createOrUpdateCreateRequest(ctx context.Contex // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *PipelineJobsClient) createOrUpdateHandleResponse(resp *http.Response) (PipelineJobsClientCreateOrUpdateResponse, error) { - result := PipelineJobsClientCreateOrUpdateResponse{RawResponse: resp} + result := PipelineJobsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PipelineJob); err != nil { return PipelineJobsClientCreateOrUpdateResponse{}, err } @@ -202,7 +201,7 @@ func (client *PipelineJobsClient) Delete(ctx context.Context, resourceGroupName if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return PipelineJobsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return PipelineJobsClientDeleteResponse{RawResponse: resp}, nil + return PipelineJobsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -289,7 +288,7 @@ func (client *PipelineJobsClient) getCreateRequest(ctx context.Context, resource // getHandleResponse handles the Get response. func (client *PipelineJobsClient) getHandleResponse(resp *http.Response) (PipelineJobsClientGetResponse, error) { - result := PipelineJobsClientGetResponse{RawResponse: resp} + result := PipelineJobsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PipelineJob); err != nil { return PipelineJobsClientGetResponse{}, err } @@ -301,16 +300,32 @@ func (client *PipelineJobsClient) getHandleResponse(resp *http.Response) (Pipeli // resourceGroupName - The name of the resource group. The name is case insensitive. // accountName - The Azure Video Analyzer account name. // options - PipelineJobsClientListOptions contains the optional parameters for the PipelineJobsClient.List method. -func (client *PipelineJobsClient) List(resourceGroupName string, accountName string, options *PipelineJobsClientListOptions) *PipelineJobsClientListPager { - return &PipelineJobsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *PipelineJobsClient) List(resourceGroupName string, accountName string, options *PipelineJobsClientListOptions) *runtime.Pager[PipelineJobsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[PipelineJobsClientListResponse]{ + More: func(page PipelineJobsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp PipelineJobsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PipelineJobCollection.NextLink) + Fetcher: func(ctx context.Context, page *PipelineJobsClientListResponse) (PipelineJobsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PipelineJobsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PipelineJobsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PipelineJobsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -347,7 +362,7 @@ func (client *PipelineJobsClient) listCreateRequest(ctx context.Context, resourc // listHandleResponse handles the List response. func (client *PipelineJobsClient) listHandleResponse(resp *http.Response) (PipelineJobsClientListResponse, error) { - result := PipelineJobsClientListResponse{RawResponse: resp} + result := PipelineJobsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PipelineJobCollection); err != nil { return PipelineJobsClientListResponse{}, err } @@ -408,7 +423,7 @@ func (client *PipelineJobsClient) updateCreateRequest(ctx context.Context, resou // updateHandleResponse handles the Update response. func (client *PipelineJobsClient) updateHandleResponse(resp *http.Response) (PipelineJobsClientUpdateResponse, error) { - result := PipelineJobsClientUpdateResponse{RawResponse: resp} + result := PipelineJobsClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PipelineJob); err != nil { return PipelineJobsClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pipelinetopologies_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pipelinetopologies_client.go index 66c4f174ce9d..bde0731e56bf 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pipelinetopologies_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pipelinetopologies_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type PipelineTopologiesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPipelineTopologiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PipelineTopologiesClient { +func NewPipelineTopologiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PipelineTopologiesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PipelineTopologiesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Creates a new pipeline topology or updates an existing one, with the given name. A pipeline topology describes @@ -108,7 +113,7 @@ func (client *PipelineTopologiesClient) createOrUpdateCreateRequest(ctx context. // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *PipelineTopologiesClient) createOrUpdateHandleResponse(resp *http.Response) (PipelineTopologiesClientCreateOrUpdateResponse, error) { - result := PipelineTopologiesClientCreateOrUpdateResponse{RawResponse: resp} + result := PipelineTopologiesClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PipelineTopology); err != nil { return PipelineTopologiesClientCreateOrUpdateResponse{}, err } @@ -135,7 +140,7 @@ func (client *PipelineTopologiesClient) Delete(ctx context.Context, resourceGrou if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return PipelineTopologiesClientDeleteResponse{}, runtime.NewResponseError(resp) } - return PipelineTopologiesClientDeleteResponse{RawResponse: resp}, nil + return PipelineTopologiesClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -222,7 +227,7 @@ func (client *PipelineTopologiesClient) getCreateRequest(ctx context.Context, re // getHandleResponse handles the Get response. func (client *PipelineTopologiesClient) getHandleResponse(resp *http.Response) (PipelineTopologiesClientGetResponse, error) { - result := PipelineTopologiesClientGetResponse{RawResponse: resp} + result := PipelineTopologiesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PipelineTopology); err != nil { return PipelineTopologiesClientGetResponse{}, err } @@ -234,16 +239,32 @@ func (client *PipelineTopologiesClient) getHandleResponse(resp *http.Response) ( // resourceGroupName - The name of the resource group. The name is case insensitive. // accountName - The Azure Video Analyzer account name. // options - PipelineTopologiesClientListOptions contains the optional parameters for the PipelineTopologiesClient.List method. -func (client *PipelineTopologiesClient) List(resourceGroupName string, accountName string, options *PipelineTopologiesClientListOptions) *PipelineTopologiesClientListPager { - return &PipelineTopologiesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *PipelineTopologiesClient) List(resourceGroupName string, accountName string, options *PipelineTopologiesClientListOptions) *runtime.Pager[PipelineTopologiesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[PipelineTopologiesClientListResponse]{ + More: func(page PipelineTopologiesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp PipelineTopologiesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PipelineTopologyCollection.NextLink) + Fetcher: func(ctx context.Context, page *PipelineTopologiesClientListResponse) (PipelineTopologiesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PipelineTopologiesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PipelineTopologiesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PipelineTopologiesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -280,7 +301,7 @@ func (client *PipelineTopologiesClient) listCreateRequest(ctx context.Context, r // listHandleResponse handles the List response. func (client *PipelineTopologiesClient) listHandleResponse(resp *http.Response) (PipelineTopologiesClientListResponse, error) { - result := PipelineTopologiesClientListResponse{RawResponse: resp} + result := PipelineTopologiesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PipelineTopologyCollection); err != nil { return PipelineTopologiesClientListResponse{}, err } @@ -344,7 +365,7 @@ func (client *PipelineTopologiesClient) updateCreateRequest(ctx context.Context, // updateHandleResponse handles the Update response. func (client *PipelineTopologiesClient) updateHandleResponse(resp *http.Response) (PipelineTopologiesClientUpdateResponse, error) { - result := PipelineTopologiesClientUpdateResponse{RawResponse: resp} + result := PipelineTopologiesClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PipelineTopology); err != nil { return PipelineTopologiesClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pollers.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pollers.go deleted file mode 100644 index b817191ab244..000000000000 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_pollers.go +++ /dev/null @@ -1,230 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armvideoanalyzer - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// LivePipelinesClientActivatePoller provides polling facilities until the operation reaches a terminal state. -type LivePipelinesClientActivatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *LivePipelinesClientActivatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *LivePipelinesClientActivatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final LivePipelinesClientActivateResponse will be returned. -func (p *LivePipelinesClientActivatePoller) FinalResponse(ctx context.Context) (LivePipelinesClientActivateResponse, error) { - respType := LivePipelinesClientActivateResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return LivePipelinesClientActivateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *LivePipelinesClientActivatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// LivePipelinesClientDeactivatePoller provides polling facilities until the operation reaches a terminal state. -type LivePipelinesClientDeactivatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *LivePipelinesClientDeactivatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *LivePipelinesClientDeactivatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final LivePipelinesClientDeactivateResponse will be returned. -func (p *LivePipelinesClientDeactivatePoller) FinalResponse(ctx context.Context) (LivePipelinesClientDeactivateResponse, error) { - respType := LivePipelinesClientDeactivateResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return LivePipelinesClientDeactivateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *LivePipelinesClientDeactivatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PipelineJobsClientCancelPoller provides polling facilities until the operation reaches a terminal state. -type PipelineJobsClientCancelPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PipelineJobsClientCancelPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *PipelineJobsClientCancelPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final PipelineJobsClientCancelResponse will be returned. -func (p *PipelineJobsClientCancelPoller) FinalResponse(ctx context.Context) (PipelineJobsClientCancelResponse, error) { - respType := PipelineJobsClientCancelResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return PipelineJobsClientCancelResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *PipelineJobsClientCancelPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// VideoAnalyzersClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type VideoAnalyzersClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VideoAnalyzersClientCreateOrUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *VideoAnalyzersClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final VideoAnalyzersClientCreateOrUpdateResponse will be returned. -func (p *VideoAnalyzersClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VideoAnalyzersClientCreateOrUpdateResponse, error) { - respType := VideoAnalyzersClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.VideoAnalyzer) - if err != nil { - return VideoAnalyzersClientCreateOrUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *VideoAnalyzersClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// VideoAnalyzersClientUpdatePoller provides polling facilities until the operation reaches a terminal state. -type VideoAnalyzersClientUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VideoAnalyzersClientUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *VideoAnalyzersClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final VideoAnalyzersClientUpdateResponse will be returned. -func (p *VideoAnalyzersClientUpdatePoller) FinalResponse(ctx context.Context) (VideoAnalyzersClientUpdateResponse, error) { - respType := VideoAnalyzersClientUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.VideoAnalyzer) - if err != nil { - return VideoAnalyzersClientUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *VideoAnalyzersClientUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_polymorphic_helpers.go index 8195ffa32dad..0ac5e9d087a6 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_polymorphic_helpers.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privateendpointconnections_client.go index 7eb9f8196373..38ff216ffde7 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privateendpointconnections_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type PrivateEndpointConnectionsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateEndpointConnectionsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Update private endpoint connection state under video analyzer account. @@ -105,7 +110,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *PrivateEndpointConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error) { - result := PrivateEndpointConnectionsClientCreateOrUpdateResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientCreateOrUpdateResponse{} if val := resp.Header.Get("Retry-After"); val != "" { retryAfter32, err := strconv.ParseInt(val, 10, 32) retryAfter := int32(retryAfter32) @@ -145,7 +150,7 @@ func (client *PrivateEndpointConnectionsClient) Delete(ctx context.Context, reso if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return PrivateEndpointConnectionsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return PrivateEndpointConnectionsClientDeleteResponse{RawResponse: resp}, nil + return PrivateEndpointConnectionsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -232,7 +237,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con // getHandleResponse handles the Get response. func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { - result := PrivateEndpointConnectionsClientGetResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } @@ -288,7 +293,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co // listHandleResponse handles the List response. func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListResponse, error) { - result := PrivateEndpointConnectionsClientListResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { return PrivateEndpointConnectionsClientListResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privateendpointconnectionsoperationresults_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privateendpointconnectionsoperationresults_client.go index acb1d98a00e7..3d7288cd92e4 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privateendpointconnectionsoperationresults_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privateendpointconnectionsoperationresults_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type PrivateEndpointConnectionsOperationResultsClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateEndpointConnectionsOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsOperationResultsClient { +func NewPrivateEndpointConnectionsOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsOperationResultsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateEndpointConnectionsOperationResultsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get private endpoint connection operation result. @@ -108,7 +113,7 @@ func (client *PrivateEndpointConnectionsOperationResultsClient) getCreateRequest // getHandleResponse handles the Get response. func (client *PrivateEndpointConnectionsOperationResultsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsOperationResultsClientGetResponse, error) { - result := PrivateEndpointConnectionsOperationResultsClientGetResponse{RawResponse: resp} + result := PrivateEndpointConnectionsOperationResultsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { return PrivateEndpointConnectionsOperationResultsClientGetResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privateendpointconnectionsoperationstatuses_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privateendpointconnectionsoperationstatuses_client.go index 0d7cbedbf65c..744a934276d2 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privateendpointconnectionsoperationstatuses_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privateendpointconnectionsoperationstatuses_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type PrivateEndpointConnectionsOperationStatusesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateEndpointConnectionsOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsOperationStatusesClient { +func NewPrivateEndpointConnectionsOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsOperationStatusesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateEndpointConnectionsOperationStatusesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get private endpoint connection operation status. @@ -108,7 +113,7 @@ func (client *PrivateEndpointConnectionsOperationStatusesClient) getCreateReques // getHandleResponse handles the Get response. func (client *PrivateEndpointConnectionsOperationStatusesClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsOperationStatusesClientGetResponse, error) { - result := PrivateEndpointConnectionsOperationStatusesClientGetResponse{RawResponse: resp} + result := PrivateEndpointConnectionsOperationStatusesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionOperationStatus); err != nil { return PrivateEndpointConnectionsOperationStatusesClientGetResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privatelinkresources_client.go index 367242f8ad91..809bd574e7e4 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_privatelinkresources_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type PrivateLinkResourcesClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateLinkResourcesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get group ID for video analyzer account. @@ -103,7 +108,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, // getHandleResponse handles the Get response. func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesClientGetResponse, error) { - result := PrivateLinkResourcesClientGetResponse{RawResponse: resp} + result := PrivateLinkResourcesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { return PrivateLinkResourcesClientGetResponse{}, err } @@ -159,7 +164,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, // listHandleResponse handles the List response. func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListResponse, error) { - result := PrivateLinkResourcesClientListResponse{RawResponse: resp} + result := PrivateLinkResourcesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { return PrivateLinkResourcesClientListResponse{}, err } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_response_types.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_response_types.go index 1d10a758db2e..dcd5af105004 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_response_types.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,502 +8,178 @@ package armvideoanalyzer -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - // AccessPoliciesClientCreateOrUpdateResponse contains the response from method AccessPoliciesClient.CreateOrUpdate. type AccessPoliciesClientCreateOrUpdateResponse struct { - AccessPoliciesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccessPoliciesClientCreateOrUpdateResult contains the result from method AccessPoliciesClient.CreateOrUpdate. -type AccessPoliciesClientCreateOrUpdateResult struct { AccessPolicyEntity } // AccessPoliciesClientDeleteResponse contains the response from method AccessPoliciesClient.Delete. type AccessPoliciesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // AccessPoliciesClientGetResponse contains the response from method AccessPoliciesClient.Get. type AccessPoliciesClientGetResponse struct { - AccessPoliciesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccessPoliciesClientGetResult contains the result from method AccessPoliciesClient.Get. -type AccessPoliciesClientGetResult struct { AccessPolicyEntity } // AccessPoliciesClientListResponse contains the response from method AccessPoliciesClient.List. type AccessPoliciesClientListResponse struct { - AccessPoliciesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccessPoliciesClientListResult contains the result from method AccessPoliciesClient.List. -type AccessPoliciesClientListResult struct { AccessPolicyEntityCollection } // AccessPoliciesClientUpdateResponse contains the response from method AccessPoliciesClient.Update. type AccessPoliciesClientUpdateResponse struct { - AccessPoliciesClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccessPoliciesClientUpdateResult contains the result from method AccessPoliciesClient.Update. -type AccessPoliciesClientUpdateResult struct { AccessPolicyEntity } // EdgeModulesClientCreateOrUpdateResponse contains the response from method EdgeModulesClient.CreateOrUpdate. type EdgeModulesClientCreateOrUpdateResponse struct { - EdgeModulesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// EdgeModulesClientCreateOrUpdateResult contains the result from method EdgeModulesClient.CreateOrUpdate. -type EdgeModulesClientCreateOrUpdateResult struct { EdgeModuleEntity } // EdgeModulesClientDeleteResponse contains the response from method EdgeModulesClient.Delete. type EdgeModulesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // EdgeModulesClientGetResponse contains the response from method EdgeModulesClient.Get. type EdgeModulesClientGetResponse struct { - EdgeModulesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// EdgeModulesClientGetResult contains the result from method EdgeModulesClient.Get. -type EdgeModulesClientGetResult struct { EdgeModuleEntity } // EdgeModulesClientListProvisioningTokenResponse contains the response from method EdgeModulesClient.ListProvisioningToken. type EdgeModulesClientListProvisioningTokenResponse struct { - EdgeModulesClientListProvisioningTokenResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// EdgeModulesClientListProvisioningTokenResult contains the result from method EdgeModulesClient.ListProvisioningToken. -type EdgeModulesClientListProvisioningTokenResult struct { EdgeModuleProvisioningToken } // EdgeModulesClientListResponse contains the response from method EdgeModulesClient.List. type EdgeModulesClientListResponse struct { - EdgeModulesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// EdgeModulesClientListResult contains the result from method EdgeModulesClient.List. -type EdgeModulesClientListResult struct { EdgeModuleEntityCollection } // LivePipelineOperationStatusesClientGetResponse contains the response from method LivePipelineOperationStatusesClient.Get. type LivePipelineOperationStatusesClientGetResponse struct { - LivePipelineOperationStatusesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LivePipelineOperationStatusesClientGetResult contains the result from method LivePipelineOperationStatusesClient.Get. -type LivePipelineOperationStatusesClientGetResult struct { LivePipelineOperationStatus } -// LivePipelinesClientActivatePollerResponse contains the response from method LivePipelinesClient.Activate. -type LivePipelinesClientActivatePollerResponse struct { - // Poller contains an initialized poller. - Poller *LivePipelinesClientActivatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l LivePipelinesClientActivatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LivePipelinesClientActivateResponse, error) { - respType := LivePipelinesClientActivateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a LivePipelinesClientActivatePollerResponse from the provided client and resume token. -func (l *LivePipelinesClientActivatePollerResponse) Resume(ctx context.Context, client *LivePipelinesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("LivePipelinesClient.Activate", token, client.pl) - if err != nil { - return err - } - poller := &LivePipelinesClientActivatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // LivePipelinesClientActivateResponse contains the response from method LivePipelinesClient.Activate. type LivePipelinesClientActivateResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // LivePipelinesClientCreateOrUpdateResponse contains the response from method LivePipelinesClient.CreateOrUpdate. type LivePipelinesClientCreateOrUpdateResponse struct { - LivePipelinesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LivePipelinesClientCreateOrUpdateResult contains the result from method LivePipelinesClient.CreateOrUpdate. -type LivePipelinesClientCreateOrUpdateResult struct { LivePipeline } -// LivePipelinesClientDeactivatePollerResponse contains the response from method LivePipelinesClient.Deactivate. -type LivePipelinesClientDeactivatePollerResponse struct { - // Poller contains an initialized poller. - Poller *LivePipelinesClientDeactivatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l LivePipelinesClientDeactivatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LivePipelinesClientDeactivateResponse, error) { - respType := LivePipelinesClientDeactivateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a LivePipelinesClientDeactivatePollerResponse from the provided client and resume token. -func (l *LivePipelinesClientDeactivatePollerResponse) Resume(ctx context.Context, client *LivePipelinesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("LivePipelinesClient.Deactivate", token, client.pl) - if err != nil { - return err - } - poller := &LivePipelinesClientDeactivatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // LivePipelinesClientDeactivateResponse contains the response from method LivePipelinesClient.Deactivate. type LivePipelinesClientDeactivateResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // LivePipelinesClientDeleteResponse contains the response from method LivePipelinesClient.Delete. type LivePipelinesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // LivePipelinesClientGetResponse contains the response from method LivePipelinesClient.Get. type LivePipelinesClientGetResponse struct { - LivePipelinesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LivePipelinesClientGetResult contains the result from method LivePipelinesClient.Get. -type LivePipelinesClientGetResult struct { LivePipeline } // LivePipelinesClientListResponse contains the response from method LivePipelinesClient.List. type LivePipelinesClientListResponse struct { - LivePipelinesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LivePipelinesClientListResult contains the result from method LivePipelinesClient.List. -type LivePipelinesClientListResult struct { LivePipelineCollection } // LivePipelinesClientUpdateResponse contains the response from method LivePipelinesClient.Update. type LivePipelinesClientUpdateResponse struct { - LivePipelinesClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LivePipelinesClientUpdateResult contains the result from method LivePipelinesClient.Update. -type LivePipelinesClientUpdateResult struct { LivePipeline } // LocationsClientCheckNameAvailabilityResponse contains the response from method LocationsClient.CheckNameAvailability. type LocationsClientCheckNameAvailabilityResponse struct { - LocationsClientCheckNameAvailabilityResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// LocationsClientCheckNameAvailabilityResult contains the result from method LocationsClient.CheckNameAvailability. -type LocationsClientCheckNameAvailabilityResult struct { CheckNameAvailabilityResponse } // OperationResultsClientGetResponse contains the response from method OperationResultsClient.Get. type OperationResultsClientGetResponse struct { - OperationResultsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationResultsClientGetResult contains the result from method OperationResultsClient.Get. -type OperationResultsClientGetResult struct { VideoAnalyzer } // OperationStatusesClientGetResponse contains the response from method OperationStatusesClient.Get. type OperationStatusesClientGetResponse struct { - OperationStatusesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationStatusesClientGetResult contains the result from method OperationStatusesClient.Get. -type OperationStatusesClientGetResult struct { OperationStatus } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationCollection } // PipelineJobOperationStatusesClientGetResponse contains the response from method PipelineJobOperationStatusesClient.Get. type PipelineJobOperationStatusesClientGetResponse struct { - PipelineJobOperationStatusesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PipelineJobOperationStatusesClientGetResult contains the result from method PipelineJobOperationStatusesClient.Get. -type PipelineJobOperationStatusesClientGetResult struct { PipelineJobOperationStatus } -// PipelineJobsClientCancelPollerResponse contains the response from method PipelineJobsClient.Cancel. -type PipelineJobsClientCancelPollerResponse struct { - // Poller contains an initialized poller. - Poller *PipelineJobsClientCancelPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l PipelineJobsClientCancelPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PipelineJobsClientCancelResponse, error) { - respType := PipelineJobsClientCancelResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PipelineJobsClientCancelPollerResponse from the provided client and resume token. -func (l *PipelineJobsClientCancelPollerResponse) Resume(ctx context.Context, client *PipelineJobsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PipelineJobsClient.Cancel", token, client.pl) - if err != nil { - return err - } - poller := &PipelineJobsClientCancelPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // PipelineJobsClientCancelResponse contains the response from method PipelineJobsClient.Cancel. type PipelineJobsClientCancelResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PipelineJobsClientCreateOrUpdateResponse contains the response from method PipelineJobsClient.CreateOrUpdate. type PipelineJobsClientCreateOrUpdateResponse struct { - PipelineJobsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PipelineJobsClientCreateOrUpdateResult contains the result from method PipelineJobsClient.CreateOrUpdate. -type PipelineJobsClientCreateOrUpdateResult struct { PipelineJob } // PipelineJobsClientDeleteResponse contains the response from method PipelineJobsClient.Delete. type PipelineJobsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PipelineJobsClientGetResponse contains the response from method PipelineJobsClient.Get. type PipelineJobsClientGetResponse struct { - PipelineJobsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PipelineJobsClientGetResult contains the result from method PipelineJobsClient.Get. -type PipelineJobsClientGetResult struct { PipelineJob } // PipelineJobsClientListResponse contains the response from method PipelineJobsClient.List. type PipelineJobsClientListResponse struct { - PipelineJobsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PipelineJobsClientListResult contains the result from method PipelineJobsClient.List. -type PipelineJobsClientListResult struct { PipelineJobCollection } // PipelineJobsClientUpdateResponse contains the response from method PipelineJobsClient.Update. type PipelineJobsClientUpdateResponse struct { - PipelineJobsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PipelineJobsClientUpdateResult contains the result from method PipelineJobsClient.Update. -type PipelineJobsClientUpdateResult struct { PipelineJob } // PipelineTopologiesClientCreateOrUpdateResponse contains the response from method PipelineTopologiesClient.CreateOrUpdate. type PipelineTopologiesClientCreateOrUpdateResponse struct { - PipelineTopologiesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PipelineTopologiesClientCreateOrUpdateResult contains the result from method PipelineTopologiesClient.CreateOrUpdate. -type PipelineTopologiesClientCreateOrUpdateResult struct { PipelineTopology } // PipelineTopologiesClientDeleteResponse contains the response from method PipelineTopologiesClient.Delete. type PipelineTopologiesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PipelineTopologiesClientGetResponse contains the response from method PipelineTopologiesClient.Get. type PipelineTopologiesClientGetResponse struct { - PipelineTopologiesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PipelineTopologiesClientGetResult contains the result from method PipelineTopologiesClient.Get. -type PipelineTopologiesClientGetResult struct { PipelineTopology } // PipelineTopologiesClientListResponse contains the response from method PipelineTopologiesClient.List. type PipelineTopologiesClientListResponse struct { - PipelineTopologiesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PipelineTopologiesClientListResult contains the result from method PipelineTopologiesClient.List. -type PipelineTopologiesClientListResult struct { PipelineTopologyCollection } // PipelineTopologiesClientUpdateResponse contains the response from method PipelineTopologiesClient.Update. type PipelineTopologiesClientUpdateResponse struct { - PipelineTopologiesClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PipelineTopologiesClientUpdateResult contains the result from method PipelineTopologiesClient.Update. -type PipelineTopologiesClientUpdateResult struct { PipelineTopology } // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.CreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { - PrivateEndpointConnectionsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientCreateOrUpdateResult contains the result from method PrivateEndpointConnectionsClient.CreateOrUpdate. -type PrivateEndpointConnectionsClientCreateOrUpdateResult struct { PrivateEndpointConnection // AzureAsyncOperation contains the information returned from the Azure-AsyncOperation header response. AzureAsyncOperation *string @@ -517,290 +193,95 @@ type PrivateEndpointConnectionsClientCreateOrUpdateResult struct { // PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. type PrivateEndpointConnectionsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { - PrivateEndpointConnectionsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientGetResult contains the result from method PrivateEndpointConnectionsClient.Get. -type PrivateEndpointConnectionsClientGetResult struct { PrivateEndpointConnection } // PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.List. type PrivateEndpointConnectionsClientListResponse struct { - PrivateEndpointConnectionsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientListResult contains the result from method PrivateEndpointConnectionsClient.List. -type PrivateEndpointConnectionsClientListResult struct { PrivateEndpointConnectionListResult } // PrivateEndpointConnectionsOperationResultsClientGetResponse contains the response from method PrivateEndpointConnectionsOperationResultsClient.Get. type PrivateEndpointConnectionsOperationResultsClientGetResponse struct { - PrivateEndpointConnectionsOperationResultsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsOperationResultsClientGetResult contains the result from method PrivateEndpointConnectionsOperationResultsClient.Get. -type PrivateEndpointConnectionsOperationResultsClientGetResult struct { PrivateEndpointConnection } // PrivateEndpointConnectionsOperationStatusesClientGetResponse contains the response from method PrivateEndpointConnectionsOperationStatusesClient.Get. type PrivateEndpointConnectionsOperationStatusesClientGetResponse struct { - PrivateEndpointConnectionsOperationStatusesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsOperationStatusesClientGetResult contains the result from method PrivateEndpointConnectionsOperationStatusesClient.Get. -type PrivateEndpointConnectionsOperationStatusesClientGetResult struct { PrivateEndpointConnectionOperationStatus } // PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. type PrivateLinkResourcesClientGetResponse struct { - PrivateLinkResourcesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateLinkResourcesClientGetResult contains the result from method PrivateLinkResourcesClient.Get. -type PrivateLinkResourcesClientGetResult struct { PrivateLinkResource } // PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.List. type PrivateLinkResourcesClientListResponse struct { - PrivateLinkResourcesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateLinkResourcesClientListResult contains the result from method PrivateLinkResourcesClient.List. -type PrivateLinkResourcesClientListResult struct { PrivateLinkResourceListResult } -// VideoAnalyzersClientCreateOrUpdatePollerResponse contains the response from method VideoAnalyzersClient.CreateOrUpdate. -type VideoAnalyzersClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *VideoAnalyzersClientCreateOrUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l VideoAnalyzersClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VideoAnalyzersClientCreateOrUpdateResponse, error) { - respType := VideoAnalyzersClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VideoAnalyzer) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VideoAnalyzersClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *VideoAnalyzersClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VideoAnalyzersClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VideoAnalyzersClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &VideoAnalyzersClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // VideoAnalyzersClientCreateOrUpdateResponse contains the response from method VideoAnalyzersClient.CreateOrUpdate. type VideoAnalyzersClientCreateOrUpdateResponse struct { - VideoAnalyzersClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VideoAnalyzersClientCreateOrUpdateResult contains the result from method VideoAnalyzersClient.CreateOrUpdate. -type VideoAnalyzersClientCreateOrUpdateResult struct { VideoAnalyzer } // VideoAnalyzersClientDeleteResponse contains the response from method VideoAnalyzersClient.Delete. type VideoAnalyzersClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // VideoAnalyzersClientGetResponse contains the response from method VideoAnalyzersClient.Get. type VideoAnalyzersClientGetResponse struct { - VideoAnalyzersClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VideoAnalyzersClientGetResult contains the result from method VideoAnalyzersClient.Get. -type VideoAnalyzersClientGetResult struct { VideoAnalyzer } // VideoAnalyzersClientListBySubscriptionResponse contains the response from method VideoAnalyzersClient.ListBySubscription. type VideoAnalyzersClientListBySubscriptionResponse struct { - VideoAnalyzersClientListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VideoAnalyzersClientListBySubscriptionResult contains the result from method VideoAnalyzersClient.ListBySubscription. -type VideoAnalyzersClientListBySubscriptionResult struct { Collection } // VideoAnalyzersClientListResponse contains the response from method VideoAnalyzersClient.List. type VideoAnalyzersClientListResponse struct { - VideoAnalyzersClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VideoAnalyzersClientListResult contains the result from method VideoAnalyzersClient.List. -type VideoAnalyzersClientListResult struct { Collection } -// VideoAnalyzersClientUpdatePollerResponse contains the response from method VideoAnalyzersClient.Update. -type VideoAnalyzersClientUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *VideoAnalyzersClientUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l VideoAnalyzersClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VideoAnalyzersClientUpdateResponse, error) { - respType := VideoAnalyzersClientUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VideoAnalyzer) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VideoAnalyzersClientUpdatePollerResponse from the provided client and resume token. -func (l *VideoAnalyzersClientUpdatePollerResponse) Resume(ctx context.Context, client *VideoAnalyzersClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VideoAnalyzersClient.Update", token, client.pl) - if err != nil { - return err - } - poller := &VideoAnalyzersClientUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // VideoAnalyzersClientUpdateResponse contains the response from method VideoAnalyzersClient.Update. type VideoAnalyzersClientUpdateResponse struct { - VideoAnalyzersClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VideoAnalyzersClientUpdateResult contains the result from method VideoAnalyzersClient.Update. -type VideoAnalyzersClientUpdateResult struct { VideoAnalyzer } // VideosClientCreateOrUpdateResponse contains the response from method VideosClient.CreateOrUpdate. type VideosClientCreateOrUpdateResponse struct { - VideosClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VideosClientCreateOrUpdateResult contains the result from method VideosClient.CreateOrUpdate. -type VideosClientCreateOrUpdateResult struct { VideoEntity } // VideosClientDeleteResponse contains the response from method VideosClient.Delete. type VideosClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // VideosClientGetResponse contains the response from method VideosClient.Get. type VideosClientGetResponse struct { - VideosClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VideosClientGetResult contains the result from method VideosClient.Get. -type VideosClientGetResult struct { VideoEntity } // VideosClientListContentTokenResponse contains the response from method VideosClient.ListContentToken. type VideosClientListContentTokenResponse struct { - VideosClientListContentTokenResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VideosClientListContentTokenResult contains the result from method VideosClient.ListContentToken. -type VideosClientListContentTokenResult struct { VideoContentToken } // VideosClientListResponse contains the response from method VideosClient.List. type VideosClientListResponse struct { - VideosClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VideosClientListResult contains the result from method VideosClient.List. -type VideosClientListResult struct { VideoEntityCollection } // VideosClientUpdateResponse contains the response from method VideosClient.Update. type VideosClientUpdateResponse struct { - VideosClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VideosClientUpdateResult contains the result from method VideosClient.Update. -type VideosClientUpdateResult struct { VideoEntity } diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_time_rfc3339.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_time_rfc3339.go index 1fe85a6a0111..666e6ca4cd73 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_videoanalyzers_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_videoanalyzers_client.go index 567accd58b34..f51eb5f0b566 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_videoanalyzers_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_videoanalyzers_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type VideoAnalyzersClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewVideoAnalyzersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VideoAnalyzersClient { +func NewVideoAnalyzersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VideoAnalyzersClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &VideoAnalyzersClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Create or update an instance of a Video Analyzer account @@ -56,22 +61,16 @@ func NewVideoAnalyzersClient(subscriptionID string, credential azcore.TokenCrede // parameters - The request parameters // options - VideoAnalyzersClientBeginCreateOrUpdateOptions contains the optional parameters for the VideoAnalyzersClient.BeginCreateOrUpdate // method. -func (client *VideoAnalyzersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, parameters VideoAnalyzer, options *VideoAnalyzersClientBeginCreateOrUpdateOptions) (VideoAnalyzersClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, parameters, options) - if err != nil { - return VideoAnalyzersClientCreateOrUpdatePollerResponse{}, err - } - result := VideoAnalyzersClientCreateOrUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("VideoAnalyzersClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return VideoAnalyzersClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &VideoAnalyzersClientCreateOrUpdatePoller{ - pt: pt, +func (client *VideoAnalyzersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, parameters VideoAnalyzer, options *VideoAnalyzersClientBeginCreateOrUpdateOptions) (*armruntime.Poller[VideoAnalyzersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[VideoAnalyzersClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[VideoAnalyzersClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // CreateOrUpdate - Create or update an instance of a Video Analyzer account @@ -134,7 +133,7 @@ func (client *VideoAnalyzersClient) Delete(ctx context.Context, resourceGroupNam if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return VideoAnalyzersClientDeleteResponse{}, runtime.NewResponseError(resp) } - return VideoAnalyzersClientDeleteResponse{RawResponse: resp}, nil + return VideoAnalyzersClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -211,7 +210,7 @@ func (client *VideoAnalyzersClient) getCreateRequest(ctx context.Context, resour // getHandleResponse handles the Get response. func (client *VideoAnalyzersClient) getHandleResponse(resp *http.Response) (VideoAnalyzersClientGetResponse, error) { - result := VideoAnalyzersClientGetResponse{RawResponse: resp} + result := VideoAnalyzersClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VideoAnalyzer); err != nil { return VideoAnalyzersClientGetResponse{}, err } @@ -261,7 +260,7 @@ func (client *VideoAnalyzersClient) listCreateRequest(ctx context.Context, resou // listHandleResponse handles the List response. func (client *VideoAnalyzersClient) listHandleResponse(resp *http.Response) (VideoAnalyzersClientListResponse, error) { - result := VideoAnalyzersClientListResponse{RawResponse: resp} + result := VideoAnalyzersClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Collection); err != nil { return VideoAnalyzersClientListResponse{}, err } @@ -307,7 +306,7 @@ func (client *VideoAnalyzersClient) listBySubscriptionCreateRequest(ctx context. // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *VideoAnalyzersClient) listBySubscriptionHandleResponse(resp *http.Response) (VideoAnalyzersClientListBySubscriptionResponse, error) { - result := VideoAnalyzersClientListBySubscriptionResponse{RawResponse: resp} + result := VideoAnalyzersClientListBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Collection); err != nil { return VideoAnalyzersClientListBySubscriptionResponse{}, err } @@ -321,22 +320,16 @@ func (client *VideoAnalyzersClient) listBySubscriptionHandleResponse(resp *http. // parameters - The request parameters // options - VideoAnalyzersClientBeginUpdateOptions contains the optional parameters for the VideoAnalyzersClient.BeginUpdate // method. -func (client *VideoAnalyzersClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, parameters Update, options *VideoAnalyzersClientBeginUpdateOptions) (VideoAnalyzersClientUpdatePollerResponse, error) { - resp, err := client.update(ctx, resourceGroupName, accountName, parameters, options) - if err != nil { - return VideoAnalyzersClientUpdatePollerResponse{}, err +func (client *VideoAnalyzersClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, parameters Update, options *VideoAnalyzersClientBeginUpdateOptions) (*armruntime.Poller[VideoAnalyzersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[VideoAnalyzersClientUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[VideoAnalyzersClientUpdateResponse](options.ResumeToken, client.pl, nil) } - result := VideoAnalyzersClientUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("VideoAnalyzersClient.Update", "", resp, client.pl) - if err != nil { - return VideoAnalyzersClientUpdatePollerResponse{}, err - } - result.Poller = &VideoAnalyzersClientUpdatePoller{ - pt: pt, - } - return result, nil } // Update - Updates an existing instance of Video Analyzer account diff --git a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_videos_client.go b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_videos_client.go index 44a7dd339acf..bd66ed463ee0 100644 --- a/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_videos_client.go +++ b/sdk/resourcemanager/videoanalyzer/armvideoanalyzer/zz_generated_videos_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type VideosClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewVideosClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VideosClient { +func NewVideosClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VideosClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &VideosClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Creates a new video resource or updates an existing video resource with the given name. @@ -104,7 +109,7 @@ func (client *VideosClient) createOrUpdateCreateRequest(ctx context.Context, res // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *VideosClient) createOrUpdateHandleResponse(resp *http.Response) (VideosClientCreateOrUpdateResponse, error) { - result := VideosClientCreateOrUpdateResponse{RawResponse: resp} + result := VideosClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VideoEntity); err != nil { return VideosClientCreateOrUpdateResponse{}, err } @@ -129,7 +134,7 @@ func (client *VideosClient) Delete(ctx context.Context, resourceGroupName string if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return VideosClientDeleteResponse{}, runtime.NewResponseError(resp) } - return VideosClientDeleteResponse{RawResponse: resp}, nil + return VideosClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -215,7 +220,7 @@ func (client *VideosClient) getCreateRequest(ctx context.Context, resourceGroupN // getHandleResponse handles the Get response. func (client *VideosClient) getHandleResponse(resp *http.Response) (VideosClientGetResponse, error) { - result := VideosClientGetResponse{RawResponse: resp} + result := VideosClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VideoEntity); err != nil { return VideosClientGetResponse{}, err } @@ -227,16 +232,32 @@ func (client *VideosClient) getHandleResponse(resp *http.Response) (VideosClient // resourceGroupName - The name of the resource group. The name is case insensitive. // accountName - The Azure Video Analyzer account name. // options - VideosClientListOptions contains the optional parameters for the VideosClient.List method. -func (client *VideosClient) List(resourceGroupName string, accountName string, options *VideosClientListOptions) *VideosClientListPager { - return &VideosClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *VideosClient) List(resourceGroupName string, accountName string, options *VideosClientListOptions) *runtime.Pager[VideosClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[VideosClientListResponse]{ + More: func(page VideosClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp VideosClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.VideoEntityCollection.NextLink) + Fetcher: func(ctx context.Context, page *VideosClientListResponse) (VideosClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VideosClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VideosClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VideosClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -270,7 +291,7 @@ func (client *VideosClient) listCreateRequest(ctx context.Context, resourceGroup // listHandleResponse handles the List response. func (client *VideosClient) listHandleResponse(resp *http.Response) (VideosClientListResponse, error) { - result := VideosClientListResponse{RawResponse: resp} + result := VideosClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VideoEntityCollection); err != nil { return VideosClientListResponse{}, err } @@ -331,7 +352,7 @@ func (client *VideosClient) listContentTokenCreateRequest(ctx context.Context, r // listContentTokenHandleResponse handles the ListContentToken response. func (client *VideosClient) listContentTokenHandleResponse(resp *http.Response) (VideosClientListContentTokenResponse, error) { - result := VideosClientListContentTokenResponse{RawResponse: resp} + result := VideosClientListContentTokenResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VideoContentToken); err != nil { return VideosClientListContentTokenResponse{}, err } @@ -392,7 +413,7 @@ func (client *VideosClient) updateCreateRequest(ctx context.Context, resourceGro // updateHandleResponse handles the Update response. func (client *VideosClient) updateHandleResponse(resp *http.Response) (VideosClientUpdateResponse, error) { - result := VideosClientUpdateResponse{RawResponse: resp} + result := VideosClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VideoEntity); err != nil { return VideosClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/CHANGELOG.md b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/CHANGELOG.md index c573daf42f3e..fae5af4f204f 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/CHANGELOG.md +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/CHANGELOG.md @@ -1,5 +1,128 @@ # Release History +## 0.3.0 (2022-04-13) +### Breaking Changes + +- Function `*VirtualMachineImageTemplatesClient.BeginCancel` return value(s) have been changed from `(VirtualMachineImageTemplatesClientCancelPollerResponse, error)` to `(*armruntime.Poller[VirtualMachineImageTemplatesClientCancelResponse], error)` +- Function `*VirtualMachineImageTemplatesClient.ListRunOutputs` return value(s) have been changed from `(*VirtualMachineImageTemplatesClientListRunOutputsPager)` to `(*runtime.Pager[VirtualMachineImageTemplatesClientListRunOutputsResponse])` +- Function `*VirtualMachineImageTemplatesClient.List` return value(s) have been changed from `(*VirtualMachineImageTemplatesClientListPager)` to `(*runtime.Pager[VirtualMachineImageTemplatesClientListResponse])` +- Function `*VirtualMachineImageTemplatesClient.BeginRun` return value(s) have been changed from `(VirtualMachineImageTemplatesClientRunPollerResponse, error)` to `(*armruntime.Poller[VirtualMachineImageTemplatesClientRunResponse], error)` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `NewVirtualMachineImageTemplatesClient` return value(s) have been changed from `(*VirtualMachineImageTemplatesClient)` to `(*VirtualMachineImageTemplatesClient, error)` +- Function `*VirtualMachineImageTemplatesClient.BeginUpdate` return value(s) have been changed from `(VirtualMachineImageTemplatesClientUpdatePollerResponse, error)` to `(*armruntime.Poller[VirtualMachineImageTemplatesClientUpdateResponse], error)` +- Function `*VirtualMachineImageTemplatesClient.BeginDelete` return value(s) have been changed from `(VirtualMachineImageTemplatesClientDeletePollerResponse, error)` to `(*armruntime.Poller[VirtualMachineImageTemplatesClientDeleteResponse], error)` +- Function `*VirtualMachineImageTemplatesClient.BeginCreateOrUpdate` return value(s) have been changed from `(VirtualMachineImageTemplatesClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[VirtualMachineImageTemplatesClientCreateOrUpdateResponse], error)` +- Function `*VirtualMachineImageTemplatesClient.ListByResourceGroup` return value(s) have been changed from `(*VirtualMachineImageTemplatesClientListByResourceGroupPager)` to `(*runtime.Pager[VirtualMachineImageTemplatesClientListByResourceGroupResponse])` +- Function `*OperationsClient.List` return value(s) have been changed from `(*OperationsClientListPager)` to `(*runtime.Pager[OperationsClientListResponse])` +- Type of `Operation.Properties` has been changed from `map[string]interface{}` to `interface{}` +- Function `RunState.ToPtr` has been removed +- Function `VirtualMachineImageTemplatesClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*VirtualMachineImageTemplatesClientRunPoller.Done` has been removed +- Function `*VirtualMachineImageTemplatesClientCancelPoller.Poll` has been removed +- Function `*VirtualMachineImageTemplatesClientCreateOrUpdatePoller.Done` has been removed +- Function `*VirtualMachineImageTemplatesClientListPager.NextPage` has been removed +- Function `VirtualMachineImageTemplatesClientCancelPollerResponse.PollUntilDone` has been removed +- Function `*VirtualMachineImageTemplatesClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*OperationsClientListPager.Err` has been removed +- Function `*VirtualMachineImageTemplatesClientListByResourceGroupPager.PageResponse` has been removed +- Function `*VirtualMachineImageTemplatesClientListPager.Err` has been removed +- Function `*OperationsClientListPager.NextPage` has been removed +- Function `*VirtualMachineImageTemplatesClientUpdatePollerResponse.Resume` has been removed +- Function `VirtualMachineImageTemplatesClientRunPollerResponse.PollUntilDone` has been removed +- Function `ResourceIdentityType.ToPtr` has been removed +- Function `*VirtualMachineImageTemplatesClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*VirtualMachineImageTemplatesClientCreateOrUpdatePoller.Poll` has been removed +- Function `*VirtualMachineImageTemplatesClientUpdatePoller.FinalResponse` has been removed +- Function `*VirtualMachineImageTemplatesClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*VirtualMachineImageTemplatesClientListByResourceGroupPager.NextPage` has been removed +- Function `*VirtualMachineImageTemplatesClientRunPoller.FinalResponse` has been removed +- Function `*VirtualMachineImageTemplatesClientUpdatePoller.ResumeToken` has been removed +- Function `*VirtualMachineImageTemplatesClientDeletePollerResponse.Resume` has been removed +- Function `ProvisioningErrorCode.ToPtr` has been removed +- Function `*VirtualMachineImageTemplatesClientListRunOutputsPager.PageResponse` has been removed +- Function `*VirtualMachineImageTemplatesClientDeletePoller.Poll` has been removed +- Function `*VirtualMachineImageTemplatesClientRunPoller.Poll` has been removed +- Function `*VirtualMachineImageTemplatesClientListRunOutputsPager.Err` has been removed +- Function `*OperationsClientListPager.PageResponse` has been removed +- Function `SharedImageStorageAccountType.ToPtr` has been removed +- Function `*VirtualMachineImageTemplatesClientDeletePoller.Done` has been removed +- Function `*VirtualMachineImageTemplatesClientUpdatePoller.Poll` has been removed +- Function `VirtualMachineImageTemplatesClientUpdatePollerResponse.PollUntilDone` has been removed +- Function `*VirtualMachineImageTemplatesClientListByResourceGroupPager.Err` has been removed +- Function `*VirtualMachineImageTemplatesClientListPager.PageResponse` has been removed +- Function `VirtualMachineImageTemplatesClientDeletePollerResponse.PollUntilDone` has been removed +- Function `RunSubState.ToPtr` has been removed +- Function `*VirtualMachineImageTemplatesClientDeletePoller.FinalResponse` has been removed +- Function `CreatedByType.ToPtr` has been removed +- Function `*VirtualMachineImageTemplatesClientRunPoller.ResumeToken` has been removed +- Function `*VirtualMachineImageTemplatesClientListRunOutputsPager.NextPage` has been removed +- Function `*VirtualMachineImageTemplatesClientCancelPoller.Done` has been removed +- Function `*VirtualMachineImageTemplatesClientCancelPoller.FinalResponse` has been removed +- Function `ProvisioningState.ToPtr` has been removed +- Function `*VirtualMachineImageTemplatesClientDeletePoller.ResumeToken` has been removed +- Function `*VirtualMachineImageTemplatesClientCancelPollerResponse.Resume` has been removed +- Function `*VirtualMachineImageTemplatesClientUpdatePoller.Done` has been removed +- Function `*VirtualMachineImageTemplatesClientCancelPoller.ResumeToken` has been removed +- Function `*VirtualMachineImageTemplatesClientRunPollerResponse.Resume` has been removed +- Struct `OperationsClientListPager` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `VirtualMachineImageTemplatesClientCancelPoller` has been removed +- Struct `VirtualMachineImageTemplatesClientCancelPollerResponse` has been removed +- Struct `VirtualMachineImageTemplatesClientCreateOrUpdatePoller` has been removed +- Struct `VirtualMachineImageTemplatesClientCreateOrUpdatePollerResponse` has been removed +- Struct `VirtualMachineImageTemplatesClientCreateOrUpdateResult` has been removed +- Struct `VirtualMachineImageTemplatesClientDeletePoller` has been removed +- Struct `VirtualMachineImageTemplatesClientDeletePollerResponse` has been removed +- Struct `VirtualMachineImageTemplatesClientGetResult` has been removed +- Struct `VirtualMachineImageTemplatesClientGetRunOutputResult` has been removed +- Struct `VirtualMachineImageTemplatesClientListByResourceGroupPager` has been removed +- Struct `VirtualMachineImageTemplatesClientListByResourceGroupResult` has been removed +- Struct `VirtualMachineImageTemplatesClientListPager` has been removed +- Struct `VirtualMachineImageTemplatesClientListResult` has been removed +- Struct `VirtualMachineImageTemplatesClientListRunOutputsPager` has been removed +- Struct `VirtualMachineImageTemplatesClientListRunOutputsResult` has been removed +- Struct `VirtualMachineImageTemplatesClientRunPoller` has been removed +- Struct `VirtualMachineImageTemplatesClientRunPollerResponse` has been removed +- Struct `VirtualMachineImageTemplatesClientUpdatePoller` has been removed +- Struct `VirtualMachineImageTemplatesClientUpdatePollerResponse` has been removed +- Struct `VirtualMachineImageTemplatesClientUpdateResult` has been removed +- Field `VirtualMachineImageTemplatesClientGetResult` of struct `VirtualMachineImageTemplatesClientGetResponse` has been removed +- Field `RawResponse` of struct `VirtualMachineImageTemplatesClientGetResponse` has been removed +- Field `VirtualMachineImageTemplatesClientCreateOrUpdateResult` of struct `VirtualMachineImageTemplatesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `VirtualMachineImageTemplatesClientCreateOrUpdateResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `VirtualMachineImageTemplatesClientListByResourceGroupResult` of struct `VirtualMachineImageTemplatesClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `VirtualMachineImageTemplatesClientListByResourceGroupResponse` has been removed +- Field `VirtualMachineImageTemplatesClientGetRunOutputResult` of struct `VirtualMachineImageTemplatesClientGetRunOutputResponse` has been removed +- Field `RawResponse` of struct `VirtualMachineImageTemplatesClientGetRunOutputResponse` has been removed +- Field `RawResponse` of struct `VirtualMachineImageTemplatesClientDeleteResponse` has been removed +- Field `RawResponse` of struct `VirtualMachineImageTemplatesClientRunResponse` has been removed +- Field `VirtualMachineImageTemplatesClientUpdateResult` of struct `VirtualMachineImageTemplatesClientUpdateResponse` has been removed +- Field `RawResponse` of struct `VirtualMachineImageTemplatesClientUpdateResponse` has been removed +- Field `VirtualMachineImageTemplatesClientListRunOutputsResult` of struct `VirtualMachineImageTemplatesClientListRunOutputsResponse` has been removed +- Field `RawResponse` of struct `VirtualMachineImageTemplatesClientListRunOutputsResponse` has been removed +- Field `VirtualMachineImageTemplatesClientListResult` of struct `VirtualMachineImageTemplatesClientListResponse` has been removed +- Field `RawResponse` of struct `VirtualMachineImageTemplatesClientListResponse` has been removed +- Field `RawResponse` of struct `VirtualMachineImageTemplatesClientCancelResponse` has been removed + +### Features Added + +- New anonymous field `ImageTemplate` in struct `VirtualMachineImageTemplatesClientCreateOrUpdateResponse` +- New field `ResumeToken` in struct `VirtualMachineImageTemplatesClientBeginDeleteOptions` +- New anonymous field `ImageTemplate` in struct `VirtualMachineImageTemplatesClientUpdateResponse` +- New anonymous field `ImageTemplateListResult` in struct `VirtualMachineImageTemplatesClientListResponse` +- New field `ResumeToken` in struct `VirtualMachineImageTemplatesClientBeginCreateOrUpdateOptions` +- New field `ResumeToken` in struct `VirtualMachineImageTemplatesClientBeginRunOptions` +- New anonymous field `ImageTemplate` in struct `VirtualMachineImageTemplatesClientGetResponse` +- New anonymous field `ImageTemplateListResult` in struct `VirtualMachineImageTemplatesClientListByResourceGroupResponse` +- New anonymous field `RunOutputCollection` in struct `VirtualMachineImageTemplatesClientListRunOutputsResponse` +- New anonymous field `RunOutput` in struct `VirtualMachineImageTemplatesClientGetRunOutputResponse` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New field `ResumeToken` in struct `VirtualMachineImageTemplatesClientBeginUpdateOptions` +- New field `ResumeToken` in struct `VirtualMachineImageTemplatesClientBeginCancelOptions` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/README.md b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/README.md index 8fd607f58a63..c7967e5bb507 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/README.md +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/README.md @@ -11,7 +11,7 @@ The `armvirtualmachineimagebuilder` module provides operations for working with ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Virtual Machine Image Builder modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -client := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient(<subscription ID>, cred, nil) +client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient(<subscription ID>, cred, nil) ``` You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient(<subscription ID>, cred, &options) +client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient(<subscription ID>, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/autorest.md b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/autorest.md index 282777a4158e..4dafa63326a3 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/autorest.md +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/imagebuilder/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/imagebuilder/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/imagebuilder/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/imagebuilder/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.mod b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.mod index 79bdf97da417..a0438e94309d 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.mod +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.sum b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.sum +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_operations_client_test.go index b00dddd59300..fcf534dfc85b 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_operations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,25 +16,29 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder" ) -// x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/OperationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/OperationsList.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvirtualmachineimagebuilder.NewOperationsClient(cred, nil) + client, err := armvirtualmachineimagebuilder.NewOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_virtualmachineimagetemplates_client_test.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_virtualmachineimagetemplates_client_test.go index 7a97a1dedd48..23840d24b59c 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_virtualmachineimagetemplates_client_test.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_virtualmachineimagetemplates_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,72 +19,85 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder" ) -// x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/ListImageTemplates.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/ListImageTemplates.json func ExampleVirtualMachineImageTemplatesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/ListImageTemplatesByRg.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/ListImageTemplatesByRg.json func ExampleVirtualMachineImageTemplatesClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByResourceGroup("<resource-group-name>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/CreateImageTemplateLinux.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/CreateImageTemplateLinux.json func ExampleVirtualMachineImageTemplatesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "<resource-group-name>", "<image-template-name>", armvirtualmachineimagebuilder.ImageTemplate{ - Location: to.StringPtr("<location>"), + Location: to.Ptr("<location>"), Tags: map[string]*string{ - "imagetemplate_tag1": to.StringPtr("IT_T1"), - "imagetemplate_tag2": to.StringPtr("IT_T2"), + "imagetemplate_tag1": to.Ptr("IT_T1"), + "imagetemplate_tag2": to.Ptr("IT_T2"), }, Identity: &armvirtualmachineimagebuilder.ImageTemplateIdentity{ - Type: armvirtualmachineimagebuilder.ResourceIdentityTypeUserAssigned.ToPtr(), + Type: to.Ptr(armvirtualmachineimagebuilder.ResourceIdentityTypeUserAssigned), UserAssignedIdentities: map[string]*armvirtualmachineimagebuilder.ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties{ "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity_1": {}, }, @@ -92,192 +105,242 @@ func ExampleVirtualMachineImageTemplatesClient_BeginCreateOrUpdate() { Properties: &armvirtualmachineimagebuilder.ImageTemplateProperties{ Customize: []armvirtualmachineimagebuilder.ImageTemplateCustomizerClassification{ &armvirtualmachineimagebuilder.ImageTemplateShellCustomizer{ - Name: to.StringPtr("<name>"), - Type: to.StringPtr("<type>"), - ScriptURI: to.StringPtr("<script-uri>"), + Name: to.Ptr("<name>"), + Type: to.Ptr("<type>"), + ScriptURI: to.Ptr("<script-uri>"), }}, Distribute: []armvirtualmachineimagebuilder.ImageTemplateDistributorClassification{ &armvirtualmachineimagebuilder.ImageTemplateManagedImageDistributor{ - Type: to.StringPtr("<type>"), + Type: to.Ptr("<type>"), ArtifactTags: map[string]*string{ - "tagName": to.StringPtr("value"), + "tagName": to.Ptr("value"), }, - RunOutputName: to.StringPtr("<run-output-name>"), - ImageID: to.StringPtr("<image-id>"), - Location: to.StringPtr("<location>"), + RunOutputName: to.Ptr("<run-output-name>"), + ImageID: to.Ptr("<image-id>"), + Location: to.Ptr("<location>"), }}, Source: &armvirtualmachineimagebuilder.ImageTemplateManagedImageSource{ - Type: to.StringPtr("<type>"), - ImageID: to.StringPtr("<image-id>"), + Type: to.Ptr("<type>"), + ImageID: to.Ptr("<image-id>"), }, VMProfile: &armvirtualmachineimagebuilder.ImageTemplateVMProfile{ - OSDiskSizeGB: to.Int32Ptr(64), - VMSize: to.StringPtr("<vmsize>"), + OSDiskSizeGB: to.Ptr[int32](64), + VMSize: to.Ptr("<vmsize>"), VnetConfig: &armvirtualmachineimagebuilder.VirtualNetworkConfig{ - SubnetID: to.StringPtr("<subnet-id>"), + SubnetID: to.Ptr("<subnet-id>"), }, }, }, }, - nil) + &armvirtualmachineimagebuilder.VirtualMachineImageTemplatesClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.VirtualMachineImageTemplatesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/UpdateImageTemplateToRemoveIdentities.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/UpdateImageTemplateToRemoveIdentities.json func ExampleVirtualMachineImageTemplatesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginUpdate(ctx, "<resource-group-name>", "<image-template-name>", armvirtualmachineimagebuilder.ImageTemplateUpdateParameters{ Identity: &armvirtualmachineimagebuilder.ImageTemplateIdentity{ - Type: armvirtualmachineimagebuilder.ResourceIdentityTypeNone.ToPtr(), + Type: to.Ptr(armvirtualmachineimagebuilder.ResourceIdentityTypeNone), }, }, - nil) + &armvirtualmachineimagebuilder.VirtualMachineImageTemplatesClientBeginUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.VirtualMachineImageTemplatesClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/GetImageTemplate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/GetImageTemplate.json func ExampleVirtualMachineImageTemplatesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<image-template-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VirtualMachineImageTemplatesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/DeleteImageTemplate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/DeleteImageTemplate.json func ExampleVirtualMachineImageTemplatesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "<resource-group-name>", "<image-template-name>", - nil) + &armvirtualmachineimagebuilder.VirtualMachineImageTemplatesClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/RunImageTemplate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/RunImageTemplate.json func ExampleVirtualMachineImageTemplatesClient_BeginRun() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginRun(ctx, "<resource-group-name>", "<image-template-name>", - nil) + &armvirtualmachineimagebuilder.VirtualMachineImageTemplatesClientBeginRunOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/CancelImageBuild.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/CancelImageBuild.json func ExampleVirtualMachineImageTemplatesClient_BeginCancel() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCancel(ctx, "<resource-group-name>", "<image-template-name>", - nil) + &armvirtualmachineimagebuilder.VirtualMachineImageTemplatesClientBeginCancelOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/ListRunOutputs.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/ListRunOutputs.json func ExampleVirtualMachineImageTemplatesClient_ListRunOutputs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListRunOutputs("<resource-group-name>", "<image-template-name>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/GetRunOutput.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/GetRunOutput.json func ExampleVirtualMachineImageTemplatesClient_GetRunOutput() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.GetRunOutput(ctx, "<resource-group-name>", "<image-template-name>", "<run-output-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VirtualMachineImageTemplatesClientGetRunOutputResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_constants.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_constants.go index fb3001cb8258..1675a2c418b7 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_constants.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armvirtualmachineimagebuilder const ( moduleName = "armvirtualmachineimagebuilder" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // CreatedByType - The type of identity that created the resource. @@ -33,11 +33,6 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// ToPtr returns a *CreatedByType pointing to the current value. -func (c CreatedByType) ToPtr() *CreatedByType { - return &c -} - // ProvisioningErrorCode - Error code of the provisioning failure type ProvisioningErrorCode string @@ -72,11 +67,6 @@ func PossibleProvisioningErrorCodeValues() []ProvisioningErrorCode { } } -// ToPtr returns a *ProvisioningErrorCode pointing to the current value. -func (c ProvisioningErrorCode) ToPtr() *ProvisioningErrorCode { - return &c -} - // ProvisioningState - Provisioning state of the resource type ProvisioningState string @@ -99,11 +89,6 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// ToPtr returns a *ProvisioningState pointing to the current value. -func (c ProvisioningState) ToPtr() *ProvisioningState { - return &c -} - // ResourceIdentityType - The type of identity used for the image template. The type 'None' will remove any identities from // the image template. type ResourceIdentityType string @@ -121,11 +106,6 @@ func PossibleResourceIdentityTypeValues() []ResourceIdentityType { } } -// ToPtr returns a *ResourceIdentityType pointing to the current value. -func (c ResourceIdentityType) ToPtr() *ResourceIdentityType { - return &c -} - // RunState - State of the last run type RunState string @@ -150,11 +130,6 @@ func PossibleRunStateValues() []RunState { } } -// ToPtr returns a *RunState pointing to the current value. -func (c RunState) ToPtr() *RunState { - return &c -} - // RunSubState - Sub-state of the last run type RunSubState string @@ -175,11 +150,6 @@ func PossibleRunSubStateValues() []RunSubState { } } -// ToPtr returns a *RunSubState pointing to the current value. -func (c RunSubState) ToPtr() *RunSubState { - return &c -} - // SharedImageStorageAccountType - Storage account type to be used to store the shared image. Omit to use the default (Standard_LRS). type SharedImageStorageAccountType string @@ -195,8 +165,3 @@ func PossibleSharedImageStorageAccountTypeValues() []SharedImageStorageAccountTy SharedImageStorageAccountTypeStandardZRS, } } - -// ToPtr returns a *SharedImageStorageAccountType pointing to the current value. -func (c SharedImageStorageAccountType) ToPtr() *SharedImageStorageAccountType { - return &c -} diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models.go index 78212efa223e..3acd82a9d09a 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armvirtualmachineimagebuilder -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // CloudError - An error response from the Azure VM Image Builder service. type CloudError struct { @@ -36,16 +31,6 @@ type CloudErrorBody struct { Target *string `json:"target,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CloudErrorBody. -func (c CloudErrorBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", c.Code) - populate(objectMap, "details", c.Details) - populate(objectMap, "message", c.Message) - populate(objectMap, "target", c.Target) - return json.Marshal(objectMap) -} - type ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties struct { // READ-ONLY; The client id of user assigned identity. ClientID *string `json:"clientId,omitempty" azure:"ro"` @@ -81,20 +66,6 @@ type ImageTemplate struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ImageTemplate. -func (i ImageTemplate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", i.ID) - populate(objectMap, "identity", i.Identity) - populate(objectMap, "location", i.Location) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "systemData", i.SystemData) - populate(objectMap, "tags", i.Tags) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - // ImageTemplateCustomizerClassification provides polymorphic access to related types. // Call the interface's GetImageTemplateCustomizer() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -114,9 +85,6 @@ type ImageTemplateCustomizer struct { Name *string `json:"name,omitempty"` } -// GetImageTemplateCustomizer implements the ImageTemplateCustomizerClassification interface for type ImageTemplateCustomizer. -func (i *ImageTemplateCustomizer) GetImageTemplateCustomizer() *ImageTemplateCustomizer { return i } - // ImageTemplateDistributorClassification provides polymorphic access to related types. // Call the interface's GetImageTemplateDistributor() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -138,18 +106,6 @@ type ImageTemplateDistributor struct { ArtifactTags map[string]*string `json:"artifactTags,omitempty"` } -// GetImageTemplateDistributor implements the ImageTemplateDistributorClassification interface for type ImageTemplateDistributor. -func (i *ImageTemplateDistributor) GetImageTemplateDistributor() *ImageTemplateDistributor { return i } - -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateDistributor. -func (i ImageTemplateDistributor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "artifactTags", i.ArtifactTags) - populate(objectMap, "runOutputName", i.RunOutputName) - objectMap["type"] = i.Type - return json.Marshal(objectMap) -} - // ImageTemplateFileCustomizer - Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner type ImageTemplateFileCustomizer struct { // REQUIRED; The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer @@ -169,57 +125,6 @@ type ImageTemplateFileCustomizer struct { SourceURI *string `json:"sourceUri,omitempty"` } -// GetImageTemplateCustomizer implements the ImageTemplateCustomizerClassification interface for type ImageTemplateFileCustomizer. -func (i *ImageTemplateFileCustomizer) GetImageTemplateCustomizer() *ImageTemplateCustomizer { - return &ImageTemplateCustomizer{ - Type: i.Type, - Name: i.Name, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateFileCustomizer. -func (i ImageTemplateFileCustomizer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "destination", i.Destination) - populate(objectMap, "name", i.Name) - populate(objectMap, "sha256Checksum", i.SHA256Checksum) - populate(objectMap, "sourceUri", i.SourceURI) - objectMap["type"] = "File" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateFileCustomizer. -func (i *ImageTemplateFileCustomizer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "destination": - err = unpopulate(val, &i.Destination) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &i.Name) - delete(rawMsg, key) - case "sha256Checksum": - err = unpopulate(val, &i.SHA256Checksum) - delete(rawMsg, key) - case "sourceUri": - err = unpopulate(val, &i.SourceURI) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &i.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ImageTemplateIdentity - Identity for the image template. type ImageTemplateIdentity struct { // The type of identity used for the image template. The type 'None' will remove any identities from the image template. @@ -231,14 +136,6 @@ type ImageTemplateIdentity struct { UserAssignedIdentities map[string]*ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties `json:"userAssignedIdentities,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateIdentity. -func (i ImageTemplateIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "type", i.Type) - populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) - return json.Marshal(objectMap) -} - // ImageTemplateLastRunStatus - Describes the latest status of running an image template type ImageTemplateLastRunStatus struct { // End time of the last run (UTC) @@ -257,49 +154,6 @@ type ImageTemplateLastRunStatus struct { StartTime *time.Time `json:"startTime,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateLastRunStatus. -func (i ImageTemplateLastRunStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "endTime", i.EndTime) - populate(objectMap, "message", i.Message) - populate(objectMap, "runState", i.RunState) - populate(objectMap, "runSubState", i.RunSubState) - populateTimeRFC3339(objectMap, "startTime", i.StartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateLastRunStatus. -func (i *ImageTemplateLastRunStatus) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateTimeRFC3339(val, &i.EndTime) - delete(rawMsg, key) - case "message": - err = unpopulate(val, &i.Message) - delete(rawMsg, key) - case "runState": - err = unpopulate(val, &i.RunState) - delete(rawMsg, key) - case "runSubState": - err = unpopulate(val, &i.RunSubState) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &i.StartTime) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ImageTemplateListResult - The result of List image templates operation type ImageTemplateListResult struct { // The continuation token. @@ -309,14 +163,6 @@ type ImageTemplateListResult struct { Value []*ImageTemplate `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateListResult. -func (i ImageTemplateListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) - return json.Marshal(objectMap) -} - // ImageTemplateManagedImageDistributor - Distribute as a Managed Disk Image. type ImageTemplateManagedImageDistributor struct { // REQUIRED; Resource Id of the Managed Disk Image @@ -335,58 +181,6 @@ type ImageTemplateManagedImageDistributor struct { ArtifactTags map[string]*string `json:"artifactTags,omitempty"` } -// GetImageTemplateDistributor implements the ImageTemplateDistributorClassification interface for type ImageTemplateManagedImageDistributor. -func (i *ImageTemplateManagedImageDistributor) GetImageTemplateDistributor() *ImageTemplateDistributor { - return &ImageTemplateDistributor{ - Type: i.Type, - RunOutputName: i.RunOutputName, - ArtifactTags: i.ArtifactTags, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateManagedImageDistributor. -func (i ImageTemplateManagedImageDistributor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "artifactTags", i.ArtifactTags) - populate(objectMap, "imageId", i.ImageID) - populate(objectMap, "location", i.Location) - populate(objectMap, "runOutputName", i.RunOutputName) - objectMap["type"] = "ManagedImage" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateManagedImageDistributor. -func (i *ImageTemplateManagedImageDistributor) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "artifactTags": - err = unpopulate(val, &i.ArtifactTags) - delete(rawMsg, key) - case "imageId": - err = unpopulate(val, &i.ImageID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, &i.Location) - delete(rawMsg, key) - case "runOutputName": - err = unpopulate(val, &i.RunOutputName) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &i.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ImageTemplateManagedImageSource - Describes an image source that is a managed image in customer subscription. type ImageTemplateManagedImageSource struct { // REQUIRED; ARM resource id of the managed image in customer subscription @@ -396,44 +190,6 @@ type ImageTemplateManagedImageSource struct { Type *string `json:"type,omitempty"` } -// GetImageTemplateSource implements the ImageTemplateSourceClassification interface for type ImageTemplateManagedImageSource. -func (i *ImageTemplateManagedImageSource) GetImageTemplateSource() *ImageTemplateSource { - return &ImageTemplateSource{ - Type: i.Type, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateManagedImageSource. -func (i ImageTemplateManagedImageSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "imageId", i.ImageID) - objectMap["type"] = "ManagedImage" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateManagedImageSource. -func (i *ImageTemplateManagedImageSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "imageId": - err = unpopulate(val, &i.ImageID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &i.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ImageTemplatePlatformImageSource - Describes an image source from Azure Gallery Images [https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages]. type ImageTemplatePlatformImageSource struct { // REQUIRED; Specifies the type of source image you want to start with. @@ -462,64 +218,6 @@ type ImageTemplatePlatformImageSource struct { ExactVersion *string `json:"exactVersion,omitempty" azure:"ro"` } -// GetImageTemplateSource implements the ImageTemplateSourceClassification interface for type ImageTemplatePlatformImageSource. -func (i *ImageTemplatePlatformImageSource) GetImageTemplateSource() *ImageTemplateSource { - return &ImageTemplateSource{ - Type: i.Type, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ImageTemplatePlatformImageSource. -func (i ImageTemplatePlatformImageSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "exactVersion", i.ExactVersion) - populate(objectMap, "offer", i.Offer) - populate(objectMap, "planInfo", i.PlanInfo) - populate(objectMap, "publisher", i.Publisher) - populate(objectMap, "sku", i.SKU) - objectMap["type"] = "PlatformImage" - populate(objectMap, "version", i.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplatePlatformImageSource. -func (i *ImageTemplatePlatformImageSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "exactVersion": - err = unpopulate(val, &i.ExactVersion) - delete(rawMsg, key) - case "offer": - err = unpopulate(val, &i.Offer) - delete(rawMsg, key) - case "planInfo": - err = unpopulate(val, &i.PlanInfo) - delete(rawMsg, key) - case "publisher": - err = unpopulate(val, &i.Publisher) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, &i.SKU) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &i.Type) - delete(rawMsg, key) - case "version": - err = unpopulate(val, &i.Version) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ImageTemplatePowerShellCustomizer - Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell // provisioner. Exactly one of 'scriptUri' or 'inline' can be specified. type ImageTemplatePowerShellCustomizer struct { @@ -549,69 +247,6 @@ type ImageTemplatePowerShellCustomizer struct { ValidExitCodes []*int32 `json:"validExitCodes,omitempty"` } -// GetImageTemplateCustomizer implements the ImageTemplateCustomizerClassification interface for type ImageTemplatePowerShellCustomizer. -func (i *ImageTemplatePowerShellCustomizer) GetImageTemplateCustomizer() *ImageTemplateCustomizer { - return &ImageTemplateCustomizer{ - Type: i.Type, - Name: i.Name, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ImageTemplatePowerShellCustomizer. -func (i ImageTemplatePowerShellCustomizer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "inline", i.Inline) - populate(objectMap, "name", i.Name) - populate(objectMap, "runAsSystem", i.RunAsSystem) - populate(objectMap, "runElevated", i.RunElevated) - populate(objectMap, "sha256Checksum", i.SHA256Checksum) - populate(objectMap, "scriptUri", i.ScriptURI) - objectMap["type"] = "PowerShell" - populate(objectMap, "validExitCodes", i.ValidExitCodes) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplatePowerShellCustomizer. -func (i *ImageTemplatePowerShellCustomizer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "inline": - err = unpopulate(val, &i.Inline) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &i.Name) - delete(rawMsg, key) - case "runAsSystem": - err = unpopulate(val, &i.RunAsSystem) - delete(rawMsg, key) - case "runElevated": - err = unpopulate(val, &i.RunElevated) - delete(rawMsg, key) - case "sha256Checksum": - err = unpopulate(val, &i.SHA256Checksum) - delete(rawMsg, key) - case "scriptUri": - err = unpopulate(val, &i.ScriptURI) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &i.Type) - delete(rawMsg, key) - case "validExitCodes": - err = unpopulate(val, &i.ValidExitCodes) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ImageTemplateProperties - Describes the properties of an image template type ImageTemplateProperties struct { // REQUIRED; The distribution targets where the image output needs to go to. @@ -639,61 +274,6 @@ type ImageTemplateProperties struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateProperties. -func (i ImageTemplateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "buildTimeoutInMinutes", i.BuildTimeoutInMinutes) - populate(objectMap, "customize", i.Customize) - populate(objectMap, "distribute", i.Distribute) - populate(objectMap, "lastRunStatus", i.LastRunStatus) - populate(objectMap, "provisioningError", i.ProvisioningError) - populate(objectMap, "provisioningState", i.ProvisioningState) - populate(objectMap, "source", i.Source) - populate(objectMap, "vmProfile", i.VMProfile) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateProperties. -func (i *ImageTemplateProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "buildTimeoutInMinutes": - err = unpopulate(val, &i.BuildTimeoutInMinutes) - delete(rawMsg, key) - case "customize": - i.Customize, err = unmarshalImageTemplateCustomizerClassificationArray(val) - delete(rawMsg, key) - case "distribute": - i.Distribute, err = unmarshalImageTemplateDistributorClassificationArray(val) - delete(rawMsg, key) - case "lastRunStatus": - err = unpopulate(val, &i.LastRunStatus) - delete(rawMsg, key) - case "provisioningError": - err = unpopulate(val, &i.ProvisioningError) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &i.ProvisioningState) - delete(rawMsg, key) - case "source": - i.Source, err = unmarshalImageTemplateSourceClassification(val) - delete(rawMsg, key) - case "vmProfile": - err = unpopulate(val, &i.VMProfile) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ImageTemplateRestartCustomizer - Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart // provisioner type ImageTemplateRestartCustomizer struct { @@ -713,57 +293,6 @@ type ImageTemplateRestartCustomizer struct { RestartTimeout *string `json:"restartTimeout,omitempty"` } -// GetImageTemplateCustomizer implements the ImageTemplateCustomizerClassification interface for type ImageTemplateRestartCustomizer. -func (i *ImageTemplateRestartCustomizer) GetImageTemplateCustomizer() *ImageTemplateCustomizer { - return &ImageTemplateCustomizer{ - Type: i.Type, - Name: i.Name, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateRestartCustomizer. -func (i ImageTemplateRestartCustomizer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", i.Name) - populate(objectMap, "restartCheckCommand", i.RestartCheckCommand) - populate(objectMap, "restartCommand", i.RestartCommand) - populate(objectMap, "restartTimeout", i.RestartTimeout) - objectMap["type"] = "WindowsRestart" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateRestartCustomizer. -func (i *ImageTemplateRestartCustomizer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, &i.Name) - delete(rawMsg, key) - case "restartCheckCommand": - err = unpopulate(val, &i.RestartCheckCommand) - delete(rawMsg, key) - case "restartCommand": - err = unpopulate(val, &i.RestartCommand) - delete(rawMsg, key) - case "restartTimeout": - err = unpopulate(val, &i.RestartTimeout) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &i.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ImageTemplateSharedImageDistributor - Distribute via Shared Image Gallery. type ImageTemplateSharedImageDistributor struct { // REQUIRED; Resource Id of the Shared Image Gallery image @@ -788,66 +317,6 @@ type ImageTemplateSharedImageDistributor struct { StorageAccountType *SharedImageStorageAccountType `json:"storageAccountType,omitempty"` } -// GetImageTemplateDistributor implements the ImageTemplateDistributorClassification interface for type ImageTemplateSharedImageDistributor. -func (i *ImageTemplateSharedImageDistributor) GetImageTemplateDistributor() *ImageTemplateDistributor { - return &ImageTemplateDistributor{ - Type: i.Type, - RunOutputName: i.RunOutputName, - ArtifactTags: i.ArtifactTags, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateSharedImageDistributor. -func (i ImageTemplateSharedImageDistributor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "artifactTags", i.ArtifactTags) - populate(objectMap, "excludeFromLatest", i.ExcludeFromLatest) - populate(objectMap, "galleryImageId", i.GalleryImageID) - populate(objectMap, "replicationRegions", i.ReplicationRegions) - populate(objectMap, "runOutputName", i.RunOutputName) - populate(objectMap, "storageAccountType", i.StorageAccountType) - objectMap["type"] = "SharedImage" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateSharedImageDistributor. -func (i *ImageTemplateSharedImageDistributor) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "artifactTags": - err = unpopulate(val, &i.ArtifactTags) - delete(rawMsg, key) - case "excludeFromLatest": - err = unpopulate(val, &i.ExcludeFromLatest) - delete(rawMsg, key) - case "galleryImageId": - err = unpopulate(val, &i.GalleryImageID) - delete(rawMsg, key) - case "replicationRegions": - err = unpopulate(val, &i.ReplicationRegions) - delete(rawMsg, key) - case "runOutputName": - err = unpopulate(val, &i.RunOutputName) - delete(rawMsg, key) - case "storageAccountType": - err = unpopulate(val, &i.StorageAccountType) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &i.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ImageTemplateSharedImageVersionSource - Describes an image source that is an image version in a shared image gallery. type ImageTemplateSharedImageVersionSource struct { // REQUIRED; ARM resource id of the image version in the shared image gallery @@ -857,44 +326,6 @@ type ImageTemplateSharedImageVersionSource struct { Type *string `json:"type,omitempty"` } -// GetImageTemplateSource implements the ImageTemplateSourceClassification interface for type ImageTemplateSharedImageVersionSource. -func (i *ImageTemplateSharedImageVersionSource) GetImageTemplateSource() *ImageTemplateSource { - return &ImageTemplateSource{ - Type: i.Type, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateSharedImageVersionSource. -func (i ImageTemplateSharedImageVersionSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "imageVersionId", i.ImageVersionID) - objectMap["type"] = "SharedImageVersion" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateSharedImageVersionSource. -func (i *ImageTemplateSharedImageVersionSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "imageVersionId": - err = unpopulate(val, &i.ImageVersionID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &i.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ImageTemplateShellCustomizer - Runs a shell script during the customization phase (Linux). Corresponds to Packer shell // provisioner. Exactly one of 'scriptUri' or 'inline' can be specified. type ImageTemplateShellCustomizer struct { @@ -914,57 +345,6 @@ type ImageTemplateShellCustomizer struct { ScriptURI *string `json:"scriptUri,omitempty"` } -// GetImageTemplateCustomizer implements the ImageTemplateCustomizerClassification interface for type ImageTemplateShellCustomizer. -func (i *ImageTemplateShellCustomizer) GetImageTemplateCustomizer() *ImageTemplateCustomizer { - return &ImageTemplateCustomizer{ - Type: i.Type, - Name: i.Name, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateShellCustomizer. -func (i ImageTemplateShellCustomizer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "inline", i.Inline) - populate(objectMap, "name", i.Name) - populate(objectMap, "sha256Checksum", i.SHA256Checksum) - populate(objectMap, "scriptUri", i.ScriptURI) - objectMap["type"] = "Shell" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateShellCustomizer. -func (i *ImageTemplateShellCustomizer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "inline": - err = unpopulate(val, &i.Inline) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &i.Name) - delete(rawMsg, key) - case "sha256Checksum": - err = unpopulate(val, &i.SHA256Checksum) - delete(rawMsg, key) - case "scriptUri": - err = unpopulate(val, &i.ScriptURI) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &i.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ImageTemplateSourceClassification provides polymorphic access to related types. // Call the interface's GetImageTemplateSource() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -980,9 +360,6 @@ type ImageTemplateSource struct { Type *string `json:"type,omitempty"` } -// GetImageTemplateSource implements the ImageTemplateSourceClassification interface for type ImageTemplateSource. -func (i *ImageTemplateSource) GetImageTemplateSource() *ImageTemplateSource { return i } - // ImageTemplateUpdateParameters - Parameters for updating an image template. type ImageTemplateUpdateParameters struct { // The identity of the image template, if configured. @@ -992,14 +369,6 @@ type ImageTemplateUpdateParameters struct { Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateUpdateParameters. -func (i ImageTemplateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", i.Identity) - populate(objectMap, "tags", i.Tags) - return json.Marshal(objectMap) -} - // ImageTemplateVMProfile - Describes the virtual machine used to build, customize and capture images type ImageTemplateVMProfile struct { // Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. @@ -1018,16 +387,6 @@ type ImageTemplateVMProfile struct { VnetConfig *VirtualNetworkConfig `json:"vnetConfig,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateVMProfile. -func (i ImageTemplateVMProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "osDiskSizeGB", i.OSDiskSizeGB) - populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) - populate(objectMap, "vmSize", i.VMSize) - populate(objectMap, "vnetConfig", i.VnetConfig) - return json.Marshal(objectMap) -} - // ImageTemplateVhdDistributor - Distribute via VHD in a storage account. type ImageTemplateVhdDistributor struct { // REQUIRED; The name to be used for the associated RunOutput. @@ -1040,50 +399,6 @@ type ImageTemplateVhdDistributor struct { ArtifactTags map[string]*string `json:"artifactTags,omitempty"` } -// GetImageTemplateDistributor implements the ImageTemplateDistributorClassification interface for type ImageTemplateVhdDistributor. -func (i *ImageTemplateVhdDistributor) GetImageTemplateDistributor() *ImageTemplateDistributor { - return &ImageTemplateDistributor{ - Type: i.Type, - RunOutputName: i.RunOutputName, - ArtifactTags: i.ArtifactTags, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateVhdDistributor. -func (i ImageTemplateVhdDistributor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "artifactTags", i.ArtifactTags) - populate(objectMap, "runOutputName", i.RunOutputName) - objectMap["type"] = "VHD" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateVhdDistributor. -func (i *ImageTemplateVhdDistributor) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "artifactTags": - err = unpopulate(val, &i.ArtifactTags) - delete(rawMsg, key) - case "runOutputName": - err = unpopulate(val, &i.RunOutputName) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &i.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ImageTemplateWindowsUpdateCustomizer - Installs Windows Updates. Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update) type ImageTemplateWindowsUpdateCustomizer struct { // REQUIRED; The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer @@ -1104,57 +419,6 @@ type ImageTemplateWindowsUpdateCustomizer struct { UpdateLimit *int32 `json:"updateLimit,omitempty"` } -// GetImageTemplateCustomizer implements the ImageTemplateCustomizerClassification interface for type ImageTemplateWindowsUpdateCustomizer. -func (i *ImageTemplateWindowsUpdateCustomizer) GetImageTemplateCustomizer() *ImageTemplateCustomizer { - return &ImageTemplateCustomizer{ - Type: i.Type, - Name: i.Name, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ImageTemplateWindowsUpdateCustomizer. -func (i ImageTemplateWindowsUpdateCustomizer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filters", i.Filters) - populate(objectMap, "name", i.Name) - populate(objectMap, "searchCriteria", i.SearchCriteria) - objectMap["type"] = "WindowsUpdate" - populate(objectMap, "updateLimit", i.UpdateLimit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateWindowsUpdateCustomizer. -func (i *ImageTemplateWindowsUpdateCustomizer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "filters": - err = unpopulate(val, &i.Filters) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &i.Name) - delete(rawMsg, key) - case "searchCriteria": - err = unpopulate(val, &i.SearchCriteria) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &i.Type) - delete(rawMsg, key) - case "updateLimit": - err = unpopulate(val, &i.UpdateLimit) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // Operation - A REST API operation type Operation struct { // The object that describes the operation. @@ -1169,8 +433,8 @@ type Operation struct { // The intended executor of the operation. Origin *string `json:"origin,omitempty"` - // Any object - Properties map[string]interface{} `json:"properties,omitempty"` + // Properties of the operation. + Properties interface{} `json:"properties,omitempty"` } // OperationDisplay - The object that describes the operation. @@ -1198,14 +462,6 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -1268,14 +524,6 @@ type RunOutputCollection struct { Value []*RunOutput `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type RunOutputCollection. -func (r RunOutputCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - // RunOutputProperties - Describes the properties of a run output type RunOutputProperties struct { // The resource id of the artifact. @@ -1321,53 +569,6 @@ type SystemData struct { LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { @@ -1387,45 +588,39 @@ type TrackedResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - // VirtualMachineImageTemplatesClientBeginCancelOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.BeginCancel // method. type VirtualMachineImageTemplatesClientBeginCancelOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // VirtualMachineImageTemplatesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.BeginCreateOrUpdate // method. type VirtualMachineImageTemplatesClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // VirtualMachineImageTemplatesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.BeginDelete // method. type VirtualMachineImageTemplatesClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // VirtualMachineImageTemplatesClientBeginRunOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.BeginRun // method. type VirtualMachineImageTemplatesClientBeginRunOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // VirtualMachineImageTemplatesClientBeginUpdateOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.BeginUpdate // method. type VirtualMachineImageTemplatesClientBeginUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // VirtualMachineImageTemplatesClientGetOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.Get @@ -1467,20 +662,3 @@ type VirtualNetworkConfig struct { // Resource id of a pre-existing subnet. SubnetID *string `json:"subnetId,omitempty"` } - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models_serde.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models_serde.go new file mode 100644 index 000000000000..9f06178cb03d --- /dev/null +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models_serde.go @@ -0,0 +1,837 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armvirtualmachineimagebuilder + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type CloudErrorBody. +func (c CloudErrorBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", c.Code) + populate(objectMap, "details", c.Details) + populate(objectMap, "message", c.Message) + populate(objectMap, "target", c.Target) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplate. +func (i ImageTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "identity", i.Identity) + populate(objectMap, "location", i.Location) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// GetImageTemplateCustomizer implements the ImageTemplateCustomizerClassification interface for type ImageTemplateCustomizer. +func (i *ImageTemplateCustomizer) GetImageTemplateCustomizer() *ImageTemplateCustomizer { return i } + +// GetImageTemplateDistributor implements the ImageTemplateDistributorClassification interface for type ImageTemplateDistributor. +func (i *ImageTemplateDistributor) GetImageTemplateDistributor() *ImageTemplateDistributor { return i } + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateDistributor. +func (i ImageTemplateDistributor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "artifactTags", i.ArtifactTags) + populate(objectMap, "runOutputName", i.RunOutputName) + objectMap["type"] = i.Type + return json.Marshal(objectMap) +} + +// GetImageTemplateCustomizer implements the ImageTemplateCustomizerClassification interface for type ImageTemplateFileCustomizer. +func (i *ImageTemplateFileCustomizer) GetImageTemplateCustomizer() *ImageTemplateCustomizer { + return &ImageTemplateCustomizer{ + Type: i.Type, + Name: i.Name, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateFileCustomizer. +func (i ImageTemplateFileCustomizer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destination", i.Destination) + populate(objectMap, "name", i.Name) + populate(objectMap, "sha256Checksum", i.SHA256Checksum) + populate(objectMap, "sourceUri", i.SourceURI) + objectMap["type"] = "File" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateFileCustomizer. +func (i *ImageTemplateFileCustomizer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "destination": + err = unpopulate(val, &i.Destination) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &i.Name) + delete(rawMsg, key) + case "sha256Checksum": + err = unpopulate(val, &i.SHA256Checksum) + delete(rawMsg, key) + case "sourceUri": + err = unpopulate(val, &i.SourceURI) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &i.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateIdentity. +func (i ImageTemplateIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateLastRunStatus. +func (i ImageTemplateLastRunStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", i.EndTime) + populate(objectMap, "message", i.Message) + populate(objectMap, "runState", i.RunState) + populate(objectMap, "runSubState", i.RunSubState) + populateTimeRFC3339(objectMap, "startTime", i.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateLastRunStatus. +func (i *ImageTemplateLastRunStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, &i.EndTime) + delete(rawMsg, key) + case "message": + err = unpopulate(val, &i.Message) + delete(rawMsg, key) + case "runState": + err = unpopulate(val, &i.RunState) + delete(rawMsg, key) + case "runSubState": + err = unpopulate(val, &i.RunSubState) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &i.StartTime) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateListResult. +func (i ImageTemplateListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// GetImageTemplateDistributor implements the ImageTemplateDistributorClassification interface for type ImageTemplateManagedImageDistributor. +func (i *ImageTemplateManagedImageDistributor) GetImageTemplateDistributor() *ImageTemplateDistributor { + return &ImageTemplateDistributor{ + Type: i.Type, + RunOutputName: i.RunOutputName, + ArtifactTags: i.ArtifactTags, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateManagedImageDistributor. +func (i ImageTemplateManagedImageDistributor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "artifactTags", i.ArtifactTags) + populate(objectMap, "imageId", i.ImageID) + populate(objectMap, "location", i.Location) + populate(objectMap, "runOutputName", i.RunOutputName) + objectMap["type"] = "ManagedImage" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateManagedImageDistributor. +func (i *ImageTemplateManagedImageDistributor) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "artifactTags": + err = unpopulate(val, &i.ArtifactTags) + delete(rawMsg, key) + case "imageId": + err = unpopulate(val, &i.ImageID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, &i.Location) + delete(rawMsg, key) + case "runOutputName": + err = unpopulate(val, &i.RunOutputName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &i.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetImageTemplateSource implements the ImageTemplateSourceClassification interface for type ImageTemplateManagedImageSource. +func (i *ImageTemplateManagedImageSource) GetImageTemplateSource() *ImageTemplateSource { + return &ImageTemplateSource{ + Type: i.Type, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateManagedImageSource. +func (i ImageTemplateManagedImageSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "imageId", i.ImageID) + objectMap["type"] = "ManagedImage" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateManagedImageSource. +func (i *ImageTemplateManagedImageSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "imageId": + err = unpopulate(val, &i.ImageID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &i.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetImageTemplateSource implements the ImageTemplateSourceClassification interface for type ImageTemplatePlatformImageSource. +func (i *ImageTemplatePlatformImageSource) GetImageTemplateSource() *ImageTemplateSource { + return &ImageTemplateSource{ + Type: i.Type, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplatePlatformImageSource. +func (i ImageTemplatePlatformImageSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "exactVersion", i.ExactVersion) + populate(objectMap, "offer", i.Offer) + populate(objectMap, "planInfo", i.PlanInfo) + populate(objectMap, "publisher", i.Publisher) + populate(objectMap, "sku", i.SKU) + objectMap["type"] = "PlatformImage" + populate(objectMap, "version", i.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplatePlatformImageSource. +func (i *ImageTemplatePlatformImageSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "exactVersion": + err = unpopulate(val, &i.ExactVersion) + delete(rawMsg, key) + case "offer": + err = unpopulate(val, &i.Offer) + delete(rawMsg, key) + case "planInfo": + err = unpopulate(val, &i.PlanInfo) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, &i.Publisher) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, &i.SKU) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &i.Type) + delete(rawMsg, key) + case "version": + err = unpopulate(val, &i.Version) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetImageTemplateCustomizer implements the ImageTemplateCustomizerClassification interface for type ImageTemplatePowerShellCustomizer. +func (i *ImageTemplatePowerShellCustomizer) GetImageTemplateCustomizer() *ImageTemplateCustomizer { + return &ImageTemplateCustomizer{ + Type: i.Type, + Name: i.Name, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplatePowerShellCustomizer. +func (i ImageTemplatePowerShellCustomizer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inline", i.Inline) + populate(objectMap, "name", i.Name) + populate(objectMap, "runAsSystem", i.RunAsSystem) + populate(objectMap, "runElevated", i.RunElevated) + populate(objectMap, "sha256Checksum", i.SHA256Checksum) + populate(objectMap, "scriptUri", i.ScriptURI) + objectMap["type"] = "PowerShell" + populate(objectMap, "validExitCodes", i.ValidExitCodes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplatePowerShellCustomizer. +func (i *ImageTemplatePowerShellCustomizer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "inline": + err = unpopulate(val, &i.Inline) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &i.Name) + delete(rawMsg, key) + case "runAsSystem": + err = unpopulate(val, &i.RunAsSystem) + delete(rawMsg, key) + case "runElevated": + err = unpopulate(val, &i.RunElevated) + delete(rawMsg, key) + case "sha256Checksum": + err = unpopulate(val, &i.SHA256Checksum) + delete(rawMsg, key) + case "scriptUri": + err = unpopulate(val, &i.ScriptURI) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &i.Type) + delete(rawMsg, key) + case "validExitCodes": + err = unpopulate(val, &i.ValidExitCodes) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateProperties. +func (i ImageTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "buildTimeoutInMinutes", i.BuildTimeoutInMinutes) + populate(objectMap, "customize", i.Customize) + populate(objectMap, "distribute", i.Distribute) + populate(objectMap, "lastRunStatus", i.LastRunStatus) + populate(objectMap, "provisioningError", i.ProvisioningError) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "source", i.Source) + populate(objectMap, "vmProfile", i.VMProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateProperties. +func (i *ImageTemplateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "buildTimeoutInMinutes": + err = unpopulate(val, &i.BuildTimeoutInMinutes) + delete(rawMsg, key) + case "customize": + i.Customize, err = unmarshalImageTemplateCustomizerClassificationArray(val) + delete(rawMsg, key) + case "distribute": + i.Distribute, err = unmarshalImageTemplateDistributorClassificationArray(val) + delete(rawMsg, key) + case "lastRunStatus": + err = unpopulate(val, &i.LastRunStatus) + delete(rawMsg, key) + case "provisioningError": + err = unpopulate(val, &i.ProvisioningError) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &i.ProvisioningState) + delete(rawMsg, key) + case "source": + i.Source, err = unmarshalImageTemplateSourceClassification(val) + delete(rawMsg, key) + case "vmProfile": + err = unpopulate(val, &i.VMProfile) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetImageTemplateCustomizer implements the ImageTemplateCustomizerClassification interface for type ImageTemplateRestartCustomizer. +func (i *ImageTemplateRestartCustomizer) GetImageTemplateCustomizer() *ImageTemplateCustomizer { + return &ImageTemplateCustomizer{ + Type: i.Type, + Name: i.Name, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateRestartCustomizer. +func (i ImageTemplateRestartCustomizer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", i.Name) + populate(objectMap, "restartCheckCommand", i.RestartCheckCommand) + populate(objectMap, "restartCommand", i.RestartCommand) + populate(objectMap, "restartTimeout", i.RestartTimeout) + objectMap["type"] = "WindowsRestart" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateRestartCustomizer. +func (i *ImageTemplateRestartCustomizer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, &i.Name) + delete(rawMsg, key) + case "restartCheckCommand": + err = unpopulate(val, &i.RestartCheckCommand) + delete(rawMsg, key) + case "restartCommand": + err = unpopulate(val, &i.RestartCommand) + delete(rawMsg, key) + case "restartTimeout": + err = unpopulate(val, &i.RestartTimeout) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &i.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetImageTemplateDistributor implements the ImageTemplateDistributorClassification interface for type ImageTemplateSharedImageDistributor. +func (i *ImageTemplateSharedImageDistributor) GetImageTemplateDistributor() *ImageTemplateDistributor { + return &ImageTemplateDistributor{ + Type: i.Type, + RunOutputName: i.RunOutputName, + ArtifactTags: i.ArtifactTags, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateSharedImageDistributor. +func (i ImageTemplateSharedImageDistributor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "artifactTags", i.ArtifactTags) + populate(objectMap, "excludeFromLatest", i.ExcludeFromLatest) + populate(objectMap, "galleryImageId", i.GalleryImageID) + populate(objectMap, "replicationRegions", i.ReplicationRegions) + populate(objectMap, "runOutputName", i.RunOutputName) + populate(objectMap, "storageAccountType", i.StorageAccountType) + objectMap["type"] = "SharedImage" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateSharedImageDistributor. +func (i *ImageTemplateSharedImageDistributor) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "artifactTags": + err = unpopulate(val, &i.ArtifactTags) + delete(rawMsg, key) + case "excludeFromLatest": + err = unpopulate(val, &i.ExcludeFromLatest) + delete(rawMsg, key) + case "galleryImageId": + err = unpopulate(val, &i.GalleryImageID) + delete(rawMsg, key) + case "replicationRegions": + err = unpopulate(val, &i.ReplicationRegions) + delete(rawMsg, key) + case "runOutputName": + err = unpopulate(val, &i.RunOutputName) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, &i.StorageAccountType) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &i.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetImageTemplateSource implements the ImageTemplateSourceClassification interface for type ImageTemplateSharedImageVersionSource. +func (i *ImageTemplateSharedImageVersionSource) GetImageTemplateSource() *ImageTemplateSource { + return &ImageTemplateSource{ + Type: i.Type, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateSharedImageVersionSource. +func (i ImageTemplateSharedImageVersionSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "imageVersionId", i.ImageVersionID) + objectMap["type"] = "SharedImageVersion" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateSharedImageVersionSource. +func (i *ImageTemplateSharedImageVersionSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "imageVersionId": + err = unpopulate(val, &i.ImageVersionID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &i.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetImageTemplateCustomizer implements the ImageTemplateCustomizerClassification interface for type ImageTemplateShellCustomizer. +func (i *ImageTemplateShellCustomizer) GetImageTemplateCustomizer() *ImageTemplateCustomizer { + return &ImageTemplateCustomizer{ + Type: i.Type, + Name: i.Name, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateShellCustomizer. +func (i ImageTemplateShellCustomizer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inline", i.Inline) + populate(objectMap, "name", i.Name) + populate(objectMap, "sha256Checksum", i.SHA256Checksum) + populate(objectMap, "scriptUri", i.ScriptURI) + objectMap["type"] = "Shell" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateShellCustomizer. +func (i *ImageTemplateShellCustomizer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "inline": + err = unpopulate(val, &i.Inline) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &i.Name) + delete(rawMsg, key) + case "sha256Checksum": + err = unpopulate(val, &i.SHA256Checksum) + delete(rawMsg, key) + case "scriptUri": + err = unpopulate(val, &i.ScriptURI) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &i.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetImageTemplateSource implements the ImageTemplateSourceClassification interface for type ImageTemplateSource. +func (i *ImageTemplateSource) GetImageTemplateSource() *ImageTemplateSource { return i } + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateUpdateParameters. +func (i ImageTemplateUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", i.Identity) + populate(objectMap, "tags", i.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateVMProfile. +func (i ImageTemplateVMProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "osDiskSizeGB", i.OSDiskSizeGB) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + populate(objectMap, "vmSize", i.VMSize) + populate(objectMap, "vnetConfig", i.VnetConfig) + return json.Marshal(objectMap) +} + +// GetImageTemplateDistributor implements the ImageTemplateDistributorClassification interface for type ImageTemplateVhdDistributor. +func (i *ImageTemplateVhdDistributor) GetImageTemplateDistributor() *ImageTemplateDistributor { + return &ImageTemplateDistributor{ + Type: i.Type, + RunOutputName: i.RunOutputName, + ArtifactTags: i.ArtifactTags, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateVhdDistributor. +func (i ImageTemplateVhdDistributor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "artifactTags", i.ArtifactTags) + populate(objectMap, "runOutputName", i.RunOutputName) + objectMap["type"] = "VHD" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateVhdDistributor. +func (i *ImageTemplateVhdDistributor) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "artifactTags": + err = unpopulate(val, &i.ArtifactTags) + delete(rawMsg, key) + case "runOutputName": + err = unpopulate(val, &i.RunOutputName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &i.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetImageTemplateCustomizer implements the ImageTemplateCustomizerClassification interface for type ImageTemplateWindowsUpdateCustomizer. +func (i *ImageTemplateWindowsUpdateCustomizer) GetImageTemplateCustomizer() *ImageTemplateCustomizer { + return &ImageTemplateCustomizer{ + Type: i.Type, + Name: i.Name, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateWindowsUpdateCustomizer. +func (i ImageTemplateWindowsUpdateCustomizer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filters", i.Filters) + populate(objectMap, "name", i.Name) + populate(objectMap, "searchCriteria", i.SearchCriteria) + objectMap["type"] = "WindowsUpdate" + populate(objectMap, "updateLimit", i.UpdateLimit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateWindowsUpdateCustomizer. +func (i *ImageTemplateWindowsUpdateCustomizer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "filters": + err = unpopulate(val, &i.Filters) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &i.Name) + delete(rawMsg, key) + case "searchCriteria": + err = unpopulate(val, &i.SearchCriteria) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &i.Type) + delete(rawMsg, key) + case "updateLimit": + err = unpopulate(val, &i.UpdateLimit) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RunOutputCollection. +func (r RunOutputCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_operations_client.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_operations_client.go index b50ce03a5252..3feb7b3e0049 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_operations_client.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,34 +29,54 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Lists available operations for the Microsoft.VirtualMachineImages provider // If the operation fails it returns an *azcore.ResponseError type. // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(options *OperationsClientListOptions) *OperationsClientListPager { - return &OperationsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *OperationsClient) List(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp OperationsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationListResult.NextLink) + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -74,7 +95,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_pagers.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_pagers.go deleted file mode 100644 index e85904d29f4d..000000000000 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_pagers.go +++ /dev/null @@ -1,233 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armvirtualmachineimagebuilder - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// OperationsClientListPager provides operations for iterating over paged responses. -type OperationsClientListPager struct { - client *OperationsClient - current OperationsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, OperationsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *OperationsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *OperationsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.OperationListResult.NextLink == nil || len(*p.current.OperationListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current OperationsClientListResponse page. -func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse { - return p.current -} - -// VirtualMachineImageTemplatesClientListByResourceGroupPager provides operations for iterating over paged responses. -type VirtualMachineImageTemplatesClientListByResourceGroupPager struct { - client *VirtualMachineImageTemplatesClient - current VirtualMachineImageTemplatesClientListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, VirtualMachineImageTemplatesClientListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *VirtualMachineImageTemplatesClientListByResourceGroupPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *VirtualMachineImageTemplatesClientListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ImageTemplateListResult.NextLink == nil || len(*p.current.ImageTemplateListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByResourceGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current VirtualMachineImageTemplatesClientListByResourceGroupResponse page. -func (p *VirtualMachineImageTemplatesClientListByResourceGroupPager) PageResponse() VirtualMachineImageTemplatesClientListByResourceGroupResponse { - return p.current -} - -// VirtualMachineImageTemplatesClientListPager provides operations for iterating over paged responses. -type VirtualMachineImageTemplatesClientListPager struct { - client *VirtualMachineImageTemplatesClient - current VirtualMachineImageTemplatesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, VirtualMachineImageTemplatesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *VirtualMachineImageTemplatesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *VirtualMachineImageTemplatesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ImageTemplateListResult.NextLink == nil || len(*p.current.ImageTemplateListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current VirtualMachineImageTemplatesClientListResponse page. -func (p *VirtualMachineImageTemplatesClientListPager) PageResponse() VirtualMachineImageTemplatesClientListResponse { - return p.current -} - -// VirtualMachineImageTemplatesClientListRunOutputsPager provides operations for iterating over paged responses. -type VirtualMachineImageTemplatesClientListRunOutputsPager struct { - client *VirtualMachineImageTemplatesClient - current VirtualMachineImageTemplatesClientListRunOutputsResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, VirtualMachineImageTemplatesClientListRunOutputsResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *VirtualMachineImageTemplatesClientListRunOutputsPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *VirtualMachineImageTemplatesClientListRunOutputsPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.RunOutputCollection.NextLink == nil || len(*p.current.RunOutputCollection.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listRunOutputsHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current VirtualMachineImageTemplatesClientListRunOutputsResponse page. -func (p *VirtualMachineImageTemplatesClientListRunOutputsPager) PageResponse() VirtualMachineImageTemplatesClientListRunOutputsResponse { - return p.current -} diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_pollers.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_pollers.go deleted file mode 100644 index 62e582596466..000000000000 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_pollers.go +++ /dev/null @@ -1,230 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armvirtualmachineimagebuilder - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// VirtualMachineImageTemplatesClientCancelPoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineImageTemplatesClientCancelPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VirtualMachineImageTemplatesClientCancelPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *VirtualMachineImageTemplatesClientCancelPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final VirtualMachineImageTemplatesClientCancelResponse will be returned. -func (p *VirtualMachineImageTemplatesClientCancelPoller) FinalResponse(ctx context.Context) (VirtualMachineImageTemplatesClientCancelResponse, error) { - respType := VirtualMachineImageTemplatesClientCancelResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return VirtualMachineImageTemplatesClientCancelResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *VirtualMachineImageTemplatesClientCancelPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// VirtualMachineImageTemplatesClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineImageTemplatesClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VirtualMachineImageTemplatesClientCreateOrUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *VirtualMachineImageTemplatesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final VirtualMachineImageTemplatesClientCreateOrUpdateResponse will be returned. -func (p *VirtualMachineImageTemplatesClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineImageTemplatesClientCreateOrUpdateResponse, error) { - respType := VirtualMachineImageTemplatesClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ImageTemplate) - if err != nil { - return VirtualMachineImageTemplatesClientCreateOrUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *VirtualMachineImageTemplatesClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// VirtualMachineImageTemplatesClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineImageTemplatesClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VirtualMachineImageTemplatesClientDeletePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *VirtualMachineImageTemplatesClientDeletePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final VirtualMachineImageTemplatesClientDeleteResponse will be returned. -func (p *VirtualMachineImageTemplatesClientDeletePoller) FinalResponse(ctx context.Context) (VirtualMachineImageTemplatesClientDeleteResponse, error) { - respType := VirtualMachineImageTemplatesClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return VirtualMachineImageTemplatesClientDeleteResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *VirtualMachineImageTemplatesClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// VirtualMachineImageTemplatesClientRunPoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineImageTemplatesClientRunPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VirtualMachineImageTemplatesClientRunPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *VirtualMachineImageTemplatesClientRunPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final VirtualMachineImageTemplatesClientRunResponse will be returned. -func (p *VirtualMachineImageTemplatesClientRunPoller) FinalResponse(ctx context.Context) (VirtualMachineImageTemplatesClientRunResponse, error) { - respType := VirtualMachineImageTemplatesClientRunResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return VirtualMachineImageTemplatesClientRunResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *VirtualMachineImageTemplatesClientRunPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// VirtualMachineImageTemplatesClientUpdatePoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineImageTemplatesClientUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VirtualMachineImageTemplatesClientUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *VirtualMachineImageTemplatesClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final VirtualMachineImageTemplatesClientUpdateResponse will be returned. -func (p *VirtualMachineImageTemplatesClientUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineImageTemplatesClientUpdateResponse, error) { - respType := VirtualMachineImageTemplatesClientUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ImageTemplate) - if err != nil { - return VirtualMachineImageTemplatesClientUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *VirtualMachineImageTemplatesClientUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_polymorphic_helpers.go index 813611f9b5c5..eca2c7f15b0f 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_polymorphic_helpers.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_response_types.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_response_types.go index a6d9fdac655b..a3525390a7db 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_response_types.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,324 +8,57 @@ package armvirtualmachineimagebuilder -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationListResult } -// VirtualMachineImageTemplatesClientCancelPollerResponse contains the response from method VirtualMachineImageTemplatesClient.Cancel. -type VirtualMachineImageTemplatesClientCancelPollerResponse struct { - // Poller contains an initialized poller. - Poller *VirtualMachineImageTemplatesClientCancelPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l VirtualMachineImageTemplatesClientCancelPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineImageTemplatesClientCancelResponse, error) { - respType := VirtualMachineImageTemplatesClientCancelResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VirtualMachineImageTemplatesClientCancelPollerResponse from the provided client and resume token. -func (l *VirtualMachineImageTemplatesClientCancelPollerResponse) Resume(ctx context.Context, client *VirtualMachineImageTemplatesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineImageTemplatesClient.Cancel", token, client.pl) - if err != nil { - return err - } - poller := &VirtualMachineImageTemplatesClientCancelPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // VirtualMachineImageTemplatesClientCancelResponse contains the response from method VirtualMachineImageTemplatesClient.Cancel. type VirtualMachineImageTemplatesClientCancelResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachineImageTemplatesClientCreateOrUpdatePollerResponse contains the response from method VirtualMachineImageTemplatesClient.CreateOrUpdate. -type VirtualMachineImageTemplatesClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *VirtualMachineImageTemplatesClientCreateOrUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l VirtualMachineImageTemplatesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineImageTemplatesClientCreateOrUpdateResponse, error) { - respType := VirtualMachineImageTemplatesClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ImageTemplate) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VirtualMachineImageTemplatesClientCreateOrUpdatePollerResponse from the provided client and resume -// token. -func (l *VirtualMachineImageTemplatesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineImageTemplatesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineImageTemplatesClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &VirtualMachineImageTemplatesClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // VirtualMachineImageTemplatesClientCreateOrUpdateResponse contains the response from method VirtualMachineImageTemplatesClient.CreateOrUpdate. type VirtualMachineImageTemplatesClientCreateOrUpdateResponse struct { - VirtualMachineImageTemplatesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachineImageTemplatesClientCreateOrUpdateResult contains the result from method VirtualMachineImageTemplatesClient.CreateOrUpdate. -type VirtualMachineImageTemplatesClientCreateOrUpdateResult struct { ImageTemplate } -// VirtualMachineImageTemplatesClientDeletePollerResponse contains the response from method VirtualMachineImageTemplatesClient.Delete. -type VirtualMachineImageTemplatesClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *VirtualMachineImageTemplatesClientDeletePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l VirtualMachineImageTemplatesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineImageTemplatesClientDeleteResponse, error) { - respType := VirtualMachineImageTemplatesClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VirtualMachineImageTemplatesClientDeletePollerResponse from the provided client and resume token. -func (l *VirtualMachineImageTemplatesClientDeletePollerResponse) Resume(ctx context.Context, client *VirtualMachineImageTemplatesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineImageTemplatesClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &VirtualMachineImageTemplatesClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // VirtualMachineImageTemplatesClientDeleteResponse contains the response from method VirtualMachineImageTemplatesClient.Delete. type VirtualMachineImageTemplatesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // VirtualMachineImageTemplatesClientGetResponse contains the response from method VirtualMachineImageTemplatesClient.Get. type VirtualMachineImageTemplatesClientGetResponse struct { - VirtualMachineImageTemplatesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachineImageTemplatesClientGetResult contains the result from method VirtualMachineImageTemplatesClient.Get. -type VirtualMachineImageTemplatesClientGetResult struct { ImageTemplate } // VirtualMachineImageTemplatesClientGetRunOutputResponse contains the response from method VirtualMachineImageTemplatesClient.GetRunOutput. type VirtualMachineImageTemplatesClientGetRunOutputResponse struct { - VirtualMachineImageTemplatesClientGetRunOutputResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachineImageTemplatesClientGetRunOutputResult contains the result from method VirtualMachineImageTemplatesClient.GetRunOutput. -type VirtualMachineImageTemplatesClientGetRunOutputResult struct { RunOutput } // VirtualMachineImageTemplatesClientListByResourceGroupResponse contains the response from method VirtualMachineImageTemplatesClient.ListByResourceGroup. type VirtualMachineImageTemplatesClientListByResourceGroupResponse struct { - VirtualMachineImageTemplatesClientListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachineImageTemplatesClientListByResourceGroupResult contains the result from method VirtualMachineImageTemplatesClient.ListByResourceGroup. -type VirtualMachineImageTemplatesClientListByResourceGroupResult struct { ImageTemplateListResult } // VirtualMachineImageTemplatesClientListResponse contains the response from method VirtualMachineImageTemplatesClient.List. type VirtualMachineImageTemplatesClientListResponse struct { - VirtualMachineImageTemplatesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachineImageTemplatesClientListResult contains the result from method VirtualMachineImageTemplatesClient.List. -type VirtualMachineImageTemplatesClientListResult struct { ImageTemplateListResult } // VirtualMachineImageTemplatesClientListRunOutputsResponse contains the response from method VirtualMachineImageTemplatesClient.ListRunOutputs. type VirtualMachineImageTemplatesClientListRunOutputsResponse struct { - VirtualMachineImageTemplatesClientListRunOutputsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachineImageTemplatesClientListRunOutputsResult contains the result from method VirtualMachineImageTemplatesClient.ListRunOutputs. -type VirtualMachineImageTemplatesClientListRunOutputsResult struct { RunOutputCollection } -// VirtualMachineImageTemplatesClientRunPollerResponse contains the response from method VirtualMachineImageTemplatesClient.Run. -type VirtualMachineImageTemplatesClientRunPollerResponse struct { - // Poller contains an initialized poller. - Poller *VirtualMachineImageTemplatesClientRunPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l VirtualMachineImageTemplatesClientRunPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineImageTemplatesClientRunResponse, error) { - respType := VirtualMachineImageTemplatesClientRunResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VirtualMachineImageTemplatesClientRunPollerResponse from the provided client and resume token. -func (l *VirtualMachineImageTemplatesClientRunPollerResponse) Resume(ctx context.Context, client *VirtualMachineImageTemplatesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineImageTemplatesClient.Run", token, client.pl) - if err != nil { - return err - } - poller := &VirtualMachineImageTemplatesClientRunPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // VirtualMachineImageTemplatesClientRunResponse contains the response from method VirtualMachineImageTemplatesClient.Run. type VirtualMachineImageTemplatesClientRunResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachineImageTemplatesClientUpdatePollerResponse contains the response from method VirtualMachineImageTemplatesClient.Update. -type VirtualMachineImageTemplatesClientUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *VirtualMachineImageTemplatesClientUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l VirtualMachineImageTemplatesClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineImageTemplatesClientUpdateResponse, error) { - respType := VirtualMachineImageTemplatesClientUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ImageTemplate) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VirtualMachineImageTemplatesClientUpdatePollerResponse from the provided client and resume token. -func (l *VirtualMachineImageTemplatesClientUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineImageTemplatesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineImageTemplatesClient.Update", token, client.pl) - if err != nil { - return err - } - poller := &VirtualMachineImageTemplatesClientUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // VirtualMachineImageTemplatesClientUpdateResponse contains the response from method VirtualMachineImageTemplatesClient.Update. type VirtualMachineImageTemplatesClientUpdateResponse struct { - VirtualMachineImageTemplatesClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachineImageTemplatesClientUpdateResult contains the result from method VirtualMachineImageTemplatesClient.Update. -type VirtualMachineImageTemplatesClientUpdateResult struct { ImageTemplate } diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_time_rfc3339.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_time_rfc3339.go index f44adf4893ea..d4a94be8c9ed 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_virtualmachineimagetemplates_client.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_virtualmachineimagetemplates_client.go index 31964f0b814a..ba4883f60119 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_virtualmachineimagetemplates_client.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_virtualmachineimagetemplates_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type VirtualMachineImageTemplatesClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewVirtualMachineImageTemplatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineImageTemplatesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewVirtualMachineImageTemplatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineImageTemplatesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &VirtualMachineImageTemplatesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCancel - Cancel the long running image build based on the image template @@ -56,22 +61,18 @@ func NewVirtualMachineImageTemplatesClient(subscriptionID string, credential azc // imageTemplateName - The name of the image Template // options - VirtualMachineImageTemplatesClientBeginCancelOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.BeginCancel // method. -func (client *VirtualMachineImageTemplatesClient) BeginCancel(ctx context.Context, resourceGroupName string, imageTemplateName string, options *VirtualMachineImageTemplatesClientBeginCancelOptions) (VirtualMachineImageTemplatesClientCancelPollerResponse, error) { - resp, err := client.cancel(ctx, resourceGroupName, imageTemplateName, options) - if err != nil { - return VirtualMachineImageTemplatesClientCancelPollerResponse{}, err - } - result := VirtualMachineImageTemplatesClientCancelPollerResponse{ - RawResponse: resp, +func (client *VirtualMachineImageTemplatesClient) BeginCancel(ctx context.Context, resourceGroupName string, imageTemplateName string, options *VirtualMachineImageTemplatesClientBeginCancelOptions) (*armruntime.Poller[VirtualMachineImageTemplatesClientCancelResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.cancel(ctx, resourceGroupName, imageTemplateName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[VirtualMachineImageTemplatesClientCancelResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[VirtualMachineImageTemplatesClientCancelResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("VirtualMachineImageTemplatesClient.Cancel", "azure-async-operation", resp, client.pl) - if err != nil { - return VirtualMachineImageTemplatesClientCancelPollerResponse{}, err - } - result.Poller = &VirtualMachineImageTemplatesClientCancelPoller{ - pt: pt, - } - return result, nil } // Cancel - Cancel the long running image build based on the image template @@ -124,22 +125,18 @@ func (client *VirtualMachineImageTemplatesClient) cancelCreateRequest(ctx contex // parameters - Parameters supplied to the CreateImageTemplate operation // options - VirtualMachineImageTemplatesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.BeginCreateOrUpdate // method. -func (client *VirtualMachineImageTemplatesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, imageTemplateName string, parameters ImageTemplate, options *VirtualMachineImageTemplatesClientBeginCreateOrUpdateOptions) (VirtualMachineImageTemplatesClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, imageTemplateName, parameters, options) - if err != nil { - return VirtualMachineImageTemplatesClientCreateOrUpdatePollerResponse{}, err - } - result := VirtualMachineImageTemplatesClientCreateOrUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("VirtualMachineImageTemplatesClient.CreateOrUpdate", "azure-async-operation", resp, client.pl) - if err != nil { - return VirtualMachineImageTemplatesClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &VirtualMachineImageTemplatesClientCreateOrUpdatePoller{ - pt: pt, +func (client *VirtualMachineImageTemplatesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, imageTemplateName string, parameters ImageTemplate, options *VirtualMachineImageTemplatesClientBeginCreateOrUpdateOptions) (*armruntime.Poller[VirtualMachineImageTemplatesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, imageTemplateName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[VirtualMachineImageTemplatesClientCreateOrUpdateResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[VirtualMachineImageTemplatesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // CreateOrUpdate - Create or update a virtual machine image template @@ -191,22 +188,18 @@ func (client *VirtualMachineImageTemplatesClient) createOrUpdateCreateRequest(ct // imageTemplateName - The name of the image Template // options - VirtualMachineImageTemplatesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.BeginDelete // method. -func (client *VirtualMachineImageTemplatesClient) BeginDelete(ctx context.Context, resourceGroupName string, imageTemplateName string, options *VirtualMachineImageTemplatesClientBeginDeleteOptions) (VirtualMachineImageTemplatesClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, imageTemplateName, options) - if err != nil { - return VirtualMachineImageTemplatesClientDeletePollerResponse{}, err - } - result := VirtualMachineImageTemplatesClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("VirtualMachineImageTemplatesClient.Delete", "azure-async-operation", resp, client.pl) - if err != nil { - return VirtualMachineImageTemplatesClientDeletePollerResponse{}, err - } - result.Poller = &VirtualMachineImageTemplatesClientDeletePoller{ - pt: pt, +func (client *VirtualMachineImageTemplatesClient) BeginDelete(ctx context.Context, resourceGroupName string, imageTemplateName string, options *VirtualMachineImageTemplatesClientBeginDeleteOptions) (*armruntime.Poller[VirtualMachineImageTemplatesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, imageTemplateName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[VirtualMachineImageTemplatesClientDeleteResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[VirtualMachineImageTemplatesClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - Delete a virtual machine image template @@ -301,7 +294,7 @@ func (client *VirtualMachineImageTemplatesClient) getCreateRequest(ctx context.C // getHandleResponse handles the Get response. func (client *VirtualMachineImageTemplatesClient) getHandleResponse(resp *http.Response) (VirtualMachineImageTemplatesClientGetResponse, error) { - result := VirtualMachineImageTemplatesClientGetResponse{RawResponse: resp} + result := VirtualMachineImageTemplatesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ImageTemplate); err != nil { return VirtualMachineImageTemplatesClientGetResponse{}, err } @@ -362,7 +355,7 @@ func (client *VirtualMachineImageTemplatesClient) getRunOutputCreateRequest(ctx // getRunOutputHandleResponse handles the GetRunOutput response. func (client *VirtualMachineImageTemplatesClient) getRunOutputHandleResponse(resp *http.Response) (VirtualMachineImageTemplatesClientGetRunOutputResponse, error) { - result := VirtualMachineImageTemplatesClientGetRunOutputResponse{RawResponse: resp} + result := VirtualMachineImageTemplatesClientGetRunOutputResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RunOutput); err != nil { return VirtualMachineImageTemplatesClientGetRunOutputResponse{}, err } @@ -373,16 +366,32 @@ func (client *VirtualMachineImageTemplatesClient) getRunOutputHandleResponse(res // If the operation fails it returns an *azcore.ResponseError type. // options - VirtualMachineImageTemplatesClientListOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.List // method. -func (client *VirtualMachineImageTemplatesClient) List(options *VirtualMachineImageTemplatesClientListOptions) *VirtualMachineImageTemplatesClientListPager { - return &VirtualMachineImageTemplatesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *VirtualMachineImageTemplatesClient) List(options *VirtualMachineImageTemplatesClientListOptions) *runtime.Pager[VirtualMachineImageTemplatesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[VirtualMachineImageTemplatesClientListResponse]{ + More: func(page VirtualMachineImageTemplatesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp VirtualMachineImageTemplatesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ImageTemplateListResult.NextLink) + Fetcher: func(ctx context.Context, page *VirtualMachineImageTemplatesClientListResponse) (VirtualMachineImageTemplatesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineImageTemplatesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImageTemplatesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImageTemplatesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -405,7 +414,7 @@ func (client *VirtualMachineImageTemplatesClient) listCreateRequest(ctx context. // listHandleResponse handles the List response. func (client *VirtualMachineImageTemplatesClient) listHandleResponse(resp *http.Response) (VirtualMachineImageTemplatesClientListResponse, error) { - result := VirtualMachineImageTemplatesClientListResponse{RawResponse: resp} + result := VirtualMachineImageTemplatesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ImageTemplateListResult); err != nil { return VirtualMachineImageTemplatesClientListResponse{}, err } @@ -417,16 +426,32 @@ func (client *VirtualMachineImageTemplatesClient) listHandleResponse(resp *http. // resourceGroupName - The name of the resource group. // options - VirtualMachineImageTemplatesClientListByResourceGroupOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.ListByResourceGroup // method. -func (client *VirtualMachineImageTemplatesClient) ListByResourceGroup(resourceGroupName string, options *VirtualMachineImageTemplatesClientListByResourceGroupOptions) *VirtualMachineImageTemplatesClientListByResourceGroupPager { - return &VirtualMachineImageTemplatesClientListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) +func (client *VirtualMachineImageTemplatesClient) ListByResourceGroup(resourceGroupName string, options *VirtualMachineImageTemplatesClientListByResourceGroupOptions) *runtime.Pager[VirtualMachineImageTemplatesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[VirtualMachineImageTemplatesClientListByResourceGroupResponse]{ + More: func(page VirtualMachineImageTemplatesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp VirtualMachineImageTemplatesClientListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ImageTemplateListResult.NextLink) + Fetcher: func(ctx context.Context, page *VirtualMachineImageTemplatesClientListByResourceGroupResponse) (VirtualMachineImageTemplatesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineImageTemplatesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImageTemplatesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImageTemplatesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) }, - } + }) } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. @@ -453,7 +478,7 @@ func (client *VirtualMachineImageTemplatesClient) listByResourceGroupCreateReque // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *VirtualMachineImageTemplatesClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualMachineImageTemplatesClientListByResourceGroupResponse, error) { - result := VirtualMachineImageTemplatesClientListByResourceGroupResponse{RawResponse: resp} + result := VirtualMachineImageTemplatesClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ImageTemplateListResult); err != nil { return VirtualMachineImageTemplatesClientListByResourceGroupResponse{}, err } @@ -466,16 +491,32 @@ func (client *VirtualMachineImageTemplatesClient) listByResourceGroupHandleRespo // imageTemplateName - The name of the image Template // options - VirtualMachineImageTemplatesClientListRunOutputsOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.ListRunOutputs // method. -func (client *VirtualMachineImageTemplatesClient) ListRunOutputs(resourceGroupName string, imageTemplateName string, options *VirtualMachineImageTemplatesClientListRunOutputsOptions) *VirtualMachineImageTemplatesClientListRunOutputsPager { - return &VirtualMachineImageTemplatesClientListRunOutputsPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listRunOutputsCreateRequest(ctx, resourceGroupName, imageTemplateName, options) +func (client *VirtualMachineImageTemplatesClient) ListRunOutputs(resourceGroupName string, imageTemplateName string, options *VirtualMachineImageTemplatesClientListRunOutputsOptions) *runtime.Pager[VirtualMachineImageTemplatesClientListRunOutputsResponse] { + return runtime.NewPager(runtime.PageProcessor[VirtualMachineImageTemplatesClientListRunOutputsResponse]{ + More: func(page VirtualMachineImageTemplatesClientListRunOutputsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp VirtualMachineImageTemplatesClientListRunOutputsResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.RunOutputCollection.NextLink) + Fetcher: func(ctx context.Context, page *VirtualMachineImageTemplatesClientListRunOutputsResponse) (VirtualMachineImageTemplatesClientListRunOutputsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listRunOutputsCreateRequest(ctx, resourceGroupName, imageTemplateName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineImageTemplatesClientListRunOutputsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImageTemplatesClientListRunOutputsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImageTemplatesClientListRunOutputsResponse{}, runtime.NewResponseError(resp) + } + return client.listRunOutputsHandleResponse(resp) }, - } + }) } // listRunOutputsCreateRequest creates the ListRunOutputs request. @@ -506,7 +547,7 @@ func (client *VirtualMachineImageTemplatesClient) listRunOutputsCreateRequest(ct // listRunOutputsHandleResponse handles the ListRunOutputs response. func (client *VirtualMachineImageTemplatesClient) listRunOutputsHandleResponse(resp *http.Response) (VirtualMachineImageTemplatesClientListRunOutputsResponse, error) { - result := VirtualMachineImageTemplatesClientListRunOutputsResponse{RawResponse: resp} + result := VirtualMachineImageTemplatesClientListRunOutputsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RunOutputCollection); err != nil { return VirtualMachineImageTemplatesClientListRunOutputsResponse{}, err } @@ -519,22 +560,18 @@ func (client *VirtualMachineImageTemplatesClient) listRunOutputsHandleResponse(r // imageTemplateName - The name of the image Template // options - VirtualMachineImageTemplatesClientBeginRunOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.BeginRun // method. -func (client *VirtualMachineImageTemplatesClient) BeginRun(ctx context.Context, resourceGroupName string, imageTemplateName string, options *VirtualMachineImageTemplatesClientBeginRunOptions) (VirtualMachineImageTemplatesClientRunPollerResponse, error) { - resp, err := client.run(ctx, resourceGroupName, imageTemplateName, options) - if err != nil { - return VirtualMachineImageTemplatesClientRunPollerResponse{}, err - } - result := VirtualMachineImageTemplatesClientRunPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("VirtualMachineImageTemplatesClient.Run", "azure-async-operation", resp, client.pl) - if err != nil { - return VirtualMachineImageTemplatesClientRunPollerResponse{}, err - } - result.Poller = &VirtualMachineImageTemplatesClientRunPoller{ - pt: pt, +func (client *VirtualMachineImageTemplatesClient) BeginRun(ctx context.Context, resourceGroupName string, imageTemplateName string, options *VirtualMachineImageTemplatesClientBeginRunOptions) (*armruntime.Poller[VirtualMachineImageTemplatesClientRunResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.run(ctx, resourceGroupName, imageTemplateName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[VirtualMachineImageTemplatesClientRunResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[VirtualMachineImageTemplatesClientRunResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Run - Create artifacts from a existing image template @@ -587,22 +624,18 @@ func (client *VirtualMachineImageTemplatesClient) runCreateRequest(ctx context.C // parameters - Additional parameters for Image Template update. // options - VirtualMachineImageTemplatesClientBeginUpdateOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.BeginUpdate // method. -func (client *VirtualMachineImageTemplatesClient) BeginUpdate(ctx context.Context, resourceGroupName string, imageTemplateName string, parameters ImageTemplateUpdateParameters, options *VirtualMachineImageTemplatesClientBeginUpdateOptions) (VirtualMachineImageTemplatesClientUpdatePollerResponse, error) { - resp, err := client.update(ctx, resourceGroupName, imageTemplateName, parameters, options) - if err != nil { - return VirtualMachineImageTemplatesClientUpdatePollerResponse{}, err - } - result := VirtualMachineImageTemplatesClientUpdatePollerResponse{ - RawResponse: resp, +func (client *VirtualMachineImageTemplatesClient) BeginUpdate(ctx context.Context, resourceGroupName string, imageTemplateName string, parameters ImageTemplateUpdateParameters, options *VirtualMachineImageTemplatesClientBeginUpdateOptions) (*armruntime.Poller[VirtualMachineImageTemplatesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, imageTemplateName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[VirtualMachineImageTemplatesClientUpdateResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[VirtualMachineImageTemplatesClientUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("VirtualMachineImageTemplatesClient.Update", "azure-async-operation", resp, client.pl) - if err != nil { - return VirtualMachineImageTemplatesClientUpdatePollerResponse{}, err - } - result.Poller = &VirtualMachineImageTemplatesClientUpdatePoller{ - pt: pt, - } - return result, nil } // Update - Update the tags for this Virtual Machine Image Template diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/CHANGELOG.md b/sdk/resourcemanager/visualstudio/armvisualstudio/CHANGELOG.md index b74c712fec4b..9f11d534c7d5 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/CHANGELOG.md +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/CHANGELOG.md @@ -1,5 +1,90 @@ # Release History +## 0.3.0 (2022-04-13) +### Breaking Changes + +- Function `*ProjectsClient.BeginCreate` return value(s) have been changed from `(ProjectsClientCreatePollerResponse, error)` to `(*armruntime.Poller[ProjectsClientCreateResponse], error)` +- Function `NewExtensionsClient` return value(s) have been changed from `(*ExtensionsClient)` to `(*ExtensionsClient, error)` +- Function `NewProjectsClient` return value(s) have been changed from `(*ProjectsClient)` to `(*ProjectsClient, error)` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `NewAccountsClient` return value(s) have been changed from `(*AccountsClient)` to `(*AccountsClient, error)` +- Function `*ProjectsClientCreatePollerResponse.Resume` has been removed +- Function `AccountResourceRequestOperationType.ToPtr` has been removed +- Function `*ProjectsClientCreatePoller.Done` has been removed +- Function `*ProjectsClientCreatePoller.FinalResponse` has been removed +- Function `*ProjectsClientCreatePoller.ResumeToken` has been removed +- Function `*ProjectsClientCreatePoller.Poll` has been removed +- Function `ProjectsClientCreatePollerResponse.PollUntilDone` has been removed +- Struct `AccountsClientCheckNameAvailabilityResult` has been removed +- Struct `AccountsClientCreateOrUpdateResult` has been removed +- Struct `AccountsClientGetResult` has been removed +- Struct `AccountsClientListByResourceGroupResult` has been removed +- Struct `AccountsClientUpdateResult` has been removed +- Struct `ExtensionsClientCreateResult` has been removed +- Struct `ExtensionsClientGetResult` has been removed +- Struct `ExtensionsClientListByAccountResult` has been removed +- Struct `ExtensionsClientUpdateResult` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `ProjectsClientCreatePoller` has been removed +- Struct `ProjectsClientCreatePollerResponse` has been removed +- Struct `ProjectsClientCreateResult` has been removed +- Struct `ProjectsClientGetJobStatusResult` has been removed +- Struct `ProjectsClientGetResult` has been removed +- Struct `ProjectsClientListByResourceGroupResult` has been removed +- Struct `ProjectsClientUpdateResult` has been removed +- Field `AccountsClientGetResult` of struct `AccountsClientGetResponse` has been removed +- Field `RawResponse` of struct `AccountsClientGetResponse` has been removed +- Field `ExtensionsClientGetResult` of struct `ExtensionsClientGetResponse` has been removed +- Field `RawResponse` of struct `ExtensionsClientGetResponse` has been removed +- Field `ProjectsClientUpdateResult` of struct `ProjectsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `ProjectsClientUpdateResponse` has been removed +- Field `ProjectsClientCreateResult` of struct `ProjectsClientCreateResponse` has been removed +- Field `RawResponse` of struct `ProjectsClientCreateResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `ExtensionsClientUpdateResult` of struct `ExtensionsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `ExtensionsClientUpdateResponse` has been removed +- Field `AccountsClientCheckNameAvailabilityResult` of struct `AccountsClientCheckNameAvailabilityResponse` has been removed +- Field `RawResponse` of struct `AccountsClientCheckNameAvailabilityResponse` has been removed +- Field `ProjectsClientGetResult` of struct `ProjectsClientGetResponse` has been removed +- Field `RawResponse` of struct `ProjectsClientGetResponse` has been removed +- Field `ExtensionsClientCreateResult` of struct `ExtensionsClientCreateResponse` has been removed +- Field `RawResponse` of struct `ExtensionsClientCreateResponse` has been removed +- Field `ProjectsClientGetJobStatusResult` of struct `ProjectsClientGetJobStatusResponse` has been removed +- Field `RawResponse` of struct `ProjectsClientGetJobStatusResponse` has been removed +- Field `AccountsClientCreateOrUpdateResult` of struct `AccountsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `AccountsClientCreateOrUpdateResponse` has been removed +- Field `AccountsClientListByResourceGroupResult` of struct `AccountsClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `AccountsClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `ExtensionsClientDeleteResponse` has been removed +- Field `AccountsClientUpdateResult` of struct `AccountsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `AccountsClientUpdateResponse` has been removed +- Field `ExtensionsClientListByAccountResult` of struct `ExtensionsClientListByAccountResponse` has been removed +- Field `RawResponse` of struct `ExtensionsClientListByAccountResponse` has been removed +- Field `RawResponse` of struct `AccountsClientDeleteResponse` has been removed +- Field `ProjectsClientListByResourceGroupResult` of struct `ProjectsClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `ProjectsClientListByResourceGroupResponse` has been removed + +### Features Added + +- New field `ResumeToken` in struct `ProjectsClientBeginCreateOptions` +- New anonymous field `ExtensionResource` in struct `ExtensionsClientCreateResponse` +- New anonymous field `AccountResourceListResult` in struct `AccountsClientListByResourceGroupResponse` +- New anonymous field `ExtensionResourceListResult` in struct `ExtensionsClientListByAccountResponse` +- New anonymous field `ProjectResource` in struct `ProjectsClientGetJobStatusResponse` +- New anonymous field `ProjectResource` in struct `ProjectsClientCreateResponse` +- New anonymous field `ProjectResourceListResult` in struct `ProjectsClientListByResourceGroupResponse` +- New anonymous field `ProjectResource` in struct `ProjectsClientUpdateResponse` +- New anonymous field `ProjectResource` in struct `ProjectsClientGetResponse` +- New anonymous field `ExtensionResource` in struct `ExtensionsClientUpdateResponse` +- New anonymous field `ExtensionResource` in struct `ExtensionsClientGetResponse` +- New anonymous field `CheckNameAvailabilityResult` in struct `AccountsClientCheckNameAvailabilityResponse` +- New anonymous field `AccountResource` in struct `AccountsClientCreateOrUpdateResponse` +- New anonymous field `AccountResource` in struct `AccountsClientUpdateResponse` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New anonymous field `AccountResource` in struct `AccountsClientGetResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/README.md b/sdk/resourcemanager/visualstudio/armvisualstudio/README.md index 3f8518c62a09..db0e76a3a570 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/README.md +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/README.md @@ -11,7 +11,7 @@ The `armvisualstudio` module provides operations for working with Azure Visual S ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Visual Studio modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -client := armvisualstudio.NewAccountsClient(<subscription ID>, cred, nil) +client, err := armvisualstudio.NewAccountsClient(<subscription ID>, cred, nil) ``` You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armvisualstudio.NewAccountsClient(<subscription ID>, cred, &options) +client, err := armvisualstudio.NewAccountsClient(<subscription ID>, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/autorest.md b/sdk/resourcemanager/visualstudio/armvisualstudio/autorest.md index ddb9c3877935..23d3a8a5a01b 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/autorest.md +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/visualstudio/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/visualstudio/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/visualstudio/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/visualstudio/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/go.mod b/sdk/resourcemanager/visualstudio/armvisualstudio/go.mod index 02b2ee660f21..fda515c227aa 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/go.mod +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/visualstudio/armvisualstudio -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/go.sum b/sdk/resourcemanager/visualstudio/armvisualstudio/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/go.sum +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_accounts_client_test.go b/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_accounts_client_test.go index d2be1488dac2..ee2bbaf42637 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_accounts_client_test.go +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_accounts_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,122 +17,163 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/visualstudio/armvisualstudio" ) -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/CheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/CheckNameAvailability.json func ExampleAccountsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewAccountsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewAccountsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CheckNameAvailability(ctx, armvisualstudio.CheckNameAvailabilityParameter{ - ResourceName: to.StringPtr("<resource-name>"), - ResourceType: to.StringPtr("<resource-type>"), + ResourceName: to.Ptr("<resource-name>"), + ResourceType: to.Ptr("<resource-type>"), }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountsClientCheckNameAvailabilityResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetResources_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetResources_List.json func ExampleAccountsClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewAccountsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewAccountsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListByResourceGroup(ctx, "<resource-group-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountsClientListByResourceGroupResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/CreateResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/CreateResource.json func ExampleAccountsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewAccountsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewAccountsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "<resource-group-name>", "<resource-name>", armvisualstudio.AccountResourceRequest{ - AccountName: to.StringPtr("<account-name>"), - Location: to.StringPtr("<location>"), - OperationType: armvisualstudio.AccountResourceRequestOperationTypeCreate.ToPtr(), + AccountName: to.Ptr("<account-name>"), + Location: to.Ptr("<location>"), + OperationType: to.Ptr(armvisualstudio.AccountResourceRequestOperationTypeCreate), Properties: map[string]*string{}, Tags: map[string]*string{}, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/DeleteResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/DeleteResource.json func ExampleAccountsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewAccountsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewAccountsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "<resource-group-name>", "<resource-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetResource.json func ExampleAccountsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewAccountsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewAccountsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<resource-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/UpdateTags.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/UpdateTags.json func ExampleAccountsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewAccountsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewAccountsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "<resource-group-name>", "<resource-name>", armvisualstudio.AccountTagRequest{ Tags: map[string]*string{ - "tag1": to.StringPtr("value1"), + "tag1": to.Ptr("value1"), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.AccountsClientUpdateResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_extensions_client_test.go b/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_extensions_client_test.go index bd421f5afd6c..cf157b23696d 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_extensions_client_test.go +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_extensions_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,119 +17,153 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/visualstudio/armvisualstudio" ) -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetExtensionResources_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetExtensionResources_List.json func ExampleExtensionsClient_ListByAccount() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewExtensionsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewExtensionsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListByAccount(ctx, "<resource-group-name>", "<account-resource-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ExtensionsClientListByAccountResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/CreateExtensionResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/CreateExtensionResource.json func ExampleExtensionsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewExtensionsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewExtensionsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Create(ctx, "<resource-group-name>", "<account-resource-name>", "<extension-resource-name>", armvisualstudio.ExtensionResourceRequest{ - Location: to.StringPtr("<location>"), + Location: to.Ptr("<location>"), Plan: &armvisualstudio.ExtensionResourcePlan{ - Name: to.StringPtr("<name>"), - Product: to.StringPtr("<product>"), - PromotionCode: to.StringPtr("<promotion-code>"), - Publisher: to.StringPtr("<publisher>"), - Version: to.StringPtr("<version>"), + Name: to.Ptr("<name>"), + Product: to.Ptr("<product>"), + PromotionCode: to.Ptr("<promotion-code>"), + Publisher: to.Ptr("<publisher>"), + Version: to.Ptr("<version>"), }, Properties: map[string]*string{}, Tags: map[string]*string{}, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ExtensionsClientCreateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/DeleteExtensionResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/DeleteExtensionResource.json func ExampleExtensionsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewExtensionsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewExtensionsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "<resource-group-name>", "<account-resource-name>", "<extension-resource-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetExtensionResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetExtensionResource.json func ExampleExtensionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewExtensionsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewExtensionsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<account-resource-name>", "<extension-resource-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ExtensionsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/UpdateExtensionResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/UpdateExtensionResource.json func ExampleExtensionsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewExtensionsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewExtensionsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "<resource-group-name>", "<account-resource-name>", "<extension-resource-name>", armvisualstudio.ExtensionResourceRequest{ - Location: to.StringPtr("<location>"), + Location: to.Ptr("<location>"), Plan: &armvisualstudio.ExtensionResourcePlan{ - Name: to.StringPtr("<name>"), - Product: to.StringPtr("<product>"), - PromotionCode: to.StringPtr("<promotion-code>"), - Publisher: to.StringPtr("<publisher>"), - Version: to.StringPtr("<version>"), + Name: to.Ptr("<name>"), + Product: to.Ptr("<product>"), + PromotionCode: to.Ptr("<promotion-code>"), + Publisher: to.Ptr("<publisher>"), + Version: to.Ptr("<version>"), }, Properties: map[string]*string{}, Tags: map[string]*string{}, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ExtensionsClientUpdateResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_operations_client_test.go index 930cf3b2dad2..b35dd37944ab 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_operations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,18 +16,25 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/visualstudio/armvisualstudio" ) -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetOperations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetOperations.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewOperationsClient(cred, nil) + client, err := armvisualstudio.NewOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.List(ctx, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.OperationsClientListResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_projects_client_test.go b/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_projects_client_test.go index adf298455aa4..0edfc0c0620e 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_projects_client_test.go +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/ze_generated_example_projects_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,121 +19,159 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/visualstudio/armvisualstudio" ) -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetProjectResources_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetProjectResources_List.json func ExampleProjectsClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewProjectsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewProjectsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListByResourceGroup(ctx, "<resource-group-name>", "<root-resource-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ProjectsClientListByResourceGroupResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/CreateProjectResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/CreateProjectResource.json func ExampleProjectsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewProjectsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewProjectsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreate(ctx, "<resource-group-name>", "<root-resource-name>", "<resource-name>", armvisualstudio.ProjectResource{ - Name: to.StringPtr("<name>"), - Type: to.StringPtr("<type>"), - ID: to.StringPtr("<id>"), - Location: to.StringPtr("<location>"), + Name: to.Ptr("<name>"), + Type: to.Ptr("<type>"), + ID: to.Ptr("<id>"), + Location: to.Ptr("<location>"), Tags: map[string]*string{}, Properties: map[string]*string{ - "ProcessTemplateId": to.StringPtr("6B724908-EF14-45CF-84F8-768B5384DA45"), - "VersionControlOption": to.StringPtr("Git"), + "ProcessTemplateId": to.Ptr("6B724908-EF14-45CF-84F8-768B5384DA45"), + "VersionControlOption": to.Ptr("Git"), }, }, - &armvisualstudio.ProjectsClientBeginCreateOptions{Validating: nil}) + &armvisualstudio.ProjectsClientBeginCreateOptions{Validating: nil, + ResumeToken: "", + }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.ProjectsClientCreateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetProjectResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetProjectResource.json func ExampleProjectsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewProjectsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewProjectsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<root-resource-name>", "<resource-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ProjectsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/UpdateProjectResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/UpdateProjectResource.json func ExampleProjectsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewProjectsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewProjectsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "<resource-group-name>", "<root-resource-name>", "<resource-name>", armvisualstudio.ProjectResource{ - Name: to.StringPtr("<name>"), - Type: to.StringPtr("<type>"), - ID: to.StringPtr("<id>"), - Location: to.StringPtr("<location>"), + Name: to.Ptr("<name>"), + Type: to.Ptr("<type>"), + ID: to.Ptr("<id>"), + Location: to.Ptr("<location>"), Tags: map[string]*string{}, Properties: map[string]*string{}, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ProjectsClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetProjectJobStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/GetProjectJobStatus.json func ExampleProjectsClient_GetJobStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvisualstudio.NewProjectsClient("<subscription-id>", cred, nil) + client, err := armvisualstudio.NewProjectsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.GetJobStatus(ctx, "<resource-group-name>", "<root-resource-name>", "<resource-name>", "<sub-container-name>", "<operation>", - &armvisualstudio.ProjectsClientGetJobStatusOptions{JobID: to.StringPtr("<job-id>")}) + &armvisualstudio.ProjectsClientGetJobStatusOptions{JobID: to.Ptr("<job-id>")}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ProjectsClientGetJobStatusResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_accounts_client.go b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_accounts_client.go index d38c4c8bb985..56aa058bf8de 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_accounts_client.go +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_accounts_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type AccountsClient struct { // subscriptionID - The Azure subscription identifier. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccountsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &AccountsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CheckNameAvailability - Checks if the specified Visual Studio Team Services account name is available. Resource name can @@ -90,7 +95,7 @@ func (client *AccountsClient) checkNameAvailabilityCreateRequest(ctx context.Con // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. func (client *AccountsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (AccountsClientCheckNameAvailabilityResponse, error) { - result := AccountsClientCheckNameAvailabilityResponse{RawResponse: resp} + result := AccountsClientCheckNameAvailabilityResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { return AccountsClientCheckNameAvailabilityResponse{}, err } @@ -146,7 +151,7 @@ func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, r // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *AccountsClient) createOrUpdateHandleResponse(resp *http.Response) (AccountsClientCreateOrUpdateResponse, error) { - result := AccountsClientCreateOrUpdateResponse{RawResponse: resp} + result := AccountsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccountResource); err != nil { return AccountsClientCreateOrUpdateResponse{}, err } @@ -170,7 +175,7 @@ func (client *AccountsClient) Delete(ctx context.Context, resourceGroupName stri if !runtime.HasStatusCode(resp, http.StatusOK) { return AccountsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return AccountsClientDeleteResponse{RawResponse: resp}, nil + return AccountsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -246,7 +251,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou // getHandleResponse handles the Get response. func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsClientGetResponse, error) { - result := AccountsClientGetResponse{RawResponse: resp} + result := AccountsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccountResource); err != nil { return AccountsClientGetResponse{}, err } @@ -298,7 +303,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Response) (AccountsClientListByResourceGroupResponse, error) { - result := AccountsClientListByResourceGroupResponse{RawResponse: resp} + result := AccountsClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccountResourceListResult); err != nil { return AccountsClientListByResourceGroupResponse{}, err } @@ -354,7 +359,7 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG // updateHandleResponse handles the Update response. func (client *AccountsClient) updateHandleResponse(resp *http.Response) (AccountsClientUpdateResponse, error) { - result := AccountsClientUpdateResponse{RawResponse: resp} + result := AccountsClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccountResource); err != nil { return AccountsClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_constants.go b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_constants.go index 849899aabae8..bf422e2871c7 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_constants.go +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armvisualstudio const ( moduleName = "armvisualstudio" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // AccountResourceRequestOperationType - The type of the operation. @@ -32,8 +32,3 @@ func PossibleAccountResourceRequestOperationTypeValues() []AccountResourceReques AccountResourceRequestOperationTypeLink, } } - -// ToPtr returns a *AccountResourceRequestOperationType pointing to the current value. -func (c AccountResourceRequestOperationType) ToPtr() *AccountResourceRequestOperationType { - return &c -} diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_extensions_client.go b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_extensions_client.go index d11d9345e11d..15a7c05292e3 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_extensions_client.go +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_extensions_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ExtensionsClient struct { // subscriptionID - The Azure subscription identifier. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExtensionsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExtensionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ExtensionsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Create - Registers the extension with a Visual Studio Team Services account. @@ -103,7 +108,7 @@ func (client *ExtensionsClient) createCreateRequest(ctx context.Context, resourc // createHandleResponse handles the Create response. func (client *ExtensionsClient) createHandleResponse(resp *http.Response) (ExtensionsClientCreateResponse, error) { - result := ExtensionsClientCreateResponse{RawResponse: resp} + result := ExtensionsClientCreateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ExtensionResource); err != nil { return ExtensionsClientCreateResponse{}, err } @@ -128,7 +133,7 @@ func (client *ExtensionsClient) Delete(ctx context.Context, resourceGroupName st if !runtime.HasStatusCode(resp, http.StatusOK) { return ExtensionsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return ExtensionsClientDeleteResponse{RawResponse: resp}, nil + return ExtensionsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -213,7 +218,7 @@ func (client *ExtensionsClient) getCreateRequest(ctx context.Context, resourceGr // getHandleResponse handles the Get response. func (client *ExtensionsClient) getHandleResponse(resp *http.Response) (ExtensionsClientGetResponse, error) { - result := ExtensionsClientGetResponse{RawResponse: resp} + result := ExtensionsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ExtensionResource); err != nil { return ExtensionsClientGetResponse{}, err } @@ -269,7 +274,7 @@ func (client *ExtensionsClient) listByAccountCreateRequest(ctx context.Context, // listByAccountHandleResponse handles the ListByAccount response. func (client *ExtensionsClient) listByAccountHandleResponse(resp *http.Response) (ExtensionsClientListByAccountResponse, error) { - result := ExtensionsClientListByAccountResponse{RawResponse: resp} + result := ExtensionsClientListByAccountResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ExtensionResourceListResult); err != nil { return ExtensionsClientListByAccountResponse{}, err } @@ -330,7 +335,7 @@ func (client *ExtensionsClient) updateCreateRequest(ctx context.Context, resourc // updateHandleResponse handles the Update response. func (client *ExtensionsClient) updateHandleResponse(resp *http.Response) (ExtensionsClientUpdateResponse, error) { - result := ExtensionsClientUpdateResponse{RawResponse: resp} + result := ExtensionsClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ExtensionResource); err != nil { return ExtensionsClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_models.go b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_models.go index 1e7f0db3d8e5..0915b802c8c9 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_models.go +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,6 @@ package armvisualstudio -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - // AccountResource - The response to an account resource GET request. type AccountResource struct { // Resource location. @@ -35,31 +29,12 @@ type AccountResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AccountResource. -func (a AccountResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - // AccountResourceListResult - The response to an account resource list GET request. type AccountResourceListResult struct { // Array of resource details. Value []*AccountResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AccountResourceListResult. -func (a AccountResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - // AccountResourceRequest - The body of a PUT request to modify a Visual Studio account resource. type AccountResourceRequest struct { // The account name. @@ -78,30 +53,12 @@ type AccountResourceRequest struct { Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AccountResourceRequest. -func (a AccountResourceRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accountName", a.AccountName) - populate(objectMap, "location", a.Location) - populate(objectMap, "operationType", a.OperationType) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - // AccountTagRequest - The body of a Patch request to add tags to a Visual Studio account resource. type AccountTagRequest struct { // The custom tags of the resource. Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AccountTagRequest. -func (a AccountTagRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - // AccountsClientCheckNameAvailabilityOptions contains the optional parameters for the AccountsClient.CheckNameAvailability // method. type AccountsClientCheckNameAvailabilityOptions struct { @@ -175,32 +132,12 @@ type ExtensionResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ExtensionResource. -func (e ExtensionResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", e.ID) - populate(objectMap, "location", e.Location) - populate(objectMap, "name", e.Name) - populate(objectMap, "plan", e.Plan) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "tags", e.Tags) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - // ExtensionResourceListResult - The response to an extension resource list GET request. type ExtensionResourceListResult struct { // Array of extension resource details. Value []*ExtensionResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ExtensionResourceListResult. -func (e ExtensionResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - // ExtensionResourcePlan - Plan data for an extension resource. type ExtensionResourcePlan struct { // Name of the plan. @@ -234,16 +171,6 @@ type ExtensionResourceRequest struct { Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ExtensionResourceRequest. -func (e ExtensionResourceRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "location", e.Location) - populate(objectMap, "plan", e.Plan) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "tags", e.Tags) - return json.Marshal(objectMap) -} - // ExtensionsClientCreateOptions contains the optional parameters for the ExtensionsClient.Create method. type ExtensionsClientCreateOptions struct { // placeholder for future optional parameters @@ -284,13 +211,6 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationProperties - Properties of an operation supported by the resource provider. type OperationProperties struct { // The description of the resource operation. @@ -332,33 +252,16 @@ type ProjectResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ProjectResource. -func (p ProjectResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - // ProjectResourceListResult - The response to a request to list Team Services project resources in a resource group/account. type ProjectResourceListResult struct { // List of project resource details. Value []*ProjectResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ProjectResourceListResult. -func (p ProjectResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // ProjectsClientBeginCreateOptions contains the optional parameters for the ProjectsClient.BeginCreate method. type ProjectsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string // This parameter is ignored and should be set to an empty string. Validating *string } @@ -401,24 +304,3 @@ type Resource struct { // READ-ONLY; Resource type. Type *string `json:"type,omitempty" azure:"ro"` } - -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_models_serde.go b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_models_serde.go new file mode 100644 index 000000000000..5358fe6cc6ef --- /dev/null +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_models_serde.go @@ -0,0 +1,129 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armvisualstudio + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AccountResource. +func (a AccountResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AccountResourceListResult. +func (a AccountResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AccountResourceRequest. +func (a AccountResourceRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountName", a.AccountName) + populate(objectMap, "location", a.Location) + populate(objectMap, "operationType", a.OperationType) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AccountTagRequest. +func (a AccountTagRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ExtensionResource. +func (e ExtensionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "plan", e.Plan) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ExtensionResourceListResult. +func (e ExtensionResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ExtensionResourceRequest. +func (e ExtensionResourceRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", e.Location) + populate(objectMap, "plan", e.Plan) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "tags", e.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ProjectResource. +func (p ProjectResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ProjectResourceListResult. +func (p ProjectResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_operations_client.go b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_operations_client.go index 731f278c35a0..4374ea217794 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_operations_client.go +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,19 +29,23 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Gets the details of all operations possible on the Microsoft.VisualStudio resource provider. @@ -74,7 +79,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_pollers.go b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_pollers.go deleted file mode 100644 index 78a23d41c8a8..000000000000 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_pollers.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armvisualstudio - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// ProjectsClientCreatePoller provides polling facilities until the operation reaches a terminal state. -type ProjectsClientCreatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ProjectsClientCreatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *ProjectsClientCreatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final ProjectsClientCreateResponse will be returned. -func (p *ProjectsClientCreatePoller) FinalResponse(ctx context.Context) (ProjectsClientCreateResponse, error) { - respType := ProjectsClientCreateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ProjectResource) - if err != nil { - return ProjectsClientCreateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *ProjectsClientCreatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_projects_client.go b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_projects_client.go index 0a12e0248bef..e154a75bde2c 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_projects_client.go +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_projects_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ProjectsClient struct { // subscriptionID - The Azure subscription identifier. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewProjectsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ProjectsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewProjectsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ProjectsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreate - Creates a Team Services project in the collection with the specified name. 'VersionControlOption' and 'ProcessTemplateId' @@ -60,22 +65,16 @@ func NewProjectsClient(subscriptionID string, credential azcore.TokenCredential, // resourceName - Name of the Team Services project. // body - The request data. // options - ProjectsClientBeginCreateOptions contains the optional parameters for the ProjectsClient.BeginCreate method. -func (client *ProjectsClient) BeginCreate(ctx context.Context, resourceGroupName string, rootResourceName string, resourceName string, body ProjectResource, options *ProjectsClientBeginCreateOptions) (ProjectsClientCreatePollerResponse, error) { - resp, err := client.create(ctx, resourceGroupName, rootResourceName, resourceName, body, options) - if err != nil { - return ProjectsClientCreatePollerResponse{}, err - } - result := ProjectsClientCreatePollerResponse{ - RawResponse: resp, +func (client *ProjectsClient) BeginCreate(ctx context.Context, resourceGroupName string, rootResourceName string, resourceName string, body ProjectResource, options *ProjectsClientBeginCreateOptions) (*armruntime.Poller[ProjectsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, rootResourceName, resourceName, body, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ProjectsClientCreateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ProjectsClientCreateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("ProjectsClient.Create", "", resp, client.pl) - if err != nil { - return ProjectsClientCreatePollerResponse{}, err - } - result.Poller = &ProjectsClientCreatePoller{ - pt: pt, - } - return result, nil } // Create - Creates a Team Services project in the collection with the specified name. 'VersionControlOption' and 'ProcessTemplateId' @@ -185,7 +184,7 @@ func (client *ProjectsClient) getCreateRequest(ctx context.Context, resourceGrou // getHandleResponse handles the Get response. func (client *ProjectsClient) getHandleResponse(resp *http.Response) (ProjectsClientGetResponse, error) { - result := ProjectsClientGetResponse{RawResponse: resp} + result := ProjectsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ProjectResource); err != nil { return ProjectsClientGetResponse{}, err } @@ -255,7 +254,7 @@ func (client *ProjectsClient) getJobStatusCreateRequest(ctx context.Context, res // getJobStatusHandleResponse handles the GetJobStatus response. func (client *ProjectsClient) getJobStatusHandleResponse(resp *http.Response) (ProjectsClientGetJobStatusResponse, error) { - result := ProjectsClientGetJobStatusResponse{RawResponse: resp} + result := ProjectsClientGetJobStatusResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ProjectResource); err != nil { return ProjectsClientGetJobStatusResponse{}, err } @@ -311,7 +310,7 @@ func (client *ProjectsClient) listByResourceGroupCreateRequest(ctx context.Conte // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *ProjectsClient) listByResourceGroupHandleResponse(resp *http.Response) (ProjectsClientListByResourceGroupResponse, error) { - result := ProjectsClientListByResourceGroupResponse{RawResponse: resp} + result := ProjectsClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ProjectResourceListResult); err != nil { return ProjectsClientListByResourceGroupResponse{}, err } @@ -372,7 +371,7 @@ func (client *ProjectsClient) updateCreateRequest(ctx context.Context, resourceG // updateHandleResponse handles the Update response. func (client *ProjectsClient) updateHandleResponse(resp *http.Response) (ProjectsClientUpdateResponse, error) { - result := ProjectsClientUpdateResponse{RawResponse: resp} + result := ProjectsClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ProjectResource); err != nil { return ProjectsClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_response_types.go b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_response_types.go index 90f8a6a9f6f5..3e57bfd63188 100644 --- a/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_response_types.go +++ b/sdk/resourcemanager/visualstudio/armvisualstudio/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,241 +8,87 @@ package armvisualstudio -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - // AccountsClientCheckNameAvailabilityResponse contains the response from method AccountsClient.CheckNameAvailability. type AccountsClientCheckNameAvailabilityResponse struct { - AccountsClientCheckNameAvailabilityResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientCheckNameAvailabilityResult contains the result from method AccountsClient.CheckNameAvailability. -type AccountsClientCheckNameAvailabilityResult struct { CheckNameAvailabilityResult } // AccountsClientCreateOrUpdateResponse contains the response from method AccountsClient.CreateOrUpdate. type AccountsClientCreateOrUpdateResponse struct { - AccountsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientCreateOrUpdateResult contains the result from method AccountsClient.CreateOrUpdate. -type AccountsClientCreateOrUpdateResult struct { AccountResource } // AccountsClientDeleteResponse contains the response from method AccountsClient.Delete. type AccountsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // AccountsClientGetResponse contains the response from method AccountsClient.Get. type AccountsClientGetResponse struct { - AccountsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientGetResult contains the result from method AccountsClient.Get. -type AccountsClientGetResult struct { AccountResource } // AccountsClientListByResourceGroupResponse contains the response from method AccountsClient.ListByResourceGroup. type AccountsClientListByResourceGroupResponse struct { - AccountsClientListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientListByResourceGroupResult contains the result from method AccountsClient.ListByResourceGroup. -type AccountsClientListByResourceGroupResult struct { AccountResourceListResult } // AccountsClientUpdateResponse contains the response from method AccountsClient.Update. type AccountsClientUpdateResponse struct { - AccountsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientUpdateResult contains the result from method AccountsClient.Update. -type AccountsClientUpdateResult struct { AccountResource } // ExtensionsClientCreateResponse contains the response from method ExtensionsClient.Create. type ExtensionsClientCreateResponse struct { - ExtensionsClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ExtensionsClientCreateResult contains the result from method ExtensionsClient.Create. -type ExtensionsClientCreateResult struct { ExtensionResource } // ExtensionsClientDeleteResponse contains the response from method ExtensionsClient.Delete. type ExtensionsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // ExtensionsClientGetResponse contains the response from method ExtensionsClient.Get. type ExtensionsClientGetResponse struct { - ExtensionsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ExtensionsClientGetResult contains the result from method ExtensionsClient.Get. -type ExtensionsClientGetResult struct { ExtensionResource } // ExtensionsClientListByAccountResponse contains the response from method ExtensionsClient.ListByAccount. type ExtensionsClientListByAccountResponse struct { - ExtensionsClientListByAccountResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ExtensionsClientListByAccountResult contains the result from method ExtensionsClient.ListByAccount. -type ExtensionsClientListByAccountResult struct { ExtensionResourceListResult } // ExtensionsClientUpdateResponse contains the response from method ExtensionsClient.Update. type ExtensionsClientUpdateResponse struct { - ExtensionsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ExtensionsClientUpdateResult contains the result from method ExtensionsClient.Update. -type ExtensionsClientUpdateResult struct { ExtensionResource } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationListResult } -// ProjectsClientCreatePollerResponse contains the response from method ProjectsClient.Create. -type ProjectsClientCreatePollerResponse struct { - // Poller contains an initialized poller. - Poller *ProjectsClientCreatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l ProjectsClientCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ProjectsClientCreateResponse, error) { - respType := ProjectsClientCreateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ProjectResource) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ProjectsClientCreatePollerResponse from the provided client and resume token. -func (l *ProjectsClientCreatePollerResponse) Resume(ctx context.Context, client *ProjectsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ProjectsClient.Create", token, client.pl) - if err != nil { - return err - } - poller := &ProjectsClientCreatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ProjectsClientCreateResponse contains the response from method ProjectsClient.Create. type ProjectsClientCreateResponse struct { - ProjectsClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ProjectsClientCreateResult contains the result from method ProjectsClient.Create. -type ProjectsClientCreateResult struct { ProjectResource } // ProjectsClientGetJobStatusResponse contains the response from method ProjectsClient.GetJobStatus. type ProjectsClientGetJobStatusResponse struct { - ProjectsClientGetJobStatusResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ProjectsClientGetJobStatusResult contains the result from method ProjectsClient.GetJobStatus. -type ProjectsClientGetJobStatusResult struct { ProjectResource } // ProjectsClientGetResponse contains the response from method ProjectsClient.Get. type ProjectsClientGetResponse struct { - ProjectsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ProjectsClientGetResult contains the result from method ProjectsClient.Get. -type ProjectsClientGetResult struct { ProjectResource } // ProjectsClientListByResourceGroupResponse contains the response from method ProjectsClient.ListByResourceGroup. type ProjectsClientListByResourceGroupResponse struct { - ProjectsClientListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ProjectsClientListByResourceGroupResult contains the result from method ProjectsClient.ListByResourceGroup. -type ProjectsClientListByResourceGroupResult struct { ProjectResourceListResult } // ProjectsClientUpdateResponse contains the response from method ProjectsClient.Update. type ProjectsClientUpdateResponse struct { - ProjectsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ProjectsClientUpdateResult contains the result from method ProjectsClient.Update. -type ProjectsClientUpdateResult struct { ProjectResource } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/CHANGELOG.md b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/CHANGELOG.md index 6174bcd65aca..b1304f0bb6a3 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/CHANGELOG.md +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/CHANGELOG.md @@ -1,5 +1,311 @@ # Release History +## 0.3.0 (2022-04-13) +### Breaking Changes + +- Function `*UsagesClient.List` return value(s) have been changed from `(*UsagesClientListPager)` to `(*runtime.Pager[UsagesClientListResponse])` +- Function `NewVirtualMachinesClient` parameter(s) have been changed from `(string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `NewVirtualMachinesClient` return value(s) have been changed from `(*VirtualMachinesClient)` to `(*VirtualMachinesClient, error)` +- Function `NewVirtualMachineTemplatesClient` return value(s) have been changed from `(*VirtualMachineTemplatesClient)` to `(*VirtualMachineTemplatesClient, error)` +- Function `*DedicatedCloudNodesClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, DedicatedCloudNode, *DedicatedCloudNodesClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, string, DedicatedCloudNode, *DedicatedCloudNodesClientBeginCreateOrUpdateOptions)` +- Function `*DedicatedCloudNodesClient.BeginCreateOrUpdate` return value(s) have been changed from `(DedicatedCloudNodesClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[DedicatedCloudNodesClientCreateOrUpdateResponse], error)` +- Function `*VirtualMachinesClient.ListBySubscription` return value(s) have been changed from `(*VirtualMachinesClientListBySubscriptionPager)` to `(*runtime.Pager[VirtualMachinesClientListBySubscriptionResponse])` +- Function `NewSKUsAvailabilityClient` return value(s) have been changed from `(*SKUsAvailabilityClient)` to `(*SKUsAvailabilityClient, error)` +- Function `NewCustomizationPoliciesClient` return value(s) have been changed from `(*CustomizationPoliciesClient)` to `(*CustomizationPoliciesClient, error)` +- Function `*VirtualMachinesClient.ListByResourceGroup` return value(s) have been changed from `(*VirtualMachinesClientListByResourceGroupPager)` to `(*runtime.Pager[VirtualMachinesClientListByResourceGroupResponse])` +- Function `*VirtualMachinesClient.BeginStop` parameter(s) have been changed from `(context.Context, string, string, *VirtualMachinesClientBeginStopOptions)` to `(context.Context, string, string, string, *VirtualMachinesClientBeginStopOptions)` +- Function `*VirtualMachinesClient.BeginStop` return value(s) have been changed from `(VirtualMachinesClientStopPollerResponse, error)` to `(*armruntime.Poller[VirtualMachinesClientStopResponse], error)` +- Function `*VirtualMachinesClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, VirtualMachine, *VirtualMachinesClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, string, VirtualMachine, *VirtualMachinesClientBeginCreateOrUpdateOptions)` +- Function `*VirtualMachinesClient.BeginCreateOrUpdate` return value(s) have been changed from `(VirtualMachinesClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[VirtualMachinesClientCreateOrUpdateResponse], error)` +- Function `*DedicatedCloudServicesClient.BeginDelete` return value(s) have been changed from `(DedicatedCloudServicesClientDeletePollerResponse, error)` to `(*armruntime.Poller[DedicatedCloudServicesClientDeleteResponse], error)` +- Function `*OperationsClient.Get` parameter(s) have been changed from `(context.Context, string, string, *OperationsClientGetOptions)` to `(context.Context, string, string, string, *OperationsClientGetOptions)` +- Function `*DedicatedCloudNodesClient.ListBySubscription` return value(s) have been changed from `(*DedicatedCloudNodesClientListBySubscriptionPager)` to `(*runtime.Pager[DedicatedCloudNodesClientListBySubscriptionResponse])` +- Function `*ResourcePoolsClient.List` return value(s) have been changed from `(*ResourcePoolsClientListPager)` to `(*runtime.Pager[ResourcePoolsClientListResponse])` +- Function `NewDedicatedCloudServicesClient` return value(s) have been changed from `(*DedicatedCloudServicesClient)` to `(*DedicatedCloudServicesClient, error)` +- Function `*VirtualMachinesClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, string, *VirtualMachinesClientBeginDeleteOptions)` to `(context.Context, string, string, string, *VirtualMachinesClientBeginDeleteOptions)` +- Function `*VirtualMachinesClient.BeginDelete` return value(s) have been changed from `(VirtualMachinesClientDeletePollerResponse, error)` to `(*armruntime.Poller[VirtualMachinesClientDeleteResponse], error)` +- Function `NewPrivateCloudsClient` return value(s) have been changed from `(*PrivateCloudsClient)` to `(*PrivateCloudsClient, error)` +- Function `*VirtualMachinesClient.BeginStart` parameter(s) have been changed from `(context.Context, string, string, *VirtualMachinesClientBeginStartOptions)` to `(context.Context, string, string, string, *VirtualMachinesClientBeginStartOptions)` +- Function `*VirtualMachinesClient.BeginStart` return value(s) have been changed from `(VirtualMachinesClientStartPollerResponse, error)` to `(*armruntime.Poller[VirtualMachinesClientStartResponse], error)` +- Function `NewResourcePoolsClient` return value(s) have been changed from `(*ResourcePoolsClient)` to `(*ResourcePoolsClient, error)` +- Function `*OperationsClient.List` return value(s) have been changed from `(*OperationsClientListPager)` to `(*runtime.Pager[OperationsClientListResponse])` +- Function `*VirtualMachinesClient.BeginUpdate` return value(s) have been changed from `(VirtualMachinesClientUpdatePollerResponse, error)` to `(*armruntime.Poller[VirtualMachinesClientUpdateResponse], error)` +- Function `NewOperationsClient` parameter(s) have been changed from `(string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `*VirtualMachineTemplatesClient.List` return value(s) have been changed from `(*VirtualMachineTemplatesClientListPager)` to `(*runtime.Pager[VirtualMachineTemplatesClientListResponse])` +- Function `*PrivateCloudsClient.List` return value(s) have been changed from `(*PrivateCloudsClientListPager)` to `(*runtime.Pager[PrivateCloudsClientListResponse])` +- Function `*VirtualNetworksClient.List` return value(s) have been changed from `(*VirtualNetworksClientListPager)` to `(*runtime.Pager[VirtualNetworksClientListResponse])` +- Function `NewDedicatedCloudNodesClient` parameter(s) have been changed from `(string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `NewDedicatedCloudNodesClient` return value(s) have been changed from `(*DedicatedCloudNodesClient)` to `(*DedicatedCloudNodesClient, error)` +- Function `*SKUsAvailabilityClient.List` return value(s) have been changed from `(*SKUsAvailabilityClientListPager)` to `(*runtime.Pager[SKUsAvailabilityClientListResponse])` +- Function `*DedicatedCloudServicesClient.ListBySubscription` return value(s) have been changed from `(*DedicatedCloudServicesClientListBySubscriptionPager)` to `(*runtime.Pager[DedicatedCloudServicesClientListBySubscriptionResponse])` +- Function `*DedicatedCloudServicesClient.ListByResourceGroup` return value(s) have been changed from `(*DedicatedCloudServicesClientListByResourceGroupPager)` to `(*runtime.Pager[DedicatedCloudServicesClientListByResourceGroupResponse])` +- Function `*DedicatedCloudNodesClient.ListByResourceGroup` return value(s) have been changed from `(*DedicatedCloudNodesClientListByResourceGroupPager)` to `(*runtime.Pager[DedicatedCloudNodesClientListByResourceGroupResponse])` +- Function `*CustomizationPoliciesClient.List` return value(s) have been changed from `(*CustomizationPoliciesClientListPager)` to `(*runtime.Pager[CustomizationPoliciesClientListResponse])` +- Function `NewVirtualNetworksClient` return value(s) have been changed from `(*VirtualNetworksClient)` to `(*VirtualNetworksClient, error)` +- Function `NewUsagesClient` return value(s) have been changed from `(*UsagesClient)` to `(*UsagesClient, error)` +- Function `AggregationType.ToPtr` has been removed +- Function `*CustomizationPoliciesClientListPager.Err` has been removed +- Function `*DedicatedCloudServicesClientListBySubscriptionPager.NextPage` has been removed +- Function `VirtualMachinesClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*DedicatedCloudNodesClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*DedicatedCloudServicesClientListBySubscriptionPager.PageResponse` has been removed +- Function `*DedicatedCloudServicesClientListByResourceGroupPager.NextPage` has been removed +- Function `DiskIndependenceMode.ToPtr` has been removed +- Function `*VirtualMachinesClientStopPollerResponse.Resume` has been removed +- Function `*ResourcePoolsClientListPager.NextPage` has been removed +- Function `*PrivateCloudsClientListPager.NextPage` has been removed +- Function `*VirtualMachinesClientCreateOrUpdatePoller.Done` has been removed +- Function `*VirtualMachinesClientListByResourceGroupPager.NextPage` has been removed +- Function `*DedicatedCloudServicesClientDeletePoller.Poll` has been removed +- Function `*VirtualMachinesClientCreateOrUpdatePoller.Poll` has been removed +- Function `StopMode.ToPtr` has been removed +- Function `*DedicatedCloudNodesClientListByResourceGroupPager.Err` has been removed +- Function `*DedicatedCloudNodesClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*VirtualMachinesClientListByResourceGroupPager.PageResponse` has been removed +- Function `*VirtualMachinesClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*VirtualMachinesClientStartPollerResponse.Resume` has been removed +- Function `*SKUsAvailabilityClientListPager.Err` has been removed +- Function `*DedicatedCloudNodesClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*VirtualMachinesClientStartPoller.Done` has been removed +- Function `*VirtualMachinesClientDeletePoller.Done` has been removed +- Function `*VirtualNetworksClientListPager.Err` has been removed +- Function `*DedicatedCloudServicesClientListByResourceGroupPager.Err` has been removed +- Function `*VirtualMachinesClientDeletePoller.ResumeToken` has been removed +- Function `*VirtualMachinesClientStartPoller.Poll` has been removed +- Function `*DedicatedCloudNodesClientListBySubscriptionPager.NextPage` has been removed +- Function `*CustomizationPoliciesClientListPager.NextPage` has been removed +- Function `VirtualMachineStatus.ToPtr` has been removed +- Function `*VirtualMachinesClientStopPoller.Poll` has been removed +- Function `*VirtualMachinesClientDeletePoller.FinalResponse` has been removed +- Function `*SKUsAvailabilityClientListPager.PageResponse` has been removed +- Function `DedicatedCloudNodesClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*DedicatedCloudNodesClientListByResourceGroupPager.NextPage` has been removed +- Function `*DedicatedCloudNodesClientCreateOrUpdatePoller.Done` has been removed +- Function `OnboardingStatus.ToPtr` has been removed +- Function `*PrivateCloudsClientListPager.Err` has been removed +- Function `OperationOrigin.ToPtr` has been removed +- Function `VirtualMachinesClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*UsagesClientListPager.NextPage` has been removed +- Function `*VirtualMachinesClientListBySubscriptionPager.NextPage` has been removed +- Function `*VirtualMachinesClientUpdatePoller.Done` has been removed +- Function `*VirtualMachinesClientStartPoller.ResumeToken` has been removed +- Function `*VirtualMachinesClientDeletePoller.Poll` has been removed +- Function `*VirtualMachinesClientStopPoller.ResumeToken` has been removed +- Function `CustomizationIdentityType.ToPtr` has been removed +- Function `*VirtualMachinesClientListBySubscriptionPager.Err` has been removed +- Function `VirtualMachinesClientUpdatePollerResponse.PollUntilDone` has been removed +- Function `*VirtualMachinesClientListByResourceGroupPager.Err` has been removed +- Function `DedicatedCloudServicesClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*UsagesClientListPager.PageResponse` has been removed +- Function `*VirtualMachinesClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `CustomizationPolicyPropertiesType.ToPtr` has been removed +- Function `*VirtualMachinesClientUpdatePollerResponse.Resume` has been removed +- Function `*VirtualMachineTemplatesClientListPager.PageResponse` has been removed +- Function `VirtualMachinesClientStopPollerResponse.PollUntilDone` has been removed +- Function `*OperationsClientListPager.Err` has been removed +- Function `*VirtualMachinesClientStopPoller.Done` has been removed +- Function `*VirtualNetworksClientListPager.PageResponse` has been removed +- Function `*DedicatedCloudServicesClientListBySubscriptionPager.Err` has been removed +- Function `*VirtualMachinesClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*ResourcePoolsClientListPager.Err` has been removed +- Function `*DedicatedCloudServicesClientDeletePoller.ResumeToken` has been removed +- Function `*DedicatedCloudNodesClientListBySubscriptionPager.PageResponse` has been removed +- Function `*VirtualMachinesClientUpdatePoller.ResumeToken` has been removed +- Function `NICType.ToPtr` has been removed +- Function `*OperationsClientListPager.PageResponse` has been removed +- Function `NodeStatus.ToPtr` has been removed +- Function `VirtualMachinesClientStartPollerResponse.PollUntilDone` has been removed +- Function `*VirtualMachinesClientStartPoller.FinalResponse` has been removed +- Function `*VirtualMachinesClientListBySubscriptionPager.PageResponse` has been removed +- Function `*VirtualMachineTemplatesClientListPager.Err` has been removed +- Function `CustomizationIPAddressType.ToPtr` has been removed +- Function `*VirtualMachinesClientUpdatePoller.FinalResponse` has been removed +- Function `*DedicatedCloudServicesClientListByResourceGroupPager.PageResponse` has been removed +- Function `*DedicatedCloudServicesClientDeletePoller.Done` has been removed +- Function `*VirtualMachinesClientDeletePollerResponse.Resume` has been removed +- Function `*UsagesClientListPager.Err` has been removed +- Function `*VirtualNetworksClientListPager.NextPage` has been removed +- Function `*SKUsAvailabilityClientListPager.NextPage` has been removed +- Function `*DedicatedCloudNodesClientCreateOrUpdatePoller.Poll` has been removed +- Function `*OperationsClientListPager.NextPage` has been removed +- Function `*DedicatedCloudNodesClientListByResourceGroupPager.PageResponse` has been removed +- Function `*ResourcePoolsClientListPager.PageResponse` has been removed +- Function `*VirtualMachineTemplatesClientListPager.NextPage` has been removed +- Function `*DedicatedCloudServicesClientDeletePollerResponse.Resume` has been removed +- Function `*VirtualMachinesClientUpdatePoller.Poll` has been removed +- Function `GuestOSType.ToPtr` has been removed +- Function `*PrivateCloudsClientListPager.PageResponse` has been removed +- Function `*VirtualMachinesClientStopPoller.FinalResponse` has been removed +- Function `*CustomizationPoliciesClientListPager.PageResponse` has been removed +- Function `*DedicatedCloudServicesClientDeletePoller.FinalResponse` has been removed +- Function `GuestOSNICCustomizationAllocation.ToPtr` has been removed +- Function `*DedicatedCloudNodesClientListBySubscriptionPager.Err` has been removed +- Function `UsageCount.ToPtr` has been removed +- Function `CustomizationHostNameType.ToPtr` has been removed +- Struct `CustomizationPoliciesClientGetResult` has been removed +- Struct `CustomizationPoliciesClientListPager` has been removed +- Struct `CustomizationPoliciesClientListResult` has been removed +- Struct `DedicatedCloudNodesClientCreateOrUpdatePoller` has been removed +- Struct `DedicatedCloudNodesClientCreateOrUpdatePollerResponse` has been removed +- Struct `DedicatedCloudNodesClientCreateOrUpdateResult` has been removed +- Struct `DedicatedCloudNodesClientGetResult` has been removed +- Struct `DedicatedCloudNodesClientListByResourceGroupPager` has been removed +- Struct `DedicatedCloudNodesClientListByResourceGroupResult` has been removed +- Struct `DedicatedCloudNodesClientListBySubscriptionPager` has been removed +- Struct `DedicatedCloudNodesClientListBySubscriptionResult` has been removed +- Struct `DedicatedCloudNodesClientUpdateResult` has been removed +- Struct `DedicatedCloudServicesClientCreateOrUpdateResult` has been removed +- Struct `DedicatedCloudServicesClientDeletePoller` has been removed +- Struct `DedicatedCloudServicesClientDeletePollerResponse` has been removed +- Struct `DedicatedCloudServicesClientGetResult` has been removed +- Struct `DedicatedCloudServicesClientListByResourceGroupPager` has been removed +- Struct `DedicatedCloudServicesClientListByResourceGroupResult` has been removed +- Struct `DedicatedCloudServicesClientListBySubscriptionPager` has been removed +- Struct `DedicatedCloudServicesClientListBySubscriptionResult` has been removed +- Struct `DedicatedCloudServicesClientUpdateResult` has been removed +- Struct `OperationsClientGetResult` has been removed +- Struct `OperationsClientListPager` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `PrivateCloudsClientGetResult` has been removed +- Struct `PrivateCloudsClientListPager` has been removed +- Struct `PrivateCloudsClientListResult` has been removed +- Struct `ResourcePoolsClientGetResult` has been removed +- Struct `ResourcePoolsClientListPager` has been removed +- Struct `ResourcePoolsClientListResult` has been removed +- Struct `SKUsAvailabilityClientListPager` has been removed +- Struct `SKUsAvailabilityClientListResult` has been removed +- Struct `UsagesClientListPager` has been removed +- Struct `UsagesClientListResult` has been removed +- Struct `VirtualMachineTemplatesClientGetResult` has been removed +- Struct `VirtualMachineTemplatesClientListPager` has been removed +- Struct `VirtualMachineTemplatesClientListResult` has been removed +- Struct `VirtualMachinesClientCreateOrUpdatePoller` has been removed +- Struct `VirtualMachinesClientCreateOrUpdatePollerResponse` has been removed +- Struct `VirtualMachinesClientCreateOrUpdateResult` has been removed +- Struct `VirtualMachinesClientDeletePoller` has been removed +- Struct `VirtualMachinesClientDeletePollerResponse` has been removed +- Struct `VirtualMachinesClientGetResult` has been removed +- Struct `VirtualMachinesClientListByResourceGroupPager` has been removed +- Struct `VirtualMachinesClientListByResourceGroupResult` has been removed +- Struct `VirtualMachinesClientListBySubscriptionPager` has been removed +- Struct `VirtualMachinesClientListBySubscriptionResult` has been removed +- Struct `VirtualMachinesClientStartPoller` has been removed +- Struct `VirtualMachinesClientStartPollerResponse` has been removed +- Struct `VirtualMachinesClientStopPoller` has been removed +- Struct `VirtualMachinesClientStopPollerResponse` has been removed +- Struct `VirtualMachinesClientUpdatePoller` has been removed +- Struct `VirtualMachinesClientUpdatePollerResponse` has been removed +- Struct `VirtualMachinesClientUpdateResult` has been removed +- Struct `VirtualNetworksClientGetResult` has been removed +- Struct `VirtualNetworksClientListPager` has been removed +- Struct `VirtualNetworksClientListResult` has been removed +- Field `UsagesClientListResult` of struct `UsagesClientListResponse` has been removed +- Field `RawResponse` of struct `UsagesClientListResponse` has been removed +- Field `VirtualMachinesClientUpdateResult` of struct `VirtualMachinesClientUpdateResponse` has been removed +- Field `RawResponse` of struct `VirtualMachinesClientUpdateResponse` has been removed +- Field `CustomizationPoliciesClientListResult` of struct `CustomizationPoliciesClientListResponse` has been removed +- Field `RawResponse` of struct `CustomizationPoliciesClientListResponse` has been removed +- Field `VirtualMachinesClientGetResult` of struct `VirtualMachinesClientGetResponse` has been removed +- Field `RawResponse` of struct `VirtualMachinesClientGetResponse` has been removed +- Field `DedicatedCloudNodesClientCreateOrUpdateResult` of struct `DedicatedCloudNodesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `DedicatedCloudNodesClientCreateOrUpdateResponse` has been removed +- Field `ResourcePoolsClientListResult` of struct `ResourcePoolsClientListResponse` has been removed +- Field `RawResponse` of struct `ResourcePoolsClientListResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `VirtualMachinesClientListByResourceGroupResult` of struct `VirtualMachinesClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `VirtualMachinesClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `VirtualMachinesClientStopResponse` has been removed +- Field `VirtualMachineTemplatesClientListResult` of struct `VirtualMachineTemplatesClientListResponse` has been removed +- Field `RawResponse` of struct `VirtualMachineTemplatesClientListResponse` has been removed +- Field `RawResponse` of struct `VirtualMachinesClientStartResponse` has been removed +- Field `DedicatedCloudServicesClientUpdateResult` of struct `DedicatedCloudServicesClientUpdateResponse` has been removed +- Field `RawResponse` of struct `DedicatedCloudServicesClientUpdateResponse` has been removed +- Field `DedicatedCloudServicesClientListByResourceGroupResult` of struct `DedicatedCloudServicesClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `DedicatedCloudServicesClientListByResourceGroupResponse` has been removed +- Field `VirtualMachinesClientListBySubscriptionResult` of struct `VirtualMachinesClientListBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `VirtualMachinesClientListBySubscriptionResponse` has been removed +- Field `DedicatedCloudNodesClientListBySubscriptionResult` of struct `DedicatedCloudNodesClientListBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `DedicatedCloudNodesClientListBySubscriptionResponse` has been removed +- Field `VirtualNetworksClientListResult` of struct `VirtualNetworksClientListResponse` has been removed +- Field `RawResponse` of struct `VirtualNetworksClientListResponse` has been removed +- Field `RawResponse` of struct `DedicatedCloudNodesClientDeleteResponse` has been removed +- Field `SKUsAvailabilityClientListResult` of struct `SKUsAvailabilityClientListResponse` has been removed +- Field `RawResponse` of struct `SKUsAvailabilityClientListResponse` has been removed +- Field `OperationsClientGetResult` of struct `OperationsClientGetResponse` has been removed +- Field `RawResponse` of struct `OperationsClientGetResponse` has been removed +- Field `PrivateCloudsClientGetResult` of struct `PrivateCloudsClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateCloudsClientGetResponse` has been removed +- Field `ResourcePoolsClientGetResult` of struct `ResourcePoolsClientGetResponse` has been removed +- Field `RawResponse` of struct `ResourcePoolsClientGetResponse` has been removed +- Field `CustomizationPoliciesClientGetResult` of struct `CustomizationPoliciesClientGetResponse` has been removed +- Field `RawResponse` of struct `CustomizationPoliciesClientGetResponse` has been removed +- Field `DedicatedCloudServicesClientCreateOrUpdateResult` of struct `DedicatedCloudServicesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `DedicatedCloudServicesClientCreateOrUpdateResponse` has been removed +- Field `DedicatedCloudServicesClientGetResult` of struct `DedicatedCloudServicesClientGetResponse` has been removed +- Field `RawResponse` of struct `DedicatedCloudServicesClientGetResponse` has been removed +- Field `VirtualMachinesClientCreateOrUpdateResult` of struct `VirtualMachinesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `VirtualMachinesClientCreateOrUpdateResponse` has been removed +- Field `DedicatedCloudNodesClientGetResult` of struct `DedicatedCloudNodesClientGetResponse` has been removed +- Field `RawResponse` of struct `DedicatedCloudNodesClientGetResponse` has been removed +- Field `DedicatedCloudServicesClientListBySubscriptionResult` of struct `DedicatedCloudServicesClientListBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `DedicatedCloudServicesClientListBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `VirtualMachinesClientDeleteResponse` has been removed +- Field `DedicatedCloudNodesClientListByResourceGroupResult` of struct `DedicatedCloudNodesClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `DedicatedCloudNodesClientListByResourceGroupResponse` has been removed +- Field `VirtualNetworksClientGetResult` of struct `VirtualNetworksClientGetResponse` has been removed +- Field `RawResponse` of struct `VirtualNetworksClientGetResponse` has been removed +- Field `PrivateCloudsClientListResult` of struct `PrivateCloudsClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateCloudsClientListResponse` has been removed +- Field `RawResponse` of struct `DedicatedCloudServicesClientDeleteResponse` has been removed +- Field `DedicatedCloudNodesClientUpdateResult` of struct `DedicatedCloudNodesClientUpdateResponse` has been removed +- Field `RawResponse` of struct `DedicatedCloudNodesClientUpdateResponse` has been removed +- Field `VirtualMachineTemplatesClientGetResult` of struct `VirtualMachineTemplatesClientGetResponse` has been removed +- Field `RawResponse` of struct `VirtualMachineTemplatesClientGetResponse` has been removed + +### Features Added + +- New anonymous field `DedicatedCloudNode` in struct `DedicatedCloudNodesClientGetResponse` +- New field `ResumeToken` in struct `VirtualMachinesClientBeginDeleteOptions` +- New anonymous field `DedicatedCloudNode` in struct `DedicatedCloudNodesClientUpdateResponse` +- New anonymous field `VirtualNetwork` in struct `VirtualNetworksClientGetResponse` +- New anonymous field `SKUAvailabilityListResponse` in struct `SKUsAvailabilityClientListResponse` +- New anonymous field `DedicatedCloudService` in struct `DedicatedCloudServicesClientCreateOrUpdateResponse` +- New anonymous field `DedicatedCloudService` in struct `DedicatedCloudServicesClientUpdateResponse` +- New anonymous field `AvailableOperationsListResponse` in struct `OperationsClientListResponse` +- New anonymous field `VirtualMachineListResponse` in struct `VirtualMachinesClientListByResourceGroupResponse` +- New anonymous field `VirtualMachine` in struct `VirtualMachinesClientUpdateResponse` +- New anonymous field `VirtualMachineTemplate` in struct `VirtualMachineTemplatesClientGetResponse` +- New anonymous field `VirtualMachine` in struct `VirtualMachinesClientGetResponse` +- New field `ResumeToken` in struct `DedicatedCloudNodesClientBeginCreateOrUpdateOptions` +- New field `ResumeToken` in struct `VirtualMachinesClientBeginStopOptions` +- New anonymous field `ResourcePool` in struct `ResourcePoolsClientGetResponse` +- New anonymous field `VirtualMachineTemplateListResponse` in struct `VirtualMachineTemplatesClientListResponse` +- New anonymous field `CustomizationPolicy` in struct `CustomizationPoliciesClientGetResponse` +- New field `ResumeToken` in struct `VirtualMachinesClientBeginUpdateOptions` +- New field `ResumeToken` in struct `DedicatedCloudServicesClientBeginDeleteOptions` +- New anonymous field `DedicatedCloudNodeListResponse` in struct `DedicatedCloudNodesClientListByResourceGroupResponse` +- New anonymous field `UsageListResponse` in struct `UsagesClientListResponse` +- New anonymous field `DedicatedCloudServiceListResponse` in struct `DedicatedCloudServicesClientListBySubscriptionResponse` +- New field `ResumeToken` in struct `VirtualMachinesClientBeginCreateOrUpdateOptions` +- New anonymous field `CustomizationPoliciesListResponse` in struct `CustomizationPoliciesClientListResponse` +- New anonymous field `VirtualMachine` in struct `VirtualMachinesClientCreateOrUpdateResponse` +- New anonymous field `DedicatedCloudServiceListResponse` in struct `DedicatedCloudServicesClientListByResourceGroupResponse` +- New anonymous field `VirtualNetworkListResponse` in struct `VirtualNetworksClientListResponse` +- New field `ResumeToken` in struct `VirtualMachinesClientBeginStartOptions` +- New anonymous field `DedicatedCloudService` in struct `DedicatedCloudServicesClientGetResponse` +- New anonymous field `PrivateCloudList` in struct `PrivateCloudsClientListResponse` +- New anonymous field `DedicatedCloudNodeListResponse` in struct `DedicatedCloudNodesClientListBySubscriptionResponse` +- New anonymous field `PrivateCloud` in struct `PrivateCloudsClientGetResponse` +- New anonymous field `OperationResource` in struct `OperationsClientGetResponse` +- New field `Location` in struct `OperationsClientGetResponse` +- New field `RetryAfter` in struct `OperationsClientGetResponse` +- New anonymous field `DedicatedCloudNode` in struct `DedicatedCloudNodesClientCreateOrUpdateResponse` +- New anonymous field `VirtualMachineListResponse` in struct `VirtualMachinesClientListBySubscriptionResponse` +- New anonymous field `ResourcePoolsListResponse` in struct `ResourcePoolsClientListResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/README.md b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/README.md index 986c1878587b..36771bc9c15f 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/README.md +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/README.md @@ -11,7 +11,7 @@ The `armvmwarecloudsimple` module provides operations for working with Azure VMw ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure VMware Cloud Simple modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -client := armvmwarecloudsimple.NewCustomizationPoliciesClient(<subscription ID>, cred, nil) +client, err := armvmwarecloudsimple.NewCustomizationPoliciesClient(<subscription ID>, cred, nil) ``` You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armvmwarecloudsimple.NewCustomizationPoliciesClient(<subscription ID>, cred, &options) +client, err := armvmwarecloudsimple.NewCustomizationPoliciesClient(<subscription ID>, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/autorest.md b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/autorest.md index 38a938c91118..44381e3e45fe 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/autorest.md +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/vmwarecloudsimple/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/vmwarecloudsimple/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/vmwarecloudsimple/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/vmwarecloudsimple/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/go.mod b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/go.mod index 9fd272f9347d..982e7eaddbd0 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/go.mod +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/go.sum b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/go.sum +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_customizationpolicies_client_test.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_customizationpolicies_client_test.go index 0c51c472f56d..f47908dfc450 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_customizationpolicies_client_test.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_customizationpolicies_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,46 +16,57 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple" ) -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListCustomizationPolicies.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListCustomizationPolicies.json func ExampleCustomizationPoliciesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewCustomizationPoliciesClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewCustomizationPoliciesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<region-id>", "<pc-name>", &armvmwarecloudsimple.CustomizationPoliciesClientListOptions{Filter: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetCustomizationPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetCustomizationPolicy.json func ExampleCustomizationPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewCustomizationPoliciesClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewCustomizationPoliciesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<region-id>", "<pc-name>", "<customization-policy-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.CustomizationPoliciesClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_dedicatedcloudnodes_client_test.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_dedicatedcloudnodes_client_test.go index d661fac52847..bc7f7e1735ab 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_dedicatedcloudnodes_client_test.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_dedicatedcloudnodes_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,157 +19,188 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple" ) -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListDedicatedCloudNodes.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListDedicatedCloudNodes.json func ExampleDedicatedCloudNodesClient_ListBySubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewDedicatedCloudNodesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewDedicatedCloudNodesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListBySubscription(&armvmwarecloudsimple.DedicatedCloudNodesClientListBySubscriptionOptions{Filter: nil, Top: nil, SkipToken: nil, }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListRGDedicatedCloudNodes.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListRGDedicatedCloudNodes.json func ExampleDedicatedCloudNodesClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewDedicatedCloudNodesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewDedicatedCloudNodesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByResourceGroup("<resource-group-name>", &armvmwarecloudsimple.DedicatedCloudNodesClientListByResourceGroupOptions{Filter: nil, Top: nil, SkipToken: nil, }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetDedicatedCloudNode.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetDedicatedCloudNode.json func ExampleDedicatedCloudNodesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewDedicatedCloudNodesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewDedicatedCloudNodesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<dedicated-cloud-node-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.DedicatedCloudNodesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/CreateDedicatedCloudNode.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/CreateDedicatedCloudNode.json func ExampleDedicatedCloudNodesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewDedicatedCloudNodesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewDedicatedCloudNodesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "<resource-group-name>", + "<referer>", "<dedicated-cloud-node-name>", armvmwarecloudsimple.DedicatedCloudNode{ - Location: to.StringPtr("<location>"), + Location: to.Ptr("<location>"), Properties: &armvmwarecloudsimple.DedicatedCloudNodeProperties{ - AvailabilityZoneID: to.StringPtr("<availability-zone-id>"), - NodesCount: to.Int32Ptr(1), - PlacementGroupID: to.StringPtr("<placement-group-id>"), - PurchaseID: to.StringPtr("<purchase-id>"), + AvailabilityZoneID: to.Ptr("<availability-zone-id>"), + NodesCount: to.Ptr[int32](1), + PlacementGroupID: to.Ptr("<placement-group-id>"), + PurchaseID: to.Ptr("<purchase-id>"), SKUDescription: &armvmwarecloudsimple.SKUDescription{ - Name: to.StringPtr("<name>"), - ID: to.StringPtr("<id>"), + Name: to.Ptr("<name>"), + ID: to.Ptr("<id>"), }, }, SKU: &armvmwarecloudsimple.SKU{ - Name: to.StringPtr("<name>"), + Name: to.Ptr("<name>"), }, }, - nil) + &armvmwarecloudsimple.DedicatedCloudNodesClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.DedicatedCloudNodesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/DeleteDedicatedCloudNode.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/DeleteDedicatedCloudNode.json func ExampleDedicatedCloudNodesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewDedicatedCloudNodesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewDedicatedCloudNodesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "<resource-group-name>", "<dedicated-cloud-node-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/PatchDedicatedCloudNode.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/PatchDedicatedCloudNode.json func ExampleDedicatedCloudNodesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewDedicatedCloudNodesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewDedicatedCloudNodesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "<resource-group-name>", "<dedicated-cloud-node-name>", armvmwarecloudsimple.PatchPayload{ Tags: map[string]*string{ - "myTag": to.StringPtr("tagValue"), + "myTag": to.Ptr("tagValue"), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.DedicatedCloudNodesClientUpdateResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_dedicatedcloudservices_client_test.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_dedicatedcloudservices_client_test.go index fc10ceea5475..97c9c4026da3 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_dedicatedcloudservices_client_test.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_dedicatedcloudservices_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,141 +19,177 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple" ) -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListDedicatedCloudServices.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListDedicatedCloudServices.json func ExampleDedicatedCloudServicesClient_ListBySubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewDedicatedCloudServicesClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewDedicatedCloudServicesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListBySubscription(&armvmwarecloudsimple.DedicatedCloudServicesClientListBySubscriptionOptions{Filter: nil, Top: nil, SkipToken: nil, }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListRGDedicatedCloudServices.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListRGDedicatedCloudServices.json func ExampleDedicatedCloudServicesClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewDedicatedCloudServicesClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewDedicatedCloudServicesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByResourceGroup("<resource-group-name>", &armvmwarecloudsimple.DedicatedCloudServicesClientListByResourceGroupOptions{Filter: nil, Top: nil, SkipToken: nil, }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetDedicatedCloudService.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetDedicatedCloudService.json func ExampleDedicatedCloudServicesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewDedicatedCloudServicesClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewDedicatedCloudServicesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<dedicated-cloud-service-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.DedicatedCloudServicesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/CreateDedicatedCloudService.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/CreateDedicatedCloudService.json func ExampleDedicatedCloudServicesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewDedicatedCloudServicesClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewDedicatedCloudServicesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "<resource-group-name>", "<dedicated-cloud-service-name>", armvmwarecloudsimple.DedicatedCloudService{ - Location: to.StringPtr("<location>"), + Location: to.Ptr("<location>"), Properties: &armvmwarecloudsimple.DedicatedCloudServiceProperties{ - GatewaySubnet: to.StringPtr("<gateway-subnet>"), + GatewaySubnet: to.Ptr("<gateway-subnet>"), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.DedicatedCloudServicesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/DeleteDedicatedCloudService.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/DeleteDedicatedCloudService.json func ExampleDedicatedCloudServicesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewDedicatedCloudServicesClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewDedicatedCloudServicesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "<resource-group-name>", "<dedicated-cloud-service-name>", - nil) + &armvmwarecloudsimple.DedicatedCloudServicesClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/PatchDedicatedService.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/PatchDedicatedService.json func ExampleDedicatedCloudServicesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewDedicatedCloudServicesClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewDedicatedCloudServicesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "<resource-group-name>", "<dedicated-cloud-service-name>", armvmwarecloudsimple.PatchPayload{ Tags: map[string]*string{ - "myTag": to.StringPtr("tagValue"), + "myTag": to.Ptr("tagValue"), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.DedicatedCloudServicesClientUpdateResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_operations_client_test.go index c710e2035c02..4d5ab5f280ae 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_operations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,45 +16,55 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple" ) -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListOperations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListOperations.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewOperationsClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewOperationsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetFailedOperationResult.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetFailedOperationResult.json func ExampleOperationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewOperationsClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewOperationsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<region-id>", + "<referer>", "<operation-id>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.OperationsClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_privateclouds_client_test.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_privateclouds_client_test.go index 717917a438e5..64b02967870c 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_privateclouds_client_test.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_privateclouds_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,44 +16,55 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple" ) -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListPrivateCloudInLocation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListPrivateCloudInLocation.json func ExamplePrivateCloudsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewPrivateCloudsClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewPrivateCloudsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<region-id>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetPrivateCloud.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetPrivateCloud.json func ExamplePrivateCloudsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewPrivateCloudsClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewPrivateCloudsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<pc-name>", "<region-id>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateCloudsClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_resourcepools_client_test.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_resourcepools_client_test.go index 4c77989cb840..71309697aa04 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_resourcepools_client_test.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_resourcepools_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,46 +16,57 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple" ) -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListResourcePools.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListResourcePools.json func ExampleResourcePoolsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewResourcePoolsClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewResourcePoolsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<region-id>", "<pc-name>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetResourcePool.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetResourcePool.json func ExampleResourcePoolsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewResourcePoolsClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewResourcePoolsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<region-id>", "<pc-name>", "<resource-pool-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ResourcePoolsClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_skusavailability_client_test.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_skusavailability_client_test.go index 793ede74a3ee..213ecb40b5e3 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_skusavailability_client_test.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_skusavailability_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,26 +16,30 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple" ) -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListAvailabilities.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListAvailabilities.json func ExampleSKUsAvailabilityClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewSKUsAvailabilityClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewSKUsAvailabilityClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<region-id>", &armvmwarecloudsimple.SKUsAvailabilityClientListOptions{SKUID: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_usages_client_test.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_usages_client_test.go index 428a88e394b2..1b4c5e39b49c 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_usages_client_test.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_usages_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,26 +16,30 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple" ) -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListUsages.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListUsages.json func ExampleUsagesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewUsagesClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewUsagesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<region-id>", &armvmwarecloudsimple.UsagesClientListOptions{Filter: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_virtualmachines_client_test.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_virtualmachines_client_test.go index 6b5779780d4f..7c391f90f0a5 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_virtualmachines_client_test.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_virtualmachines_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,223 +19,272 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple" ) -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListVirtualMachines.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListVirtualMachines.json func ExampleVirtualMachinesClient_ListBySubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListBySubscription(&armvmwarecloudsimple.VirtualMachinesClientListBySubscriptionOptions{Filter: nil, Top: nil, SkipToken: nil, }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListRGVirtualMachines.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListRGVirtualMachines.json func ExampleVirtualMachinesClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByResourceGroup("<resource-group-name>", &armvmwarecloudsimple.VirtualMachinesClientListByResourceGroupOptions{Filter: nil, Top: nil, SkipToken: nil, }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetVirtualMachine.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetVirtualMachine.json func ExampleVirtualMachinesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<virtual-machine-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VirtualMachinesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/CreateVirtualMachine.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/CreateVirtualMachine.json func ExampleVirtualMachinesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "<resource-group-name>", + "<referer>", "<virtual-machine-name>", armvmwarecloudsimple.VirtualMachine{ - Location: to.StringPtr("<location>"), + Location: to.Ptr("<location>"), Properties: &armvmwarecloudsimple.VirtualMachineProperties{ - AmountOfRAM: to.Int32Ptr(4096), + AmountOfRAM: to.Ptr[int32](4096), Disks: []*armvmwarecloudsimple.VirtualDisk{ { - ControllerID: to.StringPtr("<controller-id>"), - IndependenceMode: armvmwarecloudsimple.DiskIndependenceModePersistent.ToPtr(), - TotalSize: to.Int32Ptr(10485760), - VirtualDiskID: to.StringPtr("<virtual-disk-id>"), + ControllerID: to.Ptr("<controller-id>"), + IndependenceMode: to.Ptr(armvmwarecloudsimple.DiskIndependenceModePersistent), + TotalSize: to.Ptr[int32](10485760), + VirtualDiskID: to.Ptr("<virtual-disk-id>"), }}, Nics: []*armvmwarecloudsimple.VirtualNic{ { Network: &armvmwarecloudsimple.VirtualNetwork{ - ID: to.StringPtr("<id>"), + ID: to.Ptr("<id>"), }, - NicType: armvmwarecloudsimple.NICTypeE1000.ToPtr(), - PowerOnBoot: to.BoolPtr(true), - VirtualNicID: to.StringPtr("<virtual-nic-id>"), + NicType: to.Ptr(armvmwarecloudsimple.NICTypeE1000), + PowerOnBoot: to.Ptr(true), + VirtualNicID: to.Ptr("<virtual-nic-id>"), }}, - NumberOfCores: to.Int32Ptr(2), - PrivateCloudID: to.StringPtr("<private-cloud-id>"), + NumberOfCores: to.Ptr[int32](2), + PrivateCloudID: to.Ptr("<private-cloud-id>"), ResourcePool: &armvmwarecloudsimple.ResourcePool{ - ID: to.StringPtr("<id>"), + ID: to.Ptr("<id>"), }, - TemplateID: to.StringPtr("<template-id>"), + TemplateID: to.Ptr("<template-id>"), }, }, - nil) + &armvmwarecloudsimple.VirtualMachinesClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.VirtualMachinesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/DeleteVirtualMachine.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/DeleteVirtualMachine.json func ExampleVirtualMachinesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "<resource-group-name>", + "<referer>", "<virtual-machine-name>", - nil) + &armvmwarecloudsimple.VirtualMachinesClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/PatchVirtualMachine.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/PatchVirtualMachine.json func ExampleVirtualMachinesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginUpdate(ctx, "<resource-group-name>", "<virtual-machine-name>", armvmwarecloudsimple.PatchPayload{ Tags: map[string]*string{ - "myTag": to.StringPtr("tagValue"), + "myTag": to.Ptr("tagValue"), }, }, - nil) + &armvmwarecloudsimple.VirtualMachinesClientBeginUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.VirtualMachinesClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/StartVirtualMachine.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/StartVirtualMachine.json func ExampleVirtualMachinesClient_BeginStart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginStart(ctx, "<resource-group-name>", + "<referer>", "<virtual-machine-name>", - nil) + &armvmwarecloudsimple.VirtualMachinesClientBeginStartOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/StopInBodyVirtualMachine.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/StopInBodyVirtualMachine.json func ExampleVirtualMachinesClient_BeginStop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", - "<referer>", cred, nil) + client, err := armvmwarecloudsimple.NewVirtualMachinesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginStop(ctx, "<resource-group-name>", + "<referer>", "<virtual-machine-name>", &armvmwarecloudsimple.VirtualMachinesClientBeginStopOptions{Mode: nil, - M: &armvmwarecloudsimple.VirtualMachineStopMode{}, + M: &armvmwarecloudsimple.VirtualMachineStopMode{}, + ResumeToken: "", }) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_virtualmachinetemplates_client_test.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_virtualmachinetemplates_client_test.go index 7028d13450b3..2933c5fa34fc 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_virtualmachinetemplates_client_test.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_virtualmachinetemplates_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,47 +16,58 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple" ) -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListVirtualMachineTemplates.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListVirtualMachineTemplates.json func ExampleVirtualMachineTemplatesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewVirtualMachineTemplatesClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewVirtualMachineTemplatesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<pc-name>", "<region-id>", "<resource-pool-name>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetVirtualMachineTemplate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetVirtualMachineTemplate.json func ExampleVirtualMachineTemplatesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewVirtualMachineTemplatesClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewVirtualMachineTemplatesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<region-id>", "<pc-name>", "<virtual-machine-template-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VirtualMachineTemplatesClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_virtualnetworks_client_test.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_virtualnetworks_client_test.go index 1014e124b4e9..91d58d466105 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_virtualnetworks_client_test.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/ze_generated_example_virtualnetworks_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,47 +16,58 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple" ) -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListVirtualNetworks.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListVirtualNetworks.json func ExampleVirtualNetworksClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewVirtualNetworksClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewVirtualNetworksClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<region-id>", "<pc-name>", "<resource-pool-name>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetVirtualNetwork.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetVirtualNetwork.json func ExampleVirtualNetworksClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armvmwarecloudsimple.NewVirtualNetworksClient("<subscription-id>", cred, nil) + client, err := armvmwarecloudsimple.NewVirtualNetworksClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<region-id>", "<pc-name>", "<virtual-network-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.VirtualNetworksClientGetResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_constants.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_constants.go index 0015de165678..6748098c476e 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_constants.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armvmwarecloudsimple const ( moduleName = "armvmwarecloudsimple" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // AggregationType - Metric's aggregation type for e.g. (Average, Total) @@ -29,11 +29,6 @@ func PossibleAggregationTypeValues() []AggregationType { } } -// ToPtr returns a *AggregationType pointing to the current value. -func (c AggregationType) ToPtr() *AggregationType { - return &c -} - // CustomizationHostNameType - Type of host name type CustomizationHostNameType string @@ -56,11 +51,6 @@ func PossibleCustomizationHostNameTypeValues() []CustomizationHostNameType { } } -// ToPtr returns a *CustomizationHostNameType pointing to the current value. -func (c CustomizationHostNameType) ToPtr() *CustomizationHostNameType { - return &c -} - // CustomizationIPAddressType - Customization Specification ip type type CustomizationIPAddressType string @@ -81,11 +71,6 @@ func PossibleCustomizationIPAddressTypeValues() []CustomizationIPAddressType { } } -// ToPtr returns a *CustomizationIPAddressType pointing to the current value. -func (c CustomizationIPAddressType) ToPtr() *CustomizationIPAddressType { - return &c -} - // CustomizationIdentityType - Identity type type CustomizationIdentityType string @@ -104,11 +89,6 @@ func PossibleCustomizationIdentityTypeValues() []CustomizationIdentityType { } } -// ToPtr returns a *CustomizationIdentityType pointing to the current value. -func (c CustomizationIdentityType) ToPtr() *CustomizationIdentityType { - return &c -} - // CustomizationPolicyPropertiesType - The type of customization (Linux or Windows) type CustomizationPolicyPropertiesType string @@ -125,11 +105,6 @@ func PossibleCustomizationPolicyPropertiesTypeValues() []CustomizationPolicyProp } } -// ToPtr returns a *CustomizationPolicyPropertiesType pointing to the current value. -func (c CustomizationPolicyPropertiesType) ToPtr() *CustomizationPolicyPropertiesType { - return &c -} - // DiskIndependenceMode - Disk's independence mode type type DiskIndependenceMode string @@ -148,11 +123,6 @@ func PossibleDiskIndependenceModeValues() []DiskIndependenceMode { } } -// ToPtr returns a *DiskIndependenceMode pointing to the current value. -func (c DiskIndependenceMode) ToPtr() *DiskIndependenceMode { - return &c -} - // GuestOSNICCustomizationAllocation - IP address allocation method type GuestOSNICCustomizationAllocation string @@ -169,11 +139,6 @@ func PossibleGuestOSNICCustomizationAllocationValues() []GuestOSNICCustomization } } -// ToPtr returns a *GuestOSNICCustomizationAllocation pointing to the current value. -func (c GuestOSNICCustomizationAllocation) ToPtr() *GuestOSNICCustomizationAllocation { - return &c -} - // GuestOSType - The Guest OS type type GuestOSType string @@ -192,11 +157,6 @@ func PossibleGuestOSTypeValues() []GuestOSType { } } -// ToPtr returns a *GuestOSType pointing to the current value. -func (c GuestOSType) ToPtr() *GuestOSType { - return &c -} - // NICType - NIC type type NICType string @@ -221,11 +181,6 @@ func PossibleNICTypeValues() []NICType { } } -// ToPtr returns a *NICType pointing to the current value. -func (c NICType) ToPtr() *NICType { - return &c -} - // NodeStatus - Node status, indicates is private cloud set up on this node or not type NodeStatus string @@ -242,11 +197,6 @@ func PossibleNodeStatusValues() []NodeStatus { } } -// ToPtr returns a *NodeStatus pointing to the current value. -func (c NodeStatus) ToPtr() *NodeStatus { - return &c -} - // OnboardingStatus - indicates whether account onboarded or not in a given region type OnboardingStatus string @@ -267,11 +217,6 @@ func PossibleOnboardingStatusValues() []OnboardingStatus { } } -// ToPtr returns a *OnboardingStatus pointing to the current value. -func (c OnboardingStatus) ToPtr() *OnboardingStatus { - return &c -} - // OperationOrigin - The origin of operation type OperationOrigin string @@ -290,11 +235,6 @@ func PossibleOperationOriginValues() []OperationOrigin { } } -// ToPtr returns a *OperationOrigin pointing to the current value. -func (c OperationOrigin) ToPtr() *OperationOrigin { - return &c -} - // StopMode - mode indicates a type of stop operation - reboot, suspend, shutdown or power-off type StopMode string @@ -315,11 +255,6 @@ func PossibleStopModeValues() []StopMode { } } -// ToPtr returns a *StopMode pointing to the current value. -func (c StopMode) ToPtr() *StopMode { - return &c -} - // UsageCount - The usages' unit type UsageCount string @@ -344,11 +279,6 @@ func PossibleUsageCountValues() []UsageCount { } } -// ToPtr returns a *UsageCount pointing to the current value. -func (c UsageCount) ToPtr() *UsageCount { - return &c -} - // VirtualMachineStatus - The status of Virtual machine type VirtualMachineStatus string @@ -372,8 +302,3 @@ func PossibleVirtualMachineStatusValues() []VirtualMachineStatus { VirtualMachineStatusDeleting, } } - -// ToPtr returns a *VirtualMachineStatus pointing to the current value. -func (c VirtualMachineStatus) ToPtr() *VirtualMachineStatus { - return &c -} diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_customizationpolicies_client.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_customizationpolicies_client.go index de25c432392f..0acb5c27563c 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_customizationpolicies_client.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_customizationpolicies_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type CustomizationPoliciesClient struct { // subscriptionID - The subscription ID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewCustomizationPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CustomizationPoliciesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewCustomizationPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomizationPoliciesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &CustomizationPoliciesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Returns customization policy by its name @@ -103,7 +108,7 @@ func (client *CustomizationPoliciesClient) getCreateRequest(ctx context.Context, // getHandleResponse handles the Get response. func (client *CustomizationPoliciesClient) getHandleResponse(resp *http.Response) (CustomizationPoliciesClientGetResponse, error) { - result := CustomizationPoliciesClientGetResponse{RawResponse: resp} + result := CustomizationPoliciesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.CustomizationPolicy); err != nil { return CustomizationPoliciesClientGetResponse{}, err } @@ -116,16 +121,32 @@ func (client *CustomizationPoliciesClient) getHandleResponse(resp *http.Response // pcName - The private cloud name // options - CustomizationPoliciesClientListOptions contains the optional parameters for the CustomizationPoliciesClient.List // method. -func (client *CustomizationPoliciesClient) List(regionID string, pcName string, options *CustomizationPoliciesClientListOptions) *CustomizationPoliciesClientListPager { - return &CustomizationPoliciesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, regionID, pcName, options) +func (client *CustomizationPoliciesClient) List(regionID string, pcName string, options *CustomizationPoliciesClientListOptions) *runtime.Pager[CustomizationPoliciesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[CustomizationPoliciesClientListResponse]{ + More: func(page CustomizationPoliciesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp CustomizationPoliciesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.CustomizationPoliciesListResponse.NextLink) + Fetcher: func(ctx context.Context, page *CustomizationPoliciesClientListResponse) (CustomizationPoliciesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, regionID, pcName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CustomizationPoliciesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CustomizationPoliciesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CustomizationPoliciesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -159,7 +180,7 @@ func (client *CustomizationPoliciesClient) listCreateRequest(ctx context.Context // listHandleResponse handles the List response. func (client *CustomizationPoliciesClient) listHandleResponse(resp *http.Response) (CustomizationPoliciesClientListResponse, error) { - result := CustomizationPoliciesClientListResponse{RawResponse: resp} + result := CustomizationPoliciesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.CustomizationPoliciesListResponse); err != nil { return CustomizationPoliciesClientListResponse{}, err } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_dedicatedcloudnodes_client.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_dedicatedcloudnodes_client.go index d7dc67ccc4f3..c64a6f7378e3 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_dedicatedcloudnodes_client.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_dedicatedcloudnodes_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,61 +28,57 @@ import ( type DedicatedCloudNodesClient struct { host string subscriptionID string - referer string pl runtime.Pipeline } // NewDedicatedCloudNodesClient creates a new instance of DedicatedCloudNodesClient with the specified values. // subscriptionID - The subscription ID. -// referer - referer url // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewDedicatedCloudNodesClient(subscriptionID string, referer string, credential azcore.TokenCredential, options *arm.ClientOptions) *DedicatedCloudNodesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewDedicatedCloudNodesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DedicatedCloudNodesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &DedicatedCloudNodesClient{ subscriptionID: subscriptionID, - referer: referer, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Returns dedicated cloud node by its name // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group +// referer - referer url // dedicatedCloudNodeName - dedicated cloud node name // dedicatedCloudNodeRequest - Create Dedicated Cloud Node request // options - DedicatedCloudNodesClientBeginCreateOrUpdateOptions contains the optional parameters for the DedicatedCloudNodesClient.BeginCreateOrUpdate // method. -func (client *DedicatedCloudNodesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest DedicatedCloudNode, options *DedicatedCloudNodesClientBeginCreateOrUpdateOptions) (DedicatedCloudNodesClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, dedicatedCloudNodeName, dedicatedCloudNodeRequest, options) - if err != nil { - return DedicatedCloudNodesClientCreateOrUpdatePollerResponse{}, err - } - result := DedicatedCloudNodesClientCreateOrUpdatePollerResponse{ - RawResponse: resp, +func (client *DedicatedCloudNodesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, referer string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest DedicatedCloudNode, options *DedicatedCloudNodesClientBeginCreateOrUpdateOptions) (*armruntime.Poller[DedicatedCloudNodesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, referer, dedicatedCloudNodeName, dedicatedCloudNodeRequest, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[DedicatedCloudNodesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[DedicatedCloudNodesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("DedicatedCloudNodesClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return DedicatedCloudNodesClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &DedicatedCloudNodesClientCreateOrUpdatePoller{ - pt: pt, - } - return result, nil } // CreateOrUpdate - Returns dedicated cloud node by its name // If the operation fails it returns an *azcore.ResponseError type. -func (client *DedicatedCloudNodesClient) createOrUpdate(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest DedicatedCloudNode, options *DedicatedCloudNodesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, dedicatedCloudNodeName, dedicatedCloudNodeRequest, options) +func (client *DedicatedCloudNodesClient) createOrUpdate(ctx context.Context, resourceGroupName string, referer string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest DedicatedCloudNode, options *DedicatedCloudNodesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, referer, dedicatedCloudNodeName, dedicatedCloudNodeRequest, options) if err != nil { return nil, err } @@ -96,7 +93,7 @@ func (client *DedicatedCloudNodesClient) createOrUpdate(ctx context.Context, res } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DedicatedCloudNodesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest DedicatedCloudNode, options *DedicatedCloudNodesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DedicatedCloudNodesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, referer string, dedicatedCloudNodeName string, dedicatedCloudNodeRequest DedicatedCloudNode, options *DedicatedCloudNodesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/dedicatedCloudNodes/{dedicatedCloudNodeName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -117,7 +114,7 @@ func (client *DedicatedCloudNodesClient) createOrUpdateCreateRequest(ctx context reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-04-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Referer", client.referer) + req.Raw().Header.Set("Referer", referer) req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, dedicatedCloudNodeRequest) } @@ -140,7 +137,7 @@ func (client *DedicatedCloudNodesClient) Delete(ctx context.Context, resourceGro if !runtime.HasStatusCode(resp, http.StatusNoContent) { return DedicatedCloudNodesClientDeleteResponse{}, runtime.NewResponseError(resp) } - return DedicatedCloudNodesClientDeleteResponse{RawResponse: resp}, nil + return DedicatedCloudNodesClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -217,7 +214,7 @@ func (client *DedicatedCloudNodesClient) getCreateRequest(ctx context.Context, r // getHandleResponse handles the Get response. func (client *DedicatedCloudNodesClient) getHandleResponse(resp *http.Response) (DedicatedCloudNodesClientGetResponse, error) { - result := DedicatedCloudNodesClientGetResponse{RawResponse: resp} + result := DedicatedCloudNodesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedCloudNode); err != nil { return DedicatedCloudNodesClientGetResponse{}, err } @@ -229,16 +226,32 @@ func (client *DedicatedCloudNodesClient) getHandleResponse(resp *http.Response) // resourceGroupName - The name of the resource group // options - DedicatedCloudNodesClientListByResourceGroupOptions contains the optional parameters for the DedicatedCloudNodesClient.ListByResourceGroup // method. -func (client *DedicatedCloudNodesClient) ListByResourceGroup(resourceGroupName string, options *DedicatedCloudNodesClientListByResourceGroupOptions) *DedicatedCloudNodesClientListByResourceGroupPager { - return &DedicatedCloudNodesClientListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) +func (client *DedicatedCloudNodesClient) ListByResourceGroup(resourceGroupName string, options *DedicatedCloudNodesClientListByResourceGroupOptions) *runtime.Pager[DedicatedCloudNodesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[DedicatedCloudNodesClientListByResourceGroupResponse]{ + More: func(page DedicatedCloudNodesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp DedicatedCloudNodesClientListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DedicatedCloudNodeListResponse.NextLink) + Fetcher: func(ctx context.Context, page *DedicatedCloudNodesClientListByResourceGroupResponse) (DedicatedCloudNodesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DedicatedCloudNodesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DedicatedCloudNodesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedCloudNodesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) }, - } + }) } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. @@ -274,7 +287,7 @@ func (client *DedicatedCloudNodesClient) listByResourceGroupCreateRequest(ctx co // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *DedicatedCloudNodesClient) listByResourceGroupHandleResponse(resp *http.Response) (DedicatedCloudNodesClientListByResourceGroupResponse, error) { - result := DedicatedCloudNodesClientListByResourceGroupResponse{RawResponse: resp} + result := DedicatedCloudNodesClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedCloudNodeListResponse); err != nil { return DedicatedCloudNodesClientListByResourceGroupResponse{}, err } @@ -285,16 +298,32 @@ func (client *DedicatedCloudNodesClient) listByResourceGroupHandleResponse(resp // If the operation fails it returns an *azcore.ResponseError type. // options - DedicatedCloudNodesClientListBySubscriptionOptions contains the optional parameters for the DedicatedCloudNodesClient.ListBySubscription // method. -func (client *DedicatedCloudNodesClient) ListBySubscription(options *DedicatedCloudNodesClientListBySubscriptionOptions) *DedicatedCloudNodesClientListBySubscriptionPager { - return &DedicatedCloudNodesClientListBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) +func (client *DedicatedCloudNodesClient) ListBySubscription(options *DedicatedCloudNodesClientListBySubscriptionOptions) *runtime.Pager[DedicatedCloudNodesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[DedicatedCloudNodesClientListBySubscriptionResponse]{ + More: func(page DedicatedCloudNodesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp DedicatedCloudNodesClientListBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DedicatedCloudNodeListResponse.NextLink) + Fetcher: func(ctx context.Context, page *DedicatedCloudNodesClientListBySubscriptionResponse) (DedicatedCloudNodesClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DedicatedCloudNodesClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DedicatedCloudNodesClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedCloudNodesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) }, - } + }) } // listBySubscriptionCreateRequest creates the ListBySubscription request. @@ -326,7 +355,7 @@ func (client *DedicatedCloudNodesClient) listBySubscriptionCreateRequest(ctx con // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *DedicatedCloudNodesClient) listBySubscriptionHandleResponse(resp *http.Response) (DedicatedCloudNodesClientListBySubscriptionResponse, error) { - result := DedicatedCloudNodesClientListBySubscriptionResponse{RawResponse: resp} + result := DedicatedCloudNodesClientListBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedCloudNodeListResponse); err != nil { return DedicatedCloudNodesClientListBySubscriptionResponse{}, err } @@ -383,7 +412,7 @@ func (client *DedicatedCloudNodesClient) updateCreateRequest(ctx context.Context // updateHandleResponse handles the Update response. func (client *DedicatedCloudNodesClient) updateHandleResponse(resp *http.Response) (DedicatedCloudNodesClientUpdateResponse, error) { - result := DedicatedCloudNodesClientUpdateResponse{RawResponse: resp} + result := DedicatedCloudNodesClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedCloudNode); err != nil { return DedicatedCloudNodesClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_dedicatedcloudservices_client.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_dedicatedcloudservices_client.go index 95a52e4474b9..211346fd8e3a 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_dedicatedcloudservices_client.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_dedicatedcloudservices_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type DedicatedCloudServicesClient struct { // subscriptionID - The subscription ID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewDedicatedCloudServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DedicatedCloudServicesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewDedicatedCloudServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DedicatedCloudServicesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &DedicatedCloudServicesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Create dedicate cloud service @@ -100,7 +105,7 @@ func (client *DedicatedCloudServicesClient) createOrUpdateCreateRequest(ctx cont // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *DedicatedCloudServicesClient) createOrUpdateHandleResponse(resp *http.Response) (DedicatedCloudServicesClientCreateOrUpdateResponse, error) { - result := DedicatedCloudServicesClientCreateOrUpdateResponse{RawResponse: resp} + result := DedicatedCloudServicesClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedCloudService); err != nil { return DedicatedCloudServicesClientCreateOrUpdateResponse{}, err } @@ -113,22 +118,16 @@ func (client *DedicatedCloudServicesClient) createOrUpdateHandleResponse(resp *h // dedicatedCloudServiceName - dedicated cloud service name // options - DedicatedCloudServicesClientBeginDeleteOptions contains the optional parameters for the DedicatedCloudServicesClient.BeginDelete // method. -func (client *DedicatedCloudServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string, options *DedicatedCloudServicesClientBeginDeleteOptions) (DedicatedCloudServicesClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, dedicatedCloudServiceName, options) - if err != nil { - return DedicatedCloudServicesClientDeletePollerResponse{}, err - } - result := DedicatedCloudServicesClientDeletePollerResponse{ - RawResponse: resp, +func (client *DedicatedCloudServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, dedicatedCloudServiceName string, options *DedicatedCloudServicesClientBeginDeleteOptions) (*armruntime.Poller[DedicatedCloudServicesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, dedicatedCloudServiceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[DedicatedCloudServicesClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[DedicatedCloudServicesClientDeleteResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("DedicatedCloudServicesClient.Delete", "", resp, client.pl) - if err != nil { - return DedicatedCloudServicesClientDeletePollerResponse{}, err - } - result.Poller = &DedicatedCloudServicesClientDeletePoller{ - pt: pt, - } - return result, nil } // Delete - Delete dedicate cloud service @@ -223,7 +222,7 @@ func (client *DedicatedCloudServicesClient) getCreateRequest(ctx context.Context // getHandleResponse handles the Get response. func (client *DedicatedCloudServicesClient) getHandleResponse(resp *http.Response) (DedicatedCloudServicesClientGetResponse, error) { - result := DedicatedCloudServicesClientGetResponse{RawResponse: resp} + result := DedicatedCloudServicesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedCloudService); err != nil { return DedicatedCloudServicesClientGetResponse{}, err } @@ -235,16 +234,32 @@ func (client *DedicatedCloudServicesClient) getHandleResponse(resp *http.Respons // resourceGroupName - The name of the resource group // options - DedicatedCloudServicesClientListByResourceGroupOptions contains the optional parameters for the DedicatedCloudServicesClient.ListByResourceGroup // method. -func (client *DedicatedCloudServicesClient) ListByResourceGroup(resourceGroupName string, options *DedicatedCloudServicesClientListByResourceGroupOptions) *DedicatedCloudServicesClientListByResourceGroupPager { - return &DedicatedCloudServicesClientListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) +func (client *DedicatedCloudServicesClient) ListByResourceGroup(resourceGroupName string, options *DedicatedCloudServicesClientListByResourceGroupOptions) *runtime.Pager[DedicatedCloudServicesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[DedicatedCloudServicesClientListByResourceGroupResponse]{ + More: func(page DedicatedCloudServicesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp DedicatedCloudServicesClientListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DedicatedCloudServiceListResponse.NextLink) + Fetcher: func(ctx context.Context, page *DedicatedCloudServicesClientListByResourceGroupResponse) (DedicatedCloudServicesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DedicatedCloudServicesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DedicatedCloudServicesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedCloudServicesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) }, - } + }) } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. @@ -280,7 +295,7 @@ func (client *DedicatedCloudServicesClient) listByResourceGroupCreateRequest(ctx // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *DedicatedCloudServicesClient) listByResourceGroupHandleResponse(resp *http.Response) (DedicatedCloudServicesClientListByResourceGroupResponse, error) { - result := DedicatedCloudServicesClientListByResourceGroupResponse{RawResponse: resp} + result := DedicatedCloudServicesClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedCloudServiceListResponse); err != nil { return DedicatedCloudServicesClientListByResourceGroupResponse{}, err } @@ -291,16 +306,32 @@ func (client *DedicatedCloudServicesClient) listByResourceGroupHandleResponse(re // If the operation fails it returns an *azcore.ResponseError type. // options - DedicatedCloudServicesClientListBySubscriptionOptions contains the optional parameters for the DedicatedCloudServicesClient.ListBySubscription // method. -func (client *DedicatedCloudServicesClient) ListBySubscription(options *DedicatedCloudServicesClientListBySubscriptionOptions) *DedicatedCloudServicesClientListBySubscriptionPager { - return &DedicatedCloudServicesClientListBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) +func (client *DedicatedCloudServicesClient) ListBySubscription(options *DedicatedCloudServicesClientListBySubscriptionOptions) *runtime.Pager[DedicatedCloudServicesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[DedicatedCloudServicesClientListBySubscriptionResponse]{ + More: func(page DedicatedCloudServicesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp DedicatedCloudServicesClientListBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DedicatedCloudServiceListResponse.NextLink) + Fetcher: func(ctx context.Context, page *DedicatedCloudServicesClientListBySubscriptionResponse) (DedicatedCloudServicesClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DedicatedCloudServicesClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DedicatedCloudServicesClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedCloudServicesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) }, - } + }) } // listBySubscriptionCreateRequest creates the ListBySubscription request. @@ -332,7 +363,7 @@ func (client *DedicatedCloudServicesClient) listBySubscriptionCreateRequest(ctx // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *DedicatedCloudServicesClient) listBySubscriptionHandleResponse(resp *http.Response) (DedicatedCloudServicesClientListBySubscriptionResponse, error) { - result := DedicatedCloudServicesClientListBySubscriptionResponse{RawResponse: resp} + result := DedicatedCloudServicesClientListBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedCloudServiceListResponse); err != nil { return DedicatedCloudServicesClientListBySubscriptionResponse{}, err } @@ -389,7 +420,7 @@ func (client *DedicatedCloudServicesClient) updateCreateRequest(ctx context.Cont // updateHandleResponse handles the Update response. func (client *DedicatedCloudServicesClient) updateHandleResponse(resp *http.Response) (DedicatedCloudServicesClientUpdateResponse, error) { - result := DedicatedCloudServicesClientUpdateResponse{RawResponse: resp} + result := DedicatedCloudServicesClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedCloudService); err != nil { return DedicatedCloudServicesClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_models.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_models.go index bcaa4d4d2b0d..3688dce7788c 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_models.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armvmwarecloudsimple -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // AvailableOperation - Resource provider available operation model type AvailableOperation struct { @@ -80,13 +75,6 @@ type AvailableOperationDisplayPropertyServiceSpecificationMetricsList struct { MetricSpecifications []*AvailableOperationDisplayPropertyServiceSpecificationMetricsItem `json:"metricSpecifications,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AvailableOperationDisplayPropertyServiceSpecificationMetricsList. -func (a AvailableOperationDisplayPropertyServiceSpecificationMetricsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "metricSpecifications", a.MetricSpecifications) - return json.Marshal(objectMap) -} - // AvailableOperationsListResponse - List of available operations type AvailableOperationsListResponse struct { // Link for next list of available operations @@ -96,14 +84,6 @@ type AvailableOperationsListResponse struct { Value []*AvailableOperation `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AvailableOperationsListResponse. -func (a AvailableOperationsListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - // CSRPError - General error model type CSRPError struct { // Error's body @@ -125,16 +105,6 @@ type CSRPErrorBody struct { Message *string `json:"message,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type CSRPErrorBody. -func (c CSRPErrorBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", c.Code) - populate(objectMap, "details", c.Details) - populate(objectMap, "message", c.Message) - populate(objectMap, "target", c.Target) - return json.Marshal(objectMap) -} - // CustomizationHostName - Host name model type CustomizationHostName struct { // Hostname @@ -166,15 +136,6 @@ type CustomizationIPSettings struct { SubnetMask *string `json:"subnetMask,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CustomizationIPSettings. -func (c CustomizationIPSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "gateway", c.Gateway) - populate(objectMap, "ip", c.IP) - populate(objectMap, "subnetMask", c.SubnetMask) - return json.Marshal(objectMap) -} - type CustomizationIdentity struct { // Windows Text Identity. Prepared data Data *string `json:"data,omitempty"` @@ -223,14 +184,6 @@ type CustomizationPoliciesListResponse struct { Value []*CustomizationPolicy `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CustomizationPoliciesListResponse. -func (c CustomizationPoliciesListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - // CustomizationPolicy - The virtual machine customization policy type CustomizationPolicy struct { // Customization policy azure id @@ -276,14 +229,6 @@ type CustomizationSpecification struct { NicSettings []*CustomizationNicSetting `json:"nicSettings,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type CustomizationSpecification. -func (c CustomizationSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", c.Identity) - populate(objectMap, "nicSettings", c.NicSettings) - return json.Marshal(objectMap) -} - // DedicatedCloudNode - Dedicated cloud node model type DedicatedCloudNode struct { // REQUIRED; Azure region @@ -308,19 +253,6 @@ type DedicatedCloudNode struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type DedicatedCloudNode. -func (d DedicatedCloudNode) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", d.ID) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "sku", d.SKU) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - // DedicatedCloudNodeListResponse - List of dedicated nodes response model type DedicatedCloudNodeListResponse struct { // Link for next list of DedicatedCloudNode @@ -330,14 +262,6 @@ type DedicatedCloudNodeListResponse struct { Value []*DedicatedCloudNode `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type DedicatedCloudNodeListResponse. -func (d DedicatedCloudNodeListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - // DedicatedCloudNodeProperties - Properties of dedicated cloud node type DedicatedCloudNodeProperties struct { // REQUIRED; Availability Zone id, e.g. "az1" @@ -383,89 +307,11 @@ type DedicatedCloudNodeProperties struct { VmwareClusterName *string `json:"vmwareClusterName,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type DedicatedCloudNodeProperties. -func (d DedicatedCloudNodeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "availabilityZoneId", d.AvailabilityZoneID) - populate(objectMap, "availabilityZoneName", d.AvailabilityZoneName) - populate(objectMap, "cloudRackName", d.CloudRackName) - populateTimeRFC3339(objectMap, "created", d.Created) - populate(objectMap, "nodesCount", d.NodesCount) - populate(objectMap, "placementGroupId", d.PlacementGroupID) - populate(objectMap, "placementGroupName", d.PlacementGroupName) - populate(objectMap, "privateCloudId", d.PrivateCloudID) - populate(objectMap, "privateCloudName", d.PrivateCloudName) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "purchaseId", d.PurchaseID) - populate(objectMap, "skuDescription", d.SKUDescription) - populate(objectMap, "status", d.Status) - populate(objectMap, "vmwareClusterName", d.VmwareClusterName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedCloudNodeProperties. -func (d *DedicatedCloudNodeProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "availabilityZoneId": - err = unpopulate(val, &d.AvailabilityZoneID) - delete(rawMsg, key) - case "availabilityZoneName": - err = unpopulate(val, &d.AvailabilityZoneName) - delete(rawMsg, key) - case "cloudRackName": - err = unpopulate(val, &d.CloudRackName) - delete(rawMsg, key) - case "created": - err = unpopulateTimeRFC3339(val, &d.Created) - delete(rawMsg, key) - case "nodesCount": - err = unpopulate(val, &d.NodesCount) - delete(rawMsg, key) - case "placementGroupId": - err = unpopulate(val, &d.PlacementGroupID) - delete(rawMsg, key) - case "placementGroupName": - err = unpopulate(val, &d.PlacementGroupName) - delete(rawMsg, key) - case "privateCloudId": - err = unpopulate(val, &d.PrivateCloudID) - delete(rawMsg, key) - case "privateCloudName": - err = unpopulate(val, &d.PrivateCloudName) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &d.ProvisioningState) - delete(rawMsg, key) - case "purchaseId": - err = unpopulate(val, &d.PurchaseID) - delete(rawMsg, key) - case "skuDescription": - err = unpopulate(val, &d.SKUDescription) - delete(rawMsg, key) - case "status": - err = unpopulate(val, &d.Status) - delete(rawMsg, key) - case "vmwareClusterName": - err = unpopulate(val, &d.VmwareClusterName) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // DedicatedCloudNodesClientBeginCreateOrUpdateOptions contains the optional parameters for the DedicatedCloudNodesClient.BeginCreateOrUpdate // method. type DedicatedCloudNodesClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // DedicatedCloudNodesClientDeleteOptions contains the optional parameters for the DedicatedCloudNodesClient.Delete method. @@ -526,18 +372,6 @@ type DedicatedCloudService struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type DedicatedCloudService. -func (d DedicatedCloudService) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", d.ID) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - // DedicatedCloudServiceListResponse - List of dedicated cloud services type DedicatedCloudServiceListResponse struct { // Link for next list of DedicatedCloudNode @@ -547,14 +381,6 @@ type DedicatedCloudServiceListResponse struct { Value []*DedicatedCloudService `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type DedicatedCloudServiceListResponse. -func (d DedicatedCloudServiceListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - // DedicatedCloudServiceProperties - Properties of dedicated cloud service type DedicatedCloudServiceProperties struct { // REQUIRED; gateway Subnet for the account. It will collect the subnet address and always treat it as /28 @@ -573,7 +399,8 @@ type DedicatedCloudServiceProperties struct { // DedicatedCloudServicesClientBeginDeleteOptions contains the optional parameters for the DedicatedCloudServicesClient.BeginDelete // method. type DedicatedCloudServicesClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // DedicatedCloudServicesClientCreateOrUpdateOptions contains the optional parameters for the DedicatedCloudServicesClient.CreateOrUpdate @@ -633,17 +460,6 @@ type GuestOSCustomization struct { Username *string `json:"username,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type GuestOSCustomization. -func (g GuestOSCustomization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dnsServers", g.DNSServers) - populate(objectMap, "hostName", g.HostName) - populate(objectMap, "password", g.Password) - populate(objectMap, "policyId", g.PolicyID) - populate(objectMap, "username", g.Username) - return json.Marshal(objectMap) -} - // GuestOSNICCustomization - Guest OS nic customization type GuestOSNICCustomization struct { // IP address allocation method @@ -668,19 +484,6 @@ type GuestOSNICCustomization struct { SecondaryWinsServer *string `json:"secondaryWinsServer,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type GuestOSNICCustomization. -func (g GuestOSNICCustomization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allocation", g.Allocation) - populate(objectMap, "dnsServers", g.DNSServers) - populate(objectMap, "gateway", g.Gateway) - populate(objectMap, "ipAddress", g.IPAddress) - populate(objectMap, "mask", g.Mask) - populate(objectMap, "primaryWinsServer", g.PrimaryWinsServer) - populate(objectMap, "secondaryWinsServer", g.SecondaryWinsServer) - return json.Marshal(objectMap) -} - // OperationError - Operation error model type OperationError struct { // Error's code @@ -711,53 +514,6 @@ type OperationResource struct { Status *string `json:"status,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type OperationResource. -func (o OperationResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "endTime", o.EndTime) - populate(objectMap, "error", o.Error) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) - populateTimeRFC3339(objectMap, "startTime", o.StartTime) - populate(objectMap, "status", o.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResource. -func (o *OperationResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateTimeRFC3339(val, &o.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, &o.Error) - delete(rawMsg, key) - case "id": - err = unpopulate(val, &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &o.Name) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &o.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, &o.Status) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // OperationsClientGetOptions contains the optional parameters for the OperationsClient.Get method. type OperationsClientGetOptions struct { // placeholder for future optional parameters @@ -774,13 +530,6 @@ type PatchPayload struct { Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PatchPayload. -func (p PatchPayload) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", p.Tags) - return json.Marshal(objectMap) -} - // PrivateCloud - Private cloud model type PrivateCloud struct { // Azure Id, e.g. "/subscriptions/4da99247-a172-4ed6-8ae9-ebed2d12f839/providers/Microsoft.VMwareCloudSimple/privateClouds/cloud123" @@ -808,14 +557,6 @@ type PrivateCloudList struct { Value []*PrivateCloud `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateCloudList. -func (p PrivateCloudList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PrivateCloudProperties - Properties of private type PrivateCloudProperties struct { // Availability Zone id, e.g. "az1" @@ -891,125 +632,6 @@ type PrivateCloudProperties struct { VrOpsEnabled *bool `json:"vrOpsEnabled,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateCloudProperties. -func (p PrivateCloudProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "availabilityZoneId", p.AvailabilityZoneID) - populate(objectMap, "availabilityZoneName", p.AvailabilityZoneName) - populate(objectMap, "clustersNumber", p.ClustersNumber) - populate(objectMap, "createdBy", p.CreatedBy) - populateTimeRFC3339(objectMap, "createdOn", p.CreatedOn) - populate(objectMap, "dnsServers", p.DNSServers) - populate(objectMap, "expires", p.Expires) - populate(objectMap, "nsxType", p.NsxType) - populate(objectMap, "placementGroupId", p.PlacementGroupID) - populate(objectMap, "placementGroupName", p.PlacementGroupName) - populate(objectMap, "privateCloudId", p.PrivateCloudID) - populate(objectMap, "resourcePools", p.ResourcePools) - populate(objectMap, "state", p.State) - populate(objectMap, "totalCpuCores", p.TotalCPUCores) - populate(objectMap, "totalNodes", p.TotalNodes) - populate(objectMap, "totalRam", p.TotalRAM) - populate(objectMap, "totalStorage", p.TotalStorage) - populate(objectMap, "type", p.Type) - populate(objectMap, "vSphereVersion", p.VSphereVersion) - populate(objectMap, "vcenterFqdn", p.VcenterFqdn) - populate(objectMap, "vcenterRefid", p.VcenterRefid) - populate(objectMap, "virtualMachineTemplates", p.VirtualMachineTemplates) - populate(objectMap, "virtualNetworks", p.VirtualNetworks) - populate(objectMap, "vrOpsEnabled", p.VrOpsEnabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateCloudProperties. -func (p *PrivateCloudProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "availabilityZoneId": - err = unpopulate(val, &p.AvailabilityZoneID) - delete(rawMsg, key) - case "availabilityZoneName": - err = unpopulate(val, &p.AvailabilityZoneName) - delete(rawMsg, key) - case "clustersNumber": - err = unpopulate(val, &p.ClustersNumber) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, &p.CreatedBy) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, &p.CreatedOn) - delete(rawMsg, key) - case "dnsServers": - err = unpopulate(val, &p.DNSServers) - delete(rawMsg, key) - case "expires": - err = unpopulate(val, &p.Expires) - delete(rawMsg, key) - case "nsxType": - err = unpopulate(val, &p.NsxType) - delete(rawMsg, key) - case "placementGroupId": - err = unpopulate(val, &p.PlacementGroupID) - delete(rawMsg, key) - case "placementGroupName": - err = unpopulate(val, &p.PlacementGroupName) - delete(rawMsg, key) - case "privateCloudId": - err = unpopulate(val, &p.PrivateCloudID) - delete(rawMsg, key) - case "resourcePools": - err = unpopulate(val, &p.ResourcePools) - delete(rawMsg, key) - case "state": - err = unpopulate(val, &p.State) - delete(rawMsg, key) - case "totalCpuCores": - err = unpopulate(val, &p.TotalCPUCores) - delete(rawMsg, key) - case "totalNodes": - err = unpopulate(val, &p.TotalNodes) - delete(rawMsg, key) - case "totalRam": - err = unpopulate(val, &p.TotalRAM) - delete(rawMsg, key) - case "totalStorage": - err = unpopulate(val, &p.TotalStorage) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &p.Type) - delete(rawMsg, key) - case "vSphereVersion": - err = unpopulate(val, &p.VSphereVersion) - delete(rawMsg, key) - case "vcenterFqdn": - err = unpopulate(val, &p.VcenterFqdn) - delete(rawMsg, key) - case "vcenterRefid": - err = unpopulate(val, &p.VcenterRefid) - delete(rawMsg, key) - case "virtualMachineTemplates": - err = unpopulate(val, &p.VirtualMachineTemplates) - delete(rawMsg, key) - case "virtualNetworks": - err = unpopulate(val, &p.VirtualNetworks) - delete(rawMsg, key) - case "vrOpsEnabled": - err = unpopulate(val, &p.VrOpsEnabled) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // PrivateCloudsClientGetOptions contains the optional parameters for the PrivateCloudsClient.Get method. type PrivateCloudsClientGetOptions struct { // placeholder for future optional parameters @@ -1066,14 +688,6 @@ type ResourcePoolsListResponse struct { Value []*ResourcePool `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ResourcePoolsListResponse. -func (r ResourcePoolsListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - // SKU - The purchase SKU for CloudSimple paid resources type SKU struct { // REQUIRED; The name of the SKU for VMWare CloudSimple Node @@ -1129,14 +743,6 @@ type SKUAvailabilityListResponse struct { Value []*SKUAvailability `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SKUAvailabilityListResponse. -func (s SKUAvailabilityListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - // SKUDescription - The purchase SKU for CloudSimple paid resources type SKUDescription struct { // REQUIRED; SKU's id @@ -1177,14 +783,6 @@ type UsageListResponse struct { Value []*Usage `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type UsageListResponse. -func (u UsageListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", u.NextLink) - populate(objectMap, "value", u.Value) - return json.Marshal(objectMap) -} - // UsageName - User name model type UsageName struct { // e.g. "Virtual Machines" @@ -1254,18 +852,6 @@ type VirtualMachine struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type VirtualMachine. -func (v VirtualMachine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", v.ID) - populate(objectMap, "location", v.Location) - populate(objectMap, "name", v.Name) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "tags", v.Tags) - populate(objectMap, "type", v.Type) - return json.Marshal(objectMap) -} - // VirtualMachineListResponse - List of virtual machines type VirtualMachineListResponse struct { // Link for next list of VirtualMachines @@ -1275,14 +861,6 @@ type VirtualMachineListResponse struct { Value []*VirtualMachine `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineListResponse. -func (v VirtualMachineListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", v.NextLink) - populate(objectMap, "value", v.Value) - return json.Marshal(objectMap) -} - // VirtualMachineProperties - Properties of virtual machine type VirtualMachineProperties struct { // REQUIRED; The amount of memory @@ -1352,34 +930,6 @@ type VirtualMachineProperties struct { Vmwaretools *string `json:"vmwaretools,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineProperties. -func (v VirtualMachineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "amountOfRam", v.AmountOfRAM) - populate(objectMap, "controllers", v.Controllers) - populate(objectMap, "customization", v.Customization) - populate(objectMap, "disks", v.Disks) - populate(objectMap, "dnsname", v.Dnsname) - populate(objectMap, "exposeToGuestVM", v.ExposeToGuestVM) - populate(objectMap, "folder", v.Folder) - populate(objectMap, "guestOS", v.GuestOS) - populate(objectMap, "guestOSType", v.GuestOSType) - populate(objectMap, "nics", v.Nics) - populate(objectMap, "numberOfCores", v.NumberOfCores) - populate(objectMap, "password", v.Password) - populate(objectMap, "privateCloudId", v.PrivateCloudID) - populate(objectMap, "provisioningState", v.ProvisioningState) - populate(objectMap, "publicIP", v.PublicIP) - populate(objectMap, "resourcePool", v.ResourcePool) - populate(objectMap, "status", v.Status) - populate(objectMap, "templateId", v.TemplateID) - populate(objectMap, "username", v.Username) - populate(objectMap, "vmId", v.VMID) - populate(objectMap, "vSphereNetworks", v.VSphereNetworks) - populate(objectMap, "vmwaretools", v.Vmwaretools) - return json.Marshal(objectMap) -} - // VirtualMachineStopMode - List of virtual machine stop modes type VirtualMachineStopMode struct { // mode indicates a type of stop operation - reboot, suspend, shutdown or power-off @@ -1413,14 +963,6 @@ type VirtualMachineTemplateListResponse struct { Value []*VirtualMachineTemplate `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineTemplateListResponse. -func (v VirtualMachineTemplateListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", v.NextLink) - populate(objectMap, "value", v.Value) - return json.Marshal(objectMap) -} - // VirtualMachineTemplateProperties - Properties of virtual machine template type VirtualMachineTemplateProperties struct { // REQUIRED; The Private Cloud Id @@ -1466,26 +1008,6 @@ type VirtualMachineTemplateProperties struct { Vmwaretools *string `json:"vmwaretools,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineTemplateProperties. -func (v VirtualMachineTemplateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "amountOfRam", v.AmountOfRAM) - populate(objectMap, "controllers", v.Controllers) - populate(objectMap, "description", v.Description) - populate(objectMap, "disks", v.Disks) - populate(objectMap, "exposeToGuestVM", v.ExposeToGuestVM) - populate(objectMap, "guestOS", v.GuestOS) - populate(objectMap, "guestOSType", v.GuestOSType) - populate(objectMap, "nics", v.Nics) - populate(objectMap, "numberOfCores", v.NumberOfCores) - populate(objectMap, "path", v.Path) - populate(objectMap, "privateCloudId", v.PrivateCloudID) - populate(objectMap, "vSphereNetworks", v.VSphereNetworks) - populate(objectMap, "vSphereTags", v.VSphereTags) - populate(objectMap, "vmwaretools", v.Vmwaretools) - return json.Marshal(objectMap) -} - // VirtualMachineTemplatesClientGetOptions contains the optional parameters for the VirtualMachineTemplatesClient.Get method. type VirtualMachineTemplatesClientGetOptions struct { // placeholder for future optional parameters @@ -1499,17 +1021,20 @@ type VirtualMachineTemplatesClientListOptions struct { // VirtualMachinesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachinesClient.BeginCreateOrUpdate // method. type VirtualMachinesClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // VirtualMachinesClientBeginDeleteOptions contains the optional parameters for the VirtualMachinesClient.BeginDelete method. type VirtualMachinesClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // VirtualMachinesClientBeginStartOptions contains the optional parameters for the VirtualMachinesClient.BeginStart method. type VirtualMachinesClientBeginStartOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // VirtualMachinesClientBeginStopOptions contains the optional parameters for the VirtualMachinesClient.BeginStop method. @@ -1518,11 +1043,14 @@ type VirtualMachinesClientBeginStopOptions struct { M *VirtualMachineStopMode // query stop mode parameter (reboot, shutdown, etc…) Mode *StopMode + // Resumes the LRO from the provided token. + ResumeToken string } // VirtualMachinesClientBeginUpdateOptions contains the optional parameters for the VirtualMachinesClient.BeginUpdate method. type VirtualMachinesClientBeginUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // VirtualMachinesClientGetOptions contains the optional parameters for the VirtualMachinesClient.Get method. @@ -1582,14 +1110,6 @@ type VirtualNetworkListResponse struct { Value []*VirtualNetwork `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkListResponse. -func (v VirtualNetworkListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", v.NextLink) - populate(objectMap, "value", v.Value) - return json.Marshal(objectMap) -} - // VirtualNetworkProperties - Properties of virtual network type VirtualNetworkProperties struct { // READ-ONLY; The Private Cloud id @@ -1632,34 +1152,3 @@ type VirtualNic struct { // READ-ONLY; NIC name VirtualNicName *string `json:"virtualNicName,omitempty" azure:"ro"` } - -// MarshalJSON implements the json.Marshaller interface for type VirtualNic. -func (v VirtualNic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "customization", v.Customization) - populate(objectMap, "ipAddresses", v.IPAddresses) - populate(objectMap, "macAddress", v.MacAddress) - populate(objectMap, "network", v.Network) - populate(objectMap, "nicType", v.NicType) - populate(objectMap, "powerOnBoot", v.PowerOnBoot) - populate(objectMap, "virtualNicId", v.VirtualNicID) - populate(objectMap, "virtualNicName", v.VirtualNicName) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_models_serde.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_models_serde.go new file mode 100644 index 000000000000..3fb87a003ce0 --- /dev/null +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_models_serde.go @@ -0,0 +1,529 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armvmwarecloudsimple + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AvailableOperationDisplayPropertyServiceSpecificationMetricsList. +func (a AvailableOperationDisplayPropertyServiceSpecificationMetricsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "metricSpecifications", a.MetricSpecifications) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableOperationsListResponse. +func (a AvailableOperationsListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CSRPErrorBody. +func (c CSRPErrorBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", c.Code) + populate(objectMap, "details", c.Details) + populate(objectMap, "message", c.Message) + populate(objectMap, "target", c.Target) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CustomizationIPSettings. +func (c CustomizationIPSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "gateway", c.Gateway) + populate(objectMap, "ip", c.IP) + populate(objectMap, "subnetMask", c.SubnetMask) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CustomizationPoliciesListResponse. +func (c CustomizationPoliciesListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type CustomizationSpecification. +func (c CustomizationSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "nicSettings", c.NicSettings) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedCloudNode. +func (d DedicatedCloudNode) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "sku", d.SKU) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedCloudNodeListResponse. +func (d DedicatedCloudNodeListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedCloudNodeProperties. +func (d DedicatedCloudNodeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availabilityZoneId", d.AvailabilityZoneID) + populate(objectMap, "availabilityZoneName", d.AvailabilityZoneName) + populate(objectMap, "cloudRackName", d.CloudRackName) + populateTimeRFC3339(objectMap, "created", d.Created) + populate(objectMap, "nodesCount", d.NodesCount) + populate(objectMap, "placementGroupId", d.PlacementGroupID) + populate(objectMap, "placementGroupName", d.PlacementGroupName) + populate(objectMap, "privateCloudId", d.PrivateCloudID) + populate(objectMap, "privateCloudName", d.PrivateCloudName) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "purchaseId", d.PurchaseID) + populate(objectMap, "skuDescription", d.SKUDescription) + populate(objectMap, "status", d.Status) + populate(objectMap, "vmwareClusterName", d.VmwareClusterName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedCloudNodeProperties. +func (d *DedicatedCloudNodeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityZoneId": + err = unpopulate(val, &d.AvailabilityZoneID) + delete(rawMsg, key) + case "availabilityZoneName": + err = unpopulate(val, &d.AvailabilityZoneName) + delete(rawMsg, key) + case "cloudRackName": + err = unpopulate(val, &d.CloudRackName) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC3339(val, &d.Created) + delete(rawMsg, key) + case "nodesCount": + err = unpopulate(val, &d.NodesCount) + delete(rawMsg, key) + case "placementGroupId": + err = unpopulate(val, &d.PlacementGroupID) + delete(rawMsg, key) + case "placementGroupName": + err = unpopulate(val, &d.PlacementGroupName) + delete(rawMsg, key) + case "privateCloudId": + err = unpopulate(val, &d.PrivateCloudID) + delete(rawMsg, key) + case "privateCloudName": + err = unpopulate(val, &d.PrivateCloudName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &d.ProvisioningState) + delete(rawMsg, key) + case "purchaseId": + err = unpopulate(val, &d.PurchaseID) + delete(rawMsg, key) + case "skuDescription": + err = unpopulate(val, &d.SKUDescription) + delete(rawMsg, key) + case "status": + err = unpopulate(val, &d.Status) + delete(rawMsg, key) + case "vmwareClusterName": + err = unpopulate(val, &d.VmwareClusterName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedCloudService. +func (d DedicatedCloudService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedCloudServiceListResponse. +func (d DedicatedCloudServiceListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type GuestOSCustomization. +func (g GuestOSCustomization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsServers", g.DNSServers) + populate(objectMap, "hostName", g.HostName) + populate(objectMap, "password", g.Password) + populate(objectMap, "policyId", g.PolicyID) + populate(objectMap, "username", g.Username) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type GuestOSNICCustomization. +func (g GuestOSNICCustomization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allocation", g.Allocation) + populate(objectMap, "dnsServers", g.DNSServers) + populate(objectMap, "gateway", g.Gateway) + populate(objectMap, "ipAddress", g.IPAddress) + populate(objectMap, "mask", g.Mask) + populate(objectMap, "primaryWinsServer", g.PrimaryWinsServer) + populate(objectMap, "secondaryWinsServer", g.SecondaryWinsServer) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OperationResource. +func (o OperationResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResource. +func (o *OperationResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &o.Name) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, &o.Status) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchPayload. +func (p PatchPayload) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateCloudList. +func (p PrivateCloudList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateCloudProperties. +func (p PrivateCloudProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availabilityZoneId", p.AvailabilityZoneID) + populate(objectMap, "availabilityZoneName", p.AvailabilityZoneName) + populate(objectMap, "clustersNumber", p.ClustersNumber) + populate(objectMap, "createdBy", p.CreatedBy) + populateTimeRFC3339(objectMap, "createdOn", p.CreatedOn) + populate(objectMap, "dnsServers", p.DNSServers) + populate(objectMap, "expires", p.Expires) + populate(objectMap, "nsxType", p.NsxType) + populate(objectMap, "placementGroupId", p.PlacementGroupID) + populate(objectMap, "placementGroupName", p.PlacementGroupName) + populate(objectMap, "privateCloudId", p.PrivateCloudID) + populate(objectMap, "resourcePools", p.ResourcePools) + populate(objectMap, "state", p.State) + populate(objectMap, "totalCpuCores", p.TotalCPUCores) + populate(objectMap, "totalNodes", p.TotalNodes) + populate(objectMap, "totalRam", p.TotalRAM) + populate(objectMap, "totalStorage", p.TotalStorage) + populate(objectMap, "type", p.Type) + populate(objectMap, "vSphereVersion", p.VSphereVersion) + populate(objectMap, "vcenterFqdn", p.VcenterFqdn) + populate(objectMap, "vcenterRefid", p.VcenterRefid) + populate(objectMap, "virtualMachineTemplates", p.VirtualMachineTemplates) + populate(objectMap, "virtualNetworks", p.VirtualNetworks) + populate(objectMap, "vrOpsEnabled", p.VrOpsEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateCloudProperties. +func (p *PrivateCloudProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityZoneId": + err = unpopulate(val, &p.AvailabilityZoneID) + delete(rawMsg, key) + case "availabilityZoneName": + err = unpopulate(val, &p.AvailabilityZoneName) + delete(rawMsg, key) + case "clustersNumber": + err = unpopulate(val, &p.ClustersNumber) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &p.CreatedBy) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, &p.CreatedOn) + delete(rawMsg, key) + case "dnsServers": + err = unpopulate(val, &p.DNSServers) + delete(rawMsg, key) + case "expires": + err = unpopulate(val, &p.Expires) + delete(rawMsg, key) + case "nsxType": + err = unpopulate(val, &p.NsxType) + delete(rawMsg, key) + case "placementGroupId": + err = unpopulate(val, &p.PlacementGroupID) + delete(rawMsg, key) + case "placementGroupName": + err = unpopulate(val, &p.PlacementGroupName) + delete(rawMsg, key) + case "privateCloudId": + err = unpopulate(val, &p.PrivateCloudID) + delete(rawMsg, key) + case "resourcePools": + err = unpopulate(val, &p.ResourcePools) + delete(rawMsg, key) + case "state": + err = unpopulate(val, &p.State) + delete(rawMsg, key) + case "totalCpuCores": + err = unpopulate(val, &p.TotalCPUCores) + delete(rawMsg, key) + case "totalNodes": + err = unpopulate(val, &p.TotalNodes) + delete(rawMsg, key) + case "totalRam": + err = unpopulate(val, &p.TotalRAM) + delete(rawMsg, key) + case "totalStorage": + err = unpopulate(val, &p.TotalStorage) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &p.Type) + delete(rawMsg, key) + case "vSphereVersion": + err = unpopulate(val, &p.VSphereVersion) + delete(rawMsg, key) + case "vcenterFqdn": + err = unpopulate(val, &p.VcenterFqdn) + delete(rawMsg, key) + case "vcenterRefid": + err = unpopulate(val, &p.VcenterRefid) + delete(rawMsg, key) + case "virtualMachineTemplates": + err = unpopulate(val, &p.VirtualMachineTemplates) + delete(rawMsg, key) + case "virtualNetworks": + err = unpopulate(val, &p.VirtualNetworks) + delete(rawMsg, key) + case "vrOpsEnabled": + err = unpopulate(val, &p.VrOpsEnabled) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourcePoolsListResponse. +func (r ResourcePoolsListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type SKUAvailabilityListResponse. +func (s SKUAvailabilityListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type UsageListResponse. +func (u UsageListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachine. +func (v VirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineListResponse. +func (v VirtualMachineListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineProperties. +func (v VirtualMachineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "amountOfRam", v.AmountOfRAM) + populate(objectMap, "controllers", v.Controllers) + populate(objectMap, "customization", v.Customization) + populate(objectMap, "disks", v.Disks) + populate(objectMap, "dnsname", v.Dnsname) + populate(objectMap, "exposeToGuestVM", v.ExposeToGuestVM) + populate(objectMap, "folder", v.Folder) + populate(objectMap, "guestOS", v.GuestOS) + populate(objectMap, "guestOSType", v.GuestOSType) + populate(objectMap, "nics", v.Nics) + populate(objectMap, "numberOfCores", v.NumberOfCores) + populate(objectMap, "password", v.Password) + populate(objectMap, "privateCloudId", v.PrivateCloudID) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "publicIP", v.PublicIP) + populate(objectMap, "resourcePool", v.ResourcePool) + populate(objectMap, "status", v.Status) + populate(objectMap, "templateId", v.TemplateID) + populate(objectMap, "username", v.Username) + populate(objectMap, "vmId", v.VMID) + populate(objectMap, "vSphereNetworks", v.VSphereNetworks) + populate(objectMap, "vmwaretools", v.Vmwaretools) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineTemplateListResponse. +func (v VirtualMachineTemplateListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineTemplateProperties. +func (v VirtualMachineTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "amountOfRam", v.AmountOfRAM) + populate(objectMap, "controllers", v.Controllers) + populate(objectMap, "description", v.Description) + populate(objectMap, "disks", v.Disks) + populate(objectMap, "exposeToGuestVM", v.ExposeToGuestVM) + populate(objectMap, "guestOS", v.GuestOS) + populate(objectMap, "guestOSType", v.GuestOSType) + populate(objectMap, "nics", v.Nics) + populate(objectMap, "numberOfCores", v.NumberOfCores) + populate(objectMap, "path", v.Path) + populate(objectMap, "privateCloudId", v.PrivateCloudID) + populate(objectMap, "vSphereNetworks", v.VSphereNetworks) + populate(objectMap, "vSphereTags", v.VSphereTags) + populate(objectMap, "vmwaretools", v.Vmwaretools) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkListResponse. +func (v VirtualNetworkListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNic. +func (v VirtualNic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customization", v.Customization) + populate(objectMap, "ipAddresses", v.IPAddresses) + populate(objectMap, "macAddress", v.MacAddress) + populate(objectMap, "network", v.Network) + populate(objectMap, "nicType", v.NicType) + populate(objectMap, "powerOnBoot", v.PowerOnBoot) + populate(objectMap, "virtualNicId", v.VirtualNicID) + populate(objectMap, "virtualNicName", v.VirtualNicName) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_operations_client.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_operations_client.go index 7ee03ce26fba..45f776f63b1f 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_operations_client.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,39 +28,41 @@ import ( type OperationsClient struct { host string subscriptionID string - referer string pl runtime.Pipeline } // NewOperationsClient creates a new instance of OperationsClient with the specified values. // subscriptionID - The subscription ID. -// referer - referer url // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(subscriptionID string, referer string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ subscriptionID: subscriptionID, - referer: referer, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Return an async operation // If the operation fails it returns an *azcore.ResponseError type. // regionID - The region Id (westus, eastus) +// referer - referer url // operationID - operation id // options - OperationsClientGetOptions contains the optional parameters for the OperationsClient.Get method. -func (client *OperationsClient) Get(ctx context.Context, regionID string, operationID string, options *OperationsClientGetOptions) (OperationsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, regionID, operationID, options) +func (client *OperationsClient) Get(ctx context.Context, regionID string, referer string, operationID string, options *OperationsClientGetOptions) (OperationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, regionID, referer, operationID, options) if err != nil { return OperationsClientGetResponse{}, err } @@ -74,7 +77,7 @@ func (client *OperationsClient) Get(ctx context.Context, regionID string, operat } // getCreateRequest creates the Get request. -func (client *OperationsClient) getCreateRequest(ctx context.Context, regionID string, operationID string, options *OperationsClientGetOptions) (*policy.Request, error) { +func (client *OperationsClient) getCreateRequest(ctx context.Context, regionID string, referer string, operationID string, options *OperationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/operationResults/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -95,14 +98,14 @@ func (client *OperationsClient) getCreateRequest(ctx context.Context, regionID s reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-04-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Referer", client.referer) + req.Raw().Header.Set("Referer", referer) req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. func (client *OperationsClient) getHandleResponse(resp *http.Response) (OperationsClientGetResponse, error) { - result := OperationsClientGetResponse{RawResponse: resp} + result := OperationsClientGetResponse{} if val := resp.Header.Get("Location"); val != "" { result.Location = &val } @@ -123,16 +126,32 @@ func (client *OperationsClient) getHandleResponse(resp *http.Response) (Operatio // List - Return list of operations // If the operation fails it returns an *azcore.ResponseError type. // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(options *OperationsClientListOptions) *OperationsClientListPager { - return &OperationsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *OperationsClient) List(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp OperationsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.AvailableOperationsListResponse.NextLink) + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -151,7 +170,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AvailableOperationsListResponse); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_pagers.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_pagers.go deleted file mode 100644 index 5bb3dce64202..000000000000 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_pagers.go +++ /dev/null @@ -1,773 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armvmwarecloudsimple - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// CustomizationPoliciesClientListPager provides operations for iterating over paged responses. -type CustomizationPoliciesClientListPager struct { - client *CustomizationPoliciesClient - current CustomizationPoliciesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, CustomizationPoliciesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *CustomizationPoliciesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *CustomizationPoliciesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.CustomizationPoliciesListResponse.NextLink == nil || len(*p.current.CustomizationPoliciesListResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current CustomizationPoliciesClientListResponse page. -func (p *CustomizationPoliciesClientListPager) PageResponse() CustomizationPoliciesClientListResponse { - return p.current -} - -// DedicatedCloudNodesClientListByResourceGroupPager provides operations for iterating over paged responses. -type DedicatedCloudNodesClientListByResourceGroupPager struct { - client *DedicatedCloudNodesClient - current DedicatedCloudNodesClientListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, DedicatedCloudNodesClientListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *DedicatedCloudNodesClientListByResourceGroupPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *DedicatedCloudNodesClientListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DedicatedCloudNodeListResponse.NextLink == nil || len(*p.current.DedicatedCloudNodeListResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByResourceGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current DedicatedCloudNodesClientListByResourceGroupResponse page. -func (p *DedicatedCloudNodesClientListByResourceGroupPager) PageResponse() DedicatedCloudNodesClientListByResourceGroupResponse { - return p.current -} - -// DedicatedCloudNodesClientListBySubscriptionPager provides operations for iterating over paged responses. -type DedicatedCloudNodesClientListBySubscriptionPager struct { - client *DedicatedCloudNodesClient - current DedicatedCloudNodesClientListBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, DedicatedCloudNodesClientListBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *DedicatedCloudNodesClientListBySubscriptionPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *DedicatedCloudNodesClientListBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DedicatedCloudNodeListResponse.NextLink == nil || len(*p.current.DedicatedCloudNodeListResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listBySubscriptionHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current DedicatedCloudNodesClientListBySubscriptionResponse page. -func (p *DedicatedCloudNodesClientListBySubscriptionPager) PageResponse() DedicatedCloudNodesClientListBySubscriptionResponse { - return p.current -} - -// DedicatedCloudServicesClientListByResourceGroupPager provides operations for iterating over paged responses. -type DedicatedCloudServicesClientListByResourceGroupPager struct { - client *DedicatedCloudServicesClient - current DedicatedCloudServicesClientListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, DedicatedCloudServicesClientListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *DedicatedCloudServicesClientListByResourceGroupPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *DedicatedCloudServicesClientListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DedicatedCloudServiceListResponse.NextLink == nil || len(*p.current.DedicatedCloudServiceListResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByResourceGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current DedicatedCloudServicesClientListByResourceGroupResponse page. -func (p *DedicatedCloudServicesClientListByResourceGroupPager) PageResponse() DedicatedCloudServicesClientListByResourceGroupResponse { - return p.current -} - -// DedicatedCloudServicesClientListBySubscriptionPager provides operations for iterating over paged responses. -type DedicatedCloudServicesClientListBySubscriptionPager struct { - client *DedicatedCloudServicesClient - current DedicatedCloudServicesClientListBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, DedicatedCloudServicesClientListBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *DedicatedCloudServicesClientListBySubscriptionPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *DedicatedCloudServicesClientListBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DedicatedCloudServiceListResponse.NextLink == nil || len(*p.current.DedicatedCloudServiceListResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listBySubscriptionHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current DedicatedCloudServicesClientListBySubscriptionResponse page. -func (p *DedicatedCloudServicesClientListBySubscriptionPager) PageResponse() DedicatedCloudServicesClientListBySubscriptionResponse { - return p.current -} - -// OperationsClientListPager provides operations for iterating over paged responses. -type OperationsClientListPager struct { - client *OperationsClient - current OperationsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, OperationsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *OperationsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *OperationsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.AvailableOperationsListResponse.NextLink == nil || len(*p.current.AvailableOperationsListResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current OperationsClientListResponse page. -func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse { - return p.current -} - -// PrivateCloudsClientListPager provides operations for iterating over paged responses. -type PrivateCloudsClientListPager struct { - client *PrivateCloudsClient - current PrivateCloudsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PrivateCloudsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PrivateCloudsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *PrivateCloudsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PrivateCloudList.NextLink == nil || len(*p.current.PrivateCloudList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PrivateCloudsClientListResponse page. -func (p *PrivateCloudsClientListPager) PageResponse() PrivateCloudsClientListResponse { - return p.current -} - -// ResourcePoolsClientListPager provides operations for iterating over paged responses. -type ResourcePoolsClientListPager struct { - client *ResourcePoolsClient - current ResourcePoolsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ResourcePoolsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ResourcePoolsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ResourcePoolsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ResourcePoolsListResponse.NextLink == nil || len(*p.current.ResourcePoolsListResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ResourcePoolsClientListResponse page. -func (p *ResourcePoolsClientListPager) PageResponse() ResourcePoolsClientListResponse { - return p.current -} - -// SKUsAvailabilityClientListPager provides operations for iterating over paged responses. -type SKUsAvailabilityClientListPager struct { - client *SKUsAvailabilityClient - current SKUsAvailabilityClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, SKUsAvailabilityClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *SKUsAvailabilityClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *SKUsAvailabilityClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.SKUAvailabilityListResponse.NextLink == nil || len(*p.current.SKUAvailabilityListResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current SKUsAvailabilityClientListResponse page. -func (p *SKUsAvailabilityClientListPager) PageResponse() SKUsAvailabilityClientListResponse { - return p.current -} - -// UsagesClientListPager provides operations for iterating over paged responses. -type UsagesClientListPager struct { - client *UsagesClient - current UsagesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, UsagesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *UsagesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *UsagesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.UsageListResponse.NextLink == nil || len(*p.current.UsageListResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current UsagesClientListResponse page. -func (p *UsagesClientListPager) PageResponse() UsagesClientListResponse { - return p.current -} - -// VirtualMachineTemplatesClientListPager provides operations for iterating over paged responses. -type VirtualMachineTemplatesClientListPager struct { - client *VirtualMachineTemplatesClient - current VirtualMachineTemplatesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, VirtualMachineTemplatesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *VirtualMachineTemplatesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *VirtualMachineTemplatesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.VirtualMachineTemplateListResponse.NextLink == nil || len(*p.current.VirtualMachineTemplateListResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current VirtualMachineTemplatesClientListResponse page. -func (p *VirtualMachineTemplatesClientListPager) PageResponse() VirtualMachineTemplatesClientListResponse { - return p.current -} - -// VirtualMachinesClientListByResourceGroupPager provides operations for iterating over paged responses. -type VirtualMachinesClientListByResourceGroupPager struct { - client *VirtualMachinesClient - current VirtualMachinesClientListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, VirtualMachinesClientListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *VirtualMachinesClientListByResourceGroupPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *VirtualMachinesClientListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.VirtualMachineListResponse.NextLink == nil || len(*p.current.VirtualMachineListResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByResourceGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current VirtualMachinesClientListByResourceGroupResponse page. -func (p *VirtualMachinesClientListByResourceGroupPager) PageResponse() VirtualMachinesClientListByResourceGroupResponse { - return p.current -} - -// VirtualMachinesClientListBySubscriptionPager provides operations for iterating over paged responses. -type VirtualMachinesClientListBySubscriptionPager struct { - client *VirtualMachinesClient - current VirtualMachinesClientListBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, VirtualMachinesClientListBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *VirtualMachinesClientListBySubscriptionPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *VirtualMachinesClientListBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.VirtualMachineListResponse.NextLink == nil || len(*p.current.VirtualMachineListResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listBySubscriptionHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current VirtualMachinesClientListBySubscriptionResponse page. -func (p *VirtualMachinesClientListBySubscriptionPager) PageResponse() VirtualMachinesClientListBySubscriptionResponse { - return p.current -} - -// VirtualNetworksClientListPager provides operations for iterating over paged responses. -type VirtualNetworksClientListPager struct { - client *VirtualNetworksClient - current VirtualNetworksClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, VirtualNetworksClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *VirtualNetworksClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *VirtualNetworksClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.VirtualNetworkListResponse.NextLink == nil || len(*p.current.VirtualNetworkListResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current VirtualNetworksClientListResponse page. -func (p *VirtualNetworksClientListPager) PageResponse() VirtualNetworksClientListResponse { - return p.current -} diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_pollers.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_pollers.go deleted file mode 100644 index 1adcf56b4ebc..000000000000 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_pollers.go +++ /dev/null @@ -1,316 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armvmwarecloudsimple - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// DedicatedCloudNodesClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type DedicatedCloudNodesClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *DedicatedCloudNodesClientCreateOrUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *DedicatedCloudNodesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final DedicatedCloudNodesClientCreateOrUpdateResponse will be returned. -func (p *DedicatedCloudNodesClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (DedicatedCloudNodesClientCreateOrUpdateResponse, error) { - respType := DedicatedCloudNodesClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.DedicatedCloudNode) - if err != nil { - return DedicatedCloudNodesClientCreateOrUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *DedicatedCloudNodesClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// DedicatedCloudServicesClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type DedicatedCloudServicesClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *DedicatedCloudServicesClientDeletePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *DedicatedCloudServicesClientDeletePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final DedicatedCloudServicesClientDeleteResponse will be returned. -func (p *DedicatedCloudServicesClientDeletePoller) FinalResponse(ctx context.Context) (DedicatedCloudServicesClientDeleteResponse, error) { - respType := DedicatedCloudServicesClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return DedicatedCloudServicesClientDeleteResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *DedicatedCloudServicesClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// VirtualMachinesClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachinesClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VirtualMachinesClientCreateOrUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *VirtualMachinesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final VirtualMachinesClientCreateOrUpdateResponse will be returned. -func (p *VirtualMachinesClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachinesClientCreateOrUpdateResponse, error) { - respType := VirtualMachinesClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachine) - if err != nil { - return VirtualMachinesClientCreateOrUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *VirtualMachinesClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// VirtualMachinesClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachinesClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VirtualMachinesClientDeletePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *VirtualMachinesClientDeletePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final VirtualMachinesClientDeleteResponse will be returned. -func (p *VirtualMachinesClientDeletePoller) FinalResponse(ctx context.Context) (VirtualMachinesClientDeleteResponse, error) { - respType := VirtualMachinesClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return VirtualMachinesClientDeleteResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *VirtualMachinesClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// VirtualMachinesClientStartPoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachinesClientStartPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VirtualMachinesClientStartPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *VirtualMachinesClientStartPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final VirtualMachinesClientStartResponse will be returned. -func (p *VirtualMachinesClientStartPoller) FinalResponse(ctx context.Context) (VirtualMachinesClientStartResponse, error) { - respType := VirtualMachinesClientStartResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return VirtualMachinesClientStartResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *VirtualMachinesClientStartPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// VirtualMachinesClientStopPoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachinesClientStopPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VirtualMachinesClientStopPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *VirtualMachinesClientStopPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final VirtualMachinesClientStopResponse will be returned. -func (p *VirtualMachinesClientStopPoller) FinalResponse(ctx context.Context) (VirtualMachinesClientStopResponse, error) { - respType := VirtualMachinesClientStopResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return VirtualMachinesClientStopResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *VirtualMachinesClientStopPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// VirtualMachinesClientUpdatePoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachinesClientUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *VirtualMachinesClientUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *VirtualMachinesClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final VirtualMachinesClientUpdateResponse will be returned. -func (p *VirtualMachinesClientUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachinesClientUpdateResponse, error) { - respType := VirtualMachinesClientUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachine) - if err != nil { - return VirtualMachinesClientUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *VirtualMachinesClientUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_privateclouds_client.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_privateclouds_client.go index 56ec245d4186..ba3a4cb78bc7 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_privateclouds_client.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_privateclouds_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type PrivateCloudsClient struct { // subscriptionID - The subscription ID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateCloudsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateCloudsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPrivateCloudsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateCloudsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateCloudsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Returns private cloud by its name @@ -97,7 +102,7 @@ func (client *PrivateCloudsClient) getCreateRequest(ctx context.Context, pcName // getHandleResponse handles the Get response. func (client *PrivateCloudsClient) getHandleResponse(resp *http.Response) (PrivateCloudsClientGetResponse, error) { - result := PrivateCloudsClientGetResponse{RawResponse: resp} + result := PrivateCloudsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateCloud); err != nil { return PrivateCloudsClientGetResponse{}, err } @@ -108,16 +113,32 @@ func (client *PrivateCloudsClient) getHandleResponse(resp *http.Response) (Priva // If the operation fails it returns an *azcore.ResponseError type. // regionID - The region Id (westus, eastus) // options - PrivateCloudsClientListOptions contains the optional parameters for the PrivateCloudsClient.List method. -func (client *PrivateCloudsClient) List(regionID string, options *PrivateCloudsClientListOptions) *PrivateCloudsClientListPager { - return &PrivateCloudsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, regionID, options) +func (client *PrivateCloudsClient) List(regionID string, options *PrivateCloudsClientListOptions) *runtime.Pager[PrivateCloudsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[PrivateCloudsClientListResponse]{ + More: func(page PrivateCloudsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp PrivateCloudsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateCloudList.NextLink) + Fetcher: func(ctx context.Context, page *PrivateCloudsClientListResponse) (PrivateCloudsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, regionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateCloudsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateCloudsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateCloudsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -144,7 +165,7 @@ func (client *PrivateCloudsClient) listCreateRequest(ctx context.Context, region // listHandleResponse handles the List response. func (client *PrivateCloudsClient) listHandleResponse(resp *http.Response) (PrivateCloudsClientListResponse, error) { - result := PrivateCloudsClientListResponse{RawResponse: resp} + result := PrivateCloudsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateCloudList); err != nil { return PrivateCloudsClientListResponse{}, err } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_resourcepools_client.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_resourcepools_client.go index 69e45a6d79c7..a5ddaf803ee3 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_resourcepools_client.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_resourcepools_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ResourcePoolsClient struct { // subscriptionID - The subscription ID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewResourcePoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ResourcePoolsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewResourcePoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourcePoolsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ResourcePoolsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Returns resource pool templates by its name @@ -102,7 +107,7 @@ func (client *ResourcePoolsClient) getCreateRequest(ctx context.Context, regionI // getHandleResponse handles the Get response. func (client *ResourcePoolsClient) getHandleResponse(resp *http.Response) (ResourcePoolsClientGetResponse, error) { - result := ResourcePoolsClientGetResponse{RawResponse: resp} + result := ResourcePoolsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ResourcePool); err != nil { return ResourcePoolsClientGetResponse{}, err } @@ -114,16 +119,32 @@ func (client *ResourcePoolsClient) getHandleResponse(resp *http.Response) (Resou // regionID - The region Id (westus, eastus) // pcName - The private cloud name // options - ResourcePoolsClientListOptions contains the optional parameters for the ResourcePoolsClient.List method. -func (client *ResourcePoolsClient) List(regionID string, pcName string, options *ResourcePoolsClientListOptions) *ResourcePoolsClientListPager { - return &ResourcePoolsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, regionID, pcName, options) +func (client *ResourcePoolsClient) List(regionID string, pcName string, options *ResourcePoolsClientListOptions) *runtime.Pager[ResourcePoolsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ResourcePoolsClientListResponse]{ + More: func(page ResourcePoolsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ResourcePoolsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ResourcePoolsListResponse.NextLink) + Fetcher: func(ctx context.Context, page *ResourcePoolsClientListResponse) (ResourcePoolsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, regionID, pcName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourcePoolsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourcePoolsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourcePoolsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -154,7 +175,7 @@ func (client *ResourcePoolsClient) listCreateRequest(ctx context.Context, region // listHandleResponse handles the List response. func (client *ResourcePoolsClient) listHandleResponse(resp *http.Response) (ResourcePoolsClientListResponse, error) { - result := ResourcePoolsClientListResponse{RawResponse: resp} + result := ResourcePoolsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ResourcePoolsListResponse); err != nil { return ResourcePoolsClientListResponse{}, err } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_response_types.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_response_types.go index ff0e30178516..4868a18e77a2 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_response_types.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,258 +8,78 @@ package armvmwarecloudsimple -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - // CustomizationPoliciesClientGetResponse contains the response from method CustomizationPoliciesClient.Get. type CustomizationPoliciesClientGetResponse struct { - CustomizationPoliciesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CustomizationPoliciesClientGetResult contains the result from method CustomizationPoliciesClient.Get. -type CustomizationPoliciesClientGetResult struct { CustomizationPolicy } // CustomizationPoliciesClientListResponse contains the response from method CustomizationPoliciesClient.List. type CustomizationPoliciesClientListResponse struct { - CustomizationPoliciesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CustomizationPoliciesClientListResult contains the result from method CustomizationPoliciesClient.List. -type CustomizationPoliciesClientListResult struct { CustomizationPoliciesListResponse } -// DedicatedCloudNodesClientCreateOrUpdatePollerResponse contains the response from method DedicatedCloudNodesClient.CreateOrUpdate. -type DedicatedCloudNodesClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *DedicatedCloudNodesClientCreateOrUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l DedicatedCloudNodesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DedicatedCloudNodesClientCreateOrUpdateResponse, error) { - respType := DedicatedCloudNodesClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DedicatedCloudNode) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a DedicatedCloudNodesClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *DedicatedCloudNodesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DedicatedCloudNodesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("DedicatedCloudNodesClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &DedicatedCloudNodesClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // DedicatedCloudNodesClientCreateOrUpdateResponse contains the response from method DedicatedCloudNodesClient.CreateOrUpdate. type DedicatedCloudNodesClientCreateOrUpdateResponse struct { - DedicatedCloudNodesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// DedicatedCloudNodesClientCreateOrUpdateResult contains the result from method DedicatedCloudNodesClient.CreateOrUpdate. -type DedicatedCloudNodesClientCreateOrUpdateResult struct { DedicatedCloudNode } // DedicatedCloudNodesClientDeleteResponse contains the response from method DedicatedCloudNodesClient.Delete. type DedicatedCloudNodesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // DedicatedCloudNodesClientGetResponse contains the response from method DedicatedCloudNodesClient.Get. type DedicatedCloudNodesClientGetResponse struct { - DedicatedCloudNodesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// DedicatedCloudNodesClientGetResult contains the result from method DedicatedCloudNodesClient.Get. -type DedicatedCloudNodesClientGetResult struct { DedicatedCloudNode } // DedicatedCloudNodesClientListByResourceGroupResponse contains the response from method DedicatedCloudNodesClient.ListByResourceGroup. type DedicatedCloudNodesClientListByResourceGroupResponse struct { - DedicatedCloudNodesClientListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// DedicatedCloudNodesClientListByResourceGroupResult contains the result from method DedicatedCloudNodesClient.ListByResourceGroup. -type DedicatedCloudNodesClientListByResourceGroupResult struct { DedicatedCloudNodeListResponse } // DedicatedCloudNodesClientListBySubscriptionResponse contains the response from method DedicatedCloudNodesClient.ListBySubscription. type DedicatedCloudNodesClientListBySubscriptionResponse struct { - DedicatedCloudNodesClientListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// DedicatedCloudNodesClientListBySubscriptionResult contains the result from method DedicatedCloudNodesClient.ListBySubscription. -type DedicatedCloudNodesClientListBySubscriptionResult struct { DedicatedCloudNodeListResponse } // DedicatedCloudNodesClientUpdateResponse contains the response from method DedicatedCloudNodesClient.Update. type DedicatedCloudNodesClientUpdateResponse struct { - DedicatedCloudNodesClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// DedicatedCloudNodesClientUpdateResult contains the result from method DedicatedCloudNodesClient.Update. -type DedicatedCloudNodesClientUpdateResult struct { DedicatedCloudNode } // DedicatedCloudServicesClientCreateOrUpdateResponse contains the response from method DedicatedCloudServicesClient.CreateOrUpdate. type DedicatedCloudServicesClientCreateOrUpdateResponse struct { - DedicatedCloudServicesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// DedicatedCloudServicesClientCreateOrUpdateResult contains the result from method DedicatedCloudServicesClient.CreateOrUpdate. -type DedicatedCloudServicesClientCreateOrUpdateResult struct { DedicatedCloudService } -// DedicatedCloudServicesClientDeletePollerResponse contains the response from method DedicatedCloudServicesClient.Delete. -type DedicatedCloudServicesClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *DedicatedCloudServicesClientDeletePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l DedicatedCloudServicesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DedicatedCloudServicesClientDeleteResponse, error) { - respType := DedicatedCloudServicesClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a DedicatedCloudServicesClientDeletePollerResponse from the provided client and resume token. -func (l *DedicatedCloudServicesClientDeletePollerResponse) Resume(ctx context.Context, client *DedicatedCloudServicesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("DedicatedCloudServicesClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &DedicatedCloudServicesClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // DedicatedCloudServicesClientDeleteResponse contains the response from method DedicatedCloudServicesClient.Delete. type DedicatedCloudServicesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // DedicatedCloudServicesClientGetResponse contains the response from method DedicatedCloudServicesClient.Get. type DedicatedCloudServicesClientGetResponse struct { - DedicatedCloudServicesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// DedicatedCloudServicesClientGetResult contains the result from method DedicatedCloudServicesClient.Get. -type DedicatedCloudServicesClientGetResult struct { DedicatedCloudService } // DedicatedCloudServicesClientListByResourceGroupResponse contains the response from method DedicatedCloudServicesClient.ListByResourceGroup. type DedicatedCloudServicesClientListByResourceGroupResponse struct { - DedicatedCloudServicesClientListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// DedicatedCloudServicesClientListByResourceGroupResult contains the result from method DedicatedCloudServicesClient.ListByResourceGroup. -type DedicatedCloudServicesClientListByResourceGroupResult struct { DedicatedCloudServiceListResponse } // DedicatedCloudServicesClientListBySubscriptionResponse contains the response from method DedicatedCloudServicesClient.ListBySubscription. type DedicatedCloudServicesClientListBySubscriptionResponse struct { - DedicatedCloudServicesClientListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// DedicatedCloudServicesClientListBySubscriptionResult contains the result from method DedicatedCloudServicesClient.ListBySubscription. -type DedicatedCloudServicesClientListBySubscriptionResult struct { DedicatedCloudServiceListResponse } // DedicatedCloudServicesClientUpdateResponse contains the response from method DedicatedCloudServicesClient.Update. type DedicatedCloudServicesClientUpdateResponse struct { - DedicatedCloudServicesClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// DedicatedCloudServicesClientUpdateResult contains the result from method DedicatedCloudServicesClient.Update. -type DedicatedCloudServicesClientUpdateResult struct { DedicatedCloudService } // OperationsClientGetResponse contains the response from method OperationsClient.Get. type OperationsClientGetResponse struct { - OperationsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientGetResult contains the result from method OperationsClient.Get. -type OperationsClientGetResult struct { OperationResource // Location contains the information returned from the Location header response. Location *string @@ -270,410 +90,95 @@ type OperationsClientGetResult struct { // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { AvailableOperationsListResponse } // PrivateCloudsClientGetResponse contains the response from method PrivateCloudsClient.Get. type PrivateCloudsClientGetResponse struct { - PrivateCloudsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateCloudsClientGetResult contains the result from method PrivateCloudsClient.Get. -type PrivateCloudsClientGetResult struct { PrivateCloud } // PrivateCloudsClientListResponse contains the response from method PrivateCloudsClient.List. type PrivateCloudsClientListResponse struct { - PrivateCloudsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateCloudsClientListResult contains the result from method PrivateCloudsClient.List. -type PrivateCloudsClientListResult struct { PrivateCloudList } // ResourcePoolsClientGetResponse contains the response from method ResourcePoolsClient.Get. type ResourcePoolsClientGetResponse struct { - ResourcePoolsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourcePoolsClientGetResult contains the result from method ResourcePoolsClient.Get. -type ResourcePoolsClientGetResult struct { ResourcePool } // ResourcePoolsClientListResponse contains the response from method ResourcePoolsClient.List. type ResourcePoolsClientListResponse struct { - ResourcePoolsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourcePoolsClientListResult contains the result from method ResourcePoolsClient.List. -type ResourcePoolsClientListResult struct { ResourcePoolsListResponse } // SKUsAvailabilityClientListResponse contains the response from method SKUsAvailabilityClient.List. type SKUsAvailabilityClientListResponse struct { - SKUsAvailabilityClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// SKUsAvailabilityClientListResult contains the result from method SKUsAvailabilityClient.List. -type SKUsAvailabilityClientListResult struct { SKUAvailabilityListResponse } // UsagesClientListResponse contains the response from method UsagesClient.List. type UsagesClientListResponse struct { - UsagesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// UsagesClientListResult contains the result from method UsagesClient.List. -type UsagesClientListResult struct { UsageListResponse } // VirtualMachineTemplatesClientGetResponse contains the response from method VirtualMachineTemplatesClient.Get. type VirtualMachineTemplatesClientGetResponse struct { - VirtualMachineTemplatesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachineTemplatesClientGetResult contains the result from method VirtualMachineTemplatesClient.Get. -type VirtualMachineTemplatesClientGetResult struct { VirtualMachineTemplate } // VirtualMachineTemplatesClientListResponse contains the response from method VirtualMachineTemplatesClient.List. type VirtualMachineTemplatesClientListResponse struct { - VirtualMachineTemplatesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachineTemplatesClientListResult contains the result from method VirtualMachineTemplatesClient.List. -type VirtualMachineTemplatesClientListResult struct { VirtualMachineTemplateListResponse } -// VirtualMachinesClientCreateOrUpdatePollerResponse contains the response from method VirtualMachinesClient.CreateOrUpdate. -type VirtualMachinesClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *VirtualMachinesClientCreateOrUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l VirtualMachinesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesClientCreateOrUpdateResponse, error) { - respType := VirtualMachinesClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachine) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VirtualMachinesClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *VirtualMachinesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &VirtualMachinesClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // VirtualMachinesClientCreateOrUpdateResponse contains the response from method VirtualMachinesClient.CreateOrUpdate. type VirtualMachinesClientCreateOrUpdateResponse struct { - VirtualMachinesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachinesClientCreateOrUpdateResult contains the result from method VirtualMachinesClient.CreateOrUpdate. -type VirtualMachinesClientCreateOrUpdateResult struct { VirtualMachine } -// VirtualMachinesClientDeletePollerResponse contains the response from method VirtualMachinesClient.Delete. -type VirtualMachinesClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *VirtualMachinesClientDeletePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l VirtualMachinesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesClientDeleteResponse, error) { - respType := VirtualMachinesClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VirtualMachinesClientDeletePollerResponse from the provided client and resume token. -func (l *VirtualMachinesClientDeletePollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &VirtualMachinesClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // VirtualMachinesClientDeleteResponse contains the response from method VirtualMachinesClient.Delete. type VirtualMachinesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // VirtualMachinesClientGetResponse contains the response from method VirtualMachinesClient.Get. type VirtualMachinesClientGetResponse struct { - VirtualMachinesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachinesClientGetResult contains the result from method VirtualMachinesClient.Get. -type VirtualMachinesClientGetResult struct { VirtualMachine } // VirtualMachinesClientListByResourceGroupResponse contains the response from method VirtualMachinesClient.ListByResourceGroup. type VirtualMachinesClientListByResourceGroupResponse struct { - VirtualMachinesClientListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachinesClientListByResourceGroupResult contains the result from method VirtualMachinesClient.ListByResourceGroup. -type VirtualMachinesClientListByResourceGroupResult struct { VirtualMachineListResponse } // VirtualMachinesClientListBySubscriptionResponse contains the response from method VirtualMachinesClient.ListBySubscription. type VirtualMachinesClientListBySubscriptionResponse struct { - VirtualMachinesClientListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachinesClientListBySubscriptionResult contains the result from method VirtualMachinesClient.ListBySubscription. -type VirtualMachinesClientListBySubscriptionResult struct { VirtualMachineListResponse } -// VirtualMachinesClientStartPollerResponse contains the response from method VirtualMachinesClient.Start. -type VirtualMachinesClientStartPollerResponse struct { - // Poller contains an initialized poller. - Poller *VirtualMachinesClientStartPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l VirtualMachinesClientStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesClientStartResponse, error) { - respType := VirtualMachinesClientStartResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VirtualMachinesClientStartPollerResponse from the provided client and resume token. -func (l *VirtualMachinesClientStartPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.Start", token, client.pl) - if err != nil { - return err - } - poller := &VirtualMachinesClientStartPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // VirtualMachinesClientStartResponse contains the response from method VirtualMachinesClient.Start. type VirtualMachinesClientStartResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachinesClientStopPollerResponse contains the response from method VirtualMachinesClient.Stop. -type VirtualMachinesClientStopPollerResponse struct { - // Poller contains an initialized poller. - Poller *VirtualMachinesClientStopPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l VirtualMachinesClientStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesClientStopResponse, error) { - respType := VirtualMachinesClientStopResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VirtualMachinesClientStopPollerResponse from the provided client and resume token. -func (l *VirtualMachinesClientStopPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.Stop", token, client.pl) - if err != nil { - return err - } - poller := &VirtualMachinesClientStopPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // VirtualMachinesClientStopResponse contains the response from method VirtualMachinesClient.Stop. type VirtualMachinesClientStopResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachinesClientUpdatePollerResponse contains the response from method VirtualMachinesClient.Update. -type VirtualMachinesClientUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *VirtualMachinesClientUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l VirtualMachinesClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesClientUpdateResponse, error) { - respType := VirtualMachinesClientUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachine) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a VirtualMachinesClientUpdatePollerResponse from the provided client and resume token. -func (l *VirtualMachinesClientUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.Update", token, client.pl) - if err != nil { - return err - } - poller := &VirtualMachinesClientUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // VirtualMachinesClientUpdateResponse contains the response from method VirtualMachinesClient.Update. type VirtualMachinesClientUpdateResponse struct { - VirtualMachinesClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualMachinesClientUpdateResult contains the result from method VirtualMachinesClient.Update. -type VirtualMachinesClientUpdateResult struct { VirtualMachine } // VirtualNetworksClientGetResponse contains the response from method VirtualNetworksClient.Get. type VirtualNetworksClientGetResponse struct { - VirtualNetworksClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualNetworksClientGetResult contains the result from method VirtualNetworksClient.Get. -type VirtualNetworksClientGetResult struct { VirtualNetwork } // VirtualNetworksClientListResponse contains the response from method VirtualNetworksClient.List. type VirtualNetworksClientListResponse struct { - VirtualNetworksClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// VirtualNetworksClientListResult contains the result from method VirtualNetworksClient.List. -type VirtualNetworksClientListResult struct { VirtualNetworkListResponse } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_skusavailability_client.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_skusavailability_client.go index f265f1314adc..3fa30bafd0d9 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_skusavailability_client.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_skusavailability_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,36 +34,56 @@ type SKUsAvailabilityClient struct { // subscriptionID - The subscription ID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewSKUsAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SKUsAvailabilityClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewSKUsAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SKUsAvailabilityClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &SKUsAvailabilityClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Returns list of available resources in region // If the operation fails it returns an *azcore.ResponseError type. // regionID - The region Id (westus, eastus) // options - SKUsAvailabilityClientListOptions contains the optional parameters for the SKUsAvailabilityClient.List method. -func (client *SKUsAvailabilityClient) List(regionID string, options *SKUsAvailabilityClientListOptions) *SKUsAvailabilityClientListPager { - return &SKUsAvailabilityClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, regionID, options) +func (client *SKUsAvailabilityClient) List(regionID string, options *SKUsAvailabilityClientListOptions) *runtime.Pager[SKUsAvailabilityClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[SKUsAvailabilityClientListResponse]{ + More: func(page SKUsAvailabilityClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp SKUsAvailabilityClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.SKUAvailabilityListResponse.NextLink) + Fetcher: func(ctx context.Context, page *SKUsAvailabilityClientListResponse) (SKUsAvailabilityClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, regionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SKUsAvailabilityClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SKUsAvailabilityClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SKUsAvailabilityClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -92,7 +113,7 @@ func (client *SKUsAvailabilityClient) listCreateRequest(ctx context.Context, reg // listHandleResponse handles the List response. func (client *SKUsAvailabilityClient) listHandleResponse(resp *http.Response) (SKUsAvailabilityClientListResponse, error) { - result := SKUsAvailabilityClientListResponse{RawResponse: resp} + result := SKUsAvailabilityClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SKUAvailabilityListResponse); err != nil { return SKUsAvailabilityClientListResponse{}, err } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_time_rfc3339.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_time_rfc3339.go index da6d9090e261..e382f2905411 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_usages_client.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_usages_client.go index 23884da82c43..12b5af98c76e 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_usages_client.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_usages_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,36 +34,56 @@ type UsagesClient struct { // subscriptionID - The subscription ID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UsagesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &UsagesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Returns list of usage in region // If the operation fails it returns an *azcore.ResponseError type. // regionID - The region Id (westus, eastus) // options - UsagesClientListOptions contains the optional parameters for the UsagesClient.List method. -func (client *UsagesClient) List(regionID string, options *UsagesClientListOptions) *UsagesClientListPager { - return &UsagesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, regionID, options) +func (client *UsagesClient) List(regionID string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[UsagesClientListResponse]{ + More: func(page UsagesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp UsagesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.UsageListResponse.NextLink) + Fetcher: func(ctx context.Context, page *UsagesClientListResponse) (UsagesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, regionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return UsagesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UsagesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UsagesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -92,7 +113,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, regionID stri // listHandleResponse handles the List response. func (client *UsagesClient) listHandleResponse(resp *http.Response) (UsagesClientListResponse, error) { - result := UsagesClientListResponse{RawResponse: resp} + result := UsagesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.UsageListResponse); err != nil { return UsagesClientListResponse{}, err } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_virtualmachines_client.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_virtualmachines_client.go index 3954665db27a..84fd161df856 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_virtualmachines_client.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_virtualmachines_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,61 +28,57 @@ import ( type VirtualMachinesClient struct { host string subscriptionID string - referer string pl runtime.Pipeline } // NewVirtualMachinesClient creates a new instance of VirtualMachinesClient with the specified values. // subscriptionID - The subscription ID. -// referer - referer url // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewVirtualMachinesClient(subscriptionID string, referer string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachinesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewVirtualMachinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachinesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &VirtualMachinesClient{ subscriptionID: subscriptionID, - referer: referer, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Create Or Update Virtual Machine // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group +// referer - referer url // virtualMachineName - virtual machine name // virtualMachineRequest - Create or Update Virtual Machine request // options - VirtualMachinesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachinesClient.BeginCreateOrUpdate // method. -func (client *VirtualMachinesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (VirtualMachinesClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualMachineName, virtualMachineRequest, options) - if err != nil { - return VirtualMachinesClientCreateOrUpdatePollerResponse{}, err - } - result := VirtualMachinesClientCreateOrUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("VirtualMachinesClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return VirtualMachinesClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &VirtualMachinesClientCreateOrUpdatePoller{ - pt: pt, +func (client *VirtualMachinesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, referer string, virtualMachineName string, virtualMachineRequest VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*armruntime.Poller[VirtualMachinesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, referer, virtualMachineName, virtualMachineRequest, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[VirtualMachinesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[VirtualMachinesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // CreateOrUpdate - Create Or Update Virtual Machine // If the operation fails it returns an *azcore.ResponseError type. -func (client *VirtualMachinesClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualMachineName, virtualMachineRequest, options) +func (client *VirtualMachinesClient) createOrUpdate(ctx context.Context, resourceGroupName string, referer string, virtualMachineName string, virtualMachineRequest VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, referer, virtualMachineName, virtualMachineRequest, options) if err != nil { return nil, err } @@ -96,7 +93,7 @@ func (client *VirtualMachinesClient) createOrUpdate(ctx context.Context, resourc } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, referer string, virtualMachineName string, virtualMachineRequest VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -117,7 +114,7 @@ func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Con reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-04-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Referer", client.referer) + req.Raw().Header.Set("Referer", referer) req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, virtualMachineRequest) } @@ -125,31 +122,26 @@ func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - Delete virtual machine // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group +// referer - referer url // virtualMachineName - virtual machine name // options - VirtualMachinesClientBeginDeleteOptions contains the optional parameters for the VirtualMachinesClient.BeginDelete // method. -func (client *VirtualMachinesClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginDeleteOptions) (VirtualMachinesClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, virtualMachineName, options) - if err != nil { - return VirtualMachinesClientDeletePollerResponse{}, err - } - result := VirtualMachinesClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("VirtualMachinesClient.Delete", "", resp, client.pl) - if err != nil { - return VirtualMachinesClientDeletePollerResponse{}, err - } - result.Poller = &VirtualMachinesClientDeletePoller{ - pt: pt, +func (client *VirtualMachinesClient) BeginDelete(ctx context.Context, resourceGroupName string, referer string, virtualMachineName string, options *VirtualMachinesClientBeginDeleteOptions) (*armruntime.Poller[VirtualMachinesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, referer, virtualMachineName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[VirtualMachinesClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[VirtualMachinesClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - Delete virtual machine // If the operation fails it returns an *azcore.ResponseError type. -func (client *VirtualMachinesClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualMachineName, options) +func (client *VirtualMachinesClient) deleteOperation(ctx context.Context, resourceGroupName string, referer string, virtualMachineName string, options *VirtualMachinesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, referer, virtualMachineName, options) if err != nil { return nil, err } @@ -164,7 +156,7 @@ func (client *VirtualMachinesClient) deleteOperation(ctx context.Context, resour } // deleteCreateRequest creates the Delete request. -func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, referer string, virtualMachineName string, options *VirtualMachinesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -185,7 +177,7 @@ func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, re reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-04-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Referer", client.referer) + req.Raw().Header.Set("Referer", referer) req.Raw().Header.Set("Accept", "application/json") return req, nil } @@ -238,7 +230,7 @@ func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resou // getHandleResponse handles the Get response. func (client *VirtualMachinesClient) getHandleResponse(resp *http.Response) (VirtualMachinesClientGetResponse, error) { - result := VirtualMachinesClientGetResponse{RawResponse: resp} + result := VirtualMachinesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachine); err != nil { return VirtualMachinesClientGetResponse{}, err } @@ -250,16 +242,32 @@ func (client *VirtualMachinesClient) getHandleResponse(resp *http.Response) (Vir // resourceGroupName - The name of the resource group // options - VirtualMachinesClientListByResourceGroupOptions contains the optional parameters for the VirtualMachinesClient.ListByResourceGroup // method. -func (client *VirtualMachinesClient) ListByResourceGroup(resourceGroupName string, options *VirtualMachinesClientListByResourceGroupOptions) *VirtualMachinesClientListByResourceGroupPager { - return &VirtualMachinesClientListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) +func (client *VirtualMachinesClient) ListByResourceGroup(resourceGroupName string, options *VirtualMachinesClientListByResourceGroupOptions) *runtime.Pager[VirtualMachinesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[VirtualMachinesClientListByResourceGroupResponse]{ + More: func(page VirtualMachinesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp VirtualMachinesClientListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineListResponse.NextLink) + Fetcher: func(ctx context.Context, page *VirtualMachinesClientListByResourceGroupResponse) (VirtualMachinesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachinesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachinesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) }, - } + }) } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. @@ -295,7 +303,7 @@ func (client *VirtualMachinesClient) listByResourceGroupCreateRequest(ctx contex // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *VirtualMachinesClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualMachinesClientListByResourceGroupResponse, error) { - result := VirtualMachinesClientListByResourceGroupResponse{RawResponse: resp} + result := VirtualMachinesClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineListResponse); err != nil { return VirtualMachinesClientListByResourceGroupResponse{}, err } @@ -306,16 +314,32 @@ func (client *VirtualMachinesClient) listByResourceGroupHandleResponse(resp *htt // If the operation fails it returns an *azcore.ResponseError type. // options - VirtualMachinesClientListBySubscriptionOptions contains the optional parameters for the VirtualMachinesClient.ListBySubscription // method. -func (client *VirtualMachinesClient) ListBySubscription(options *VirtualMachinesClientListBySubscriptionOptions) *VirtualMachinesClientListBySubscriptionPager { - return &VirtualMachinesClientListBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) +func (client *VirtualMachinesClient) ListBySubscription(options *VirtualMachinesClientListBySubscriptionOptions) *runtime.Pager[VirtualMachinesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[VirtualMachinesClientListBySubscriptionResponse]{ + More: func(page VirtualMachinesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp VirtualMachinesClientListBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineListResponse.NextLink) + Fetcher: func(ctx context.Context, page *VirtualMachinesClientListBySubscriptionResponse) (VirtualMachinesClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachinesClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachinesClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) }, - } + }) } // listBySubscriptionCreateRequest creates the ListBySubscription request. @@ -347,7 +371,7 @@ func (client *VirtualMachinesClient) listBySubscriptionCreateRequest(ctx context // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *VirtualMachinesClient) listBySubscriptionHandleResponse(resp *http.Response) (VirtualMachinesClientListBySubscriptionResponse, error) { - result := VirtualMachinesClientListBySubscriptionResponse{RawResponse: resp} + result := VirtualMachinesClientListBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineListResponse); err != nil { return VirtualMachinesClientListBySubscriptionResponse{}, err } @@ -357,31 +381,26 @@ func (client *VirtualMachinesClient) listBySubscriptionHandleResponse(resp *http // BeginStart - Power on virtual machine // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group +// referer - referer url // virtualMachineName - virtual machine name // options - VirtualMachinesClientBeginStartOptions contains the optional parameters for the VirtualMachinesClient.BeginStart // method. -func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginStartOptions) (VirtualMachinesClientStartPollerResponse, error) { - resp, err := client.start(ctx, resourceGroupName, virtualMachineName, options) - if err != nil { - return VirtualMachinesClientStartPollerResponse{}, err - } - result := VirtualMachinesClientStartPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("VirtualMachinesClient.Start", "", resp, client.pl) - if err != nil { - return VirtualMachinesClientStartPollerResponse{}, err +func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGroupName string, referer string, virtualMachineName string, options *VirtualMachinesClientBeginStartOptions) (*armruntime.Poller[VirtualMachinesClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, referer, virtualMachineName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[VirtualMachinesClientStartResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[VirtualMachinesClientStartResponse](options.ResumeToken, client.pl, nil) } - result.Poller = &VirtualMachinesClientStartPoller{ - pt: pt, - } - return result, nil } // Start - Power on virtual machine // If the operation fails it returns an *azcore.ResponseError type. -func (client *VirtualMachinesClient) start(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginStartOptions) (*http.Response, error) { - req, err := client.startCreateRequest(ctx, resourceGroupName, virtualMachineName, options) +func (client *VirtualMachinesClient) start(ctx context.Context, resourceGroupName string, referer string, virtualMachineName string, options *VirtualMachinesClientBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, referer, virtualMachineName, options) if err != nil { return nil, err } @@ -396,7 +415,7 @@ func (client *VirtualMachinesClient) start(ctx context.Context, resourceGroupNam } // startCreateRequest creates the Start request. -func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginStartOptions) (*policy.Request, error) { +func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, resourceGroupName string, referer string, virtualMachineName string, options *VirtualMachinesClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}/start" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -417,7 +436,7 @@ func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, res reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-04-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Referer", client.referer) + req.Raw().Header.Set("Referer", referer) req.Raw().Header.Set("Accept", "application/json") return req, nil } @@ -425,31 +444,26 @@ func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, res // BeginStop - Power off virtual machine, options: shutdown, poweroff, and suspend // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group +// referer - referer url // virtualMachineName - virtual machine name // options - VirtualMachinesClientBeginStopOptions contains the optional parameters for the VirtualMachinesClient.BeginStop // method. -func (client *VirtualMachinesClient) BeginStop(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginStopOptions) (VirtualMachinesClientStopPollerResponse, error) { - resp, err := client.stop(ctx, resourceGroupName, virtualMachineName, options) - if err != nil { - return VirtualMachinesClientStopPollerResponse{}, err - } - result := VirtualMachinesClientStopPollerResponse{ - RawResponse: resp, +func (client *VirtualMachinesClient) BeginStop(ctx context.Context, resourceGroupName string, referer string, virtualMachineName string, options *VirtualMachinesClientBeginStopOptions) (*armruntime.Poller[VirtualMachinesClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, referer, virtualMachineName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[VirtualMachinesClientStopResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[VirtualMachinesClientStopResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("VirtualMachinesClient.Stop", "", resp, client.pl) - if err != nil { - return VirtualMachinesClientStopPollerResponse{}, err - } - result.Poller = &VirtualMachinesClientStopPoller{ - pt: pt, - } - return result, nil } // Stop - Power off virtual machine, options: shutdown, poweroff, and suspend // If the operation fails it returns an *azcore.ResponseError type. -func (client *VirtualMachinesClient) stop(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginStopOptions) (*http.Response, error) { - req, err := client.stopCreateRequest(ctx, resourceGroupName, virtualMachineName, options) +func (client *VirtualMachinesClient) stop(ctx context.Context, resourceGroupName string, referer string, virtualMachineName string, options *VirtualMachinesClientBeginStopOptions) (*http.Response, error) { + req, err := client.stopCreateRequest(ctx, resourceGroupName, referer, virtualMachineName, options) if err != nil { return nil, err } @@ -464,7 +478,7 @@ func (client *VirtualMachinesClient) stop(ctx context.Context, resourceGroupName } // stopCreateRequest creates the Stop request. -func (client *VirtualMachinesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *VirtualMachinesClientBeginStopOptions) (*policy.Request, error) { +func (client *VirtualMachinesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, referer string, virtualMachineName string, options *VirtualMachinesClientBeginStopOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VMwareCloudSimple/virtualMachines/{virtualMachineName}/stop" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -488,7 +502,7 @@ func (client *VirtualMachinesClient) stopCreateRequest(ctx context.Context, reso } reqQP.Set("api-version", "2019-04-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Referer", client.referer) + req.Raw().Header.Set("Referer", referer) req.Raw().Header.Set("Accept", "application/json") if options != nil && options.M != nil { return req, runtime.MarshalAsJSON(req, *options.M) @@ -503,22 +517,16 @@ func (client *VirtualMachinesClient) stopCreateRequest(ctx context.Context, reso // virtualMachineRequest - Patch virtual machine request // options - VirtualMachinesClientBeginUpdateOptions contains the optional parameters for the VirtualMachinesClient.BeginUpdate // method. -func (client *VirtualMachinesClient) BeginUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest PatchPayload, options *VirtualMachinesClientBeginUpdateOptions) (VirtualMachinesClientUpdatePollerResponse, error) { - resp, err := client.update(ctx, resourceGroupName, virtualMachineName, virtualMachineRequest, options) - if err != nil { - return VirtualMachinesClientUpdatePollerResponse{}, err +func (client *VirtualMachinesClient) BeginUpdate(ctx context.Context, resourceGroupName string, virtualMachineName string, virtualMachineRequest PatchPayload, options *VirtualMachinesClientBeginUpdateOptions) (*armruntime.Poller[VirtualMachinesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, virtualMachineName, virtualMachineRequest, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[VirtualMachinesClientUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[VirtualMachinesClientUpdateResponse](options.ResumeToken, client.pl, nil) } - result := VirtualMachinesClientUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("VirtualMachinesClient.Update", "", resp, client.pl) - if err != nil { - return VirtualMachinesClientUpdatePollerResponse{}, err - } - result.Poller = &VirtualMachinesClientUpdatePoller{ - pt: pt, - } - return result, nil } // Update - Patch virtual machine properties diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_virtualmachinetemplates_client.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_virtualmachinetemplates_client.go index 04ca22462f14..b8638244a922 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_virtualmachinetemplates_client.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_virtualmachinetemplates_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type VirtualMachineTemplatesClient struct { // subscriptionID - The subscription ID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewVirtualMachineTemplatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineTemplatesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewVirtualMachineTemplatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineTemplatesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &VirtualMachineTemplatesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Returns virtual machine templates by its name @@ -103,7 +108,7 @@ func (client *VirtualMachineTemplatesClient) getCreateRequest(ctx context.Contex // getHandleResponse handles the Get response. func (client *VirtualMachineTemplatesClient) getHandleResponse(resp *http.Response) (VirtualMachineTemplatesClientGetResponse, error) { - result := VirtualMachineTemplatesClientGetResponse{RawResponse: resp} + result := VirtualMachineTemplatesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineTemplate); err != nil { return VirtualMachineTemplatesClientGetResponse{}, err } @@ -117,16 +122,32 @@ func (client *VirtualMachineTemplatesClient) getHandleResponse(resp *http.Respon // resourcePoolName - Resource pool used to derive vSphere cluster which contains VM templates // options - VirtualMachineTemplatesClientListOptions contains the optional parameters for the VirtualMachineTemplatesClient.List // method. -func (client *VirtualMachineTemplatesClient) List(pcName string, regionID string, resourcePoolName string, options *VirtualMachineTemplatesClientListOptions) *VirtualMachineTemplatesClientListPager { - return &VirtualMachineTemplatesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, pcName, regionID, resourcePoolName, options) +func (client *VirtualMachineTemplatesClient) List(pcName string, regionID string, resourcePoolName string, options *VirtualMachineTemplatesClientListOptions) *runtime.Pager[VirtualMachineTemplatesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[VirtualMachineTemplatesClientListResponse]{ + More: func(page VirtualMachineTemplatesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp VirtualMachineTemplatesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineTemplateListResponse.NextLink) + Fetcher: func(ctx context.Context, page *VirtualMachineTemplatesClientListResponse) (VirtualMachineTemplatesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, pcName, regionID, resourcePoolName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineTemplatesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineTemplatesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineTemplatesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -158,7 +179,7 @@ func (client *VirtualMachineTemplatesClient) listCreateRequest(ctx context.Conte // listHandleResponse handles the List response. func (client *VirtualMachineTemplatesClient) listHandleResponse(resp *http.Response) (VirtualMachineTemplatesClientListResponse, error) { - result := VirtualMachineTemplatesClientListResponse{RawResponse: resp} + result := VirtualMachineTemplatesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineTemplateListResponse); err != nil { return VirtualMachineTemplatesClientListResponse{}, err } diff --git a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_virtualnetworks_client.go b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_virtualnetworks_client.go index 40da6b9204b8..03fde1087520 100644 --- a/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_virtualnetworks_client.go +++ b/sdk/resourcemanager/vmwarecloudsimple/armvmwarecloudsimple/zz_generated_virtualnetworks_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type VirtualNetworksClient struct { // subscriptionID - The subscription ID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewVirtualNetworksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworksClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewVirtualNetworksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworksClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &VirtualNetworksClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Return virtual network by its name @@ -102,7 +107,7 @@ func (client *VirtualNetworksClient) getCreateRequest(ctx context.Context, regio // getHandleResponse handles the Get response. func (client *VirtualNetworksClient) getHandleResponse(resp *http.Response) (VirtualNetworksClientGetResponse, error) { - result := VirtualNetworksClientGetResponse{RawResponse: resp} + result := VirtualNetworksClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetwork); err != nil { return VirtualNetworksClientGetResponse{}, err } @@ -115,16 +120,32 @@ func (client *VirtualNetworksClient) getHandleResponse(resp *http.Response) (Vir // pcName - The private cloud name // resourcePoolName - Resource pool used to derive vSphere cluster which contains virtual networks // options - VirtualNetworksClientListOptions contains the optional parameters for the VirtualNetworksClient.List method. -func (client *VirtualNetworksClient) List(regionID string, pcName string, resourcePoolName string, options *VirtualNetworksClientListOptions) *VirtualNetworksClientListPager { - return &VirtualNetworksClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, regionID, pcName, resourcePoolName, options) +func (client *VirtualNetworksClient) List(regionID string, pcName string, resourcePoolName string, options *VirtualNetworksClientListOptions) *runtime.Pager[VirtualNetworksClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[VirtualNetworksClientListResponse]{ + More: func(page VirtualNetworksClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp VirtualNetworksClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualNetworkListResponse.NextLink) + Fetcher: func(ctx context.Context, page *VirtualNetworksClientListResponse) (VirtualNetworksClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, regionID, pcName, resourcePoolName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualNetworksClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworksClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworksClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -156,7 +177,7 @@ func (client *VirtualNetworksClient) listCreateRequest(ctx context.Context, regi // listHandleResponse handles the List response. func (client *VirtualNetworksClient) listHandleResponse(resp *http.Response) (VirtualNetworksClientListResponse, error) { - result := VirtualNetworksClientListResponse{RawResponse: resp} + result := VirtualNetworksClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkListResponse); err != nil { return VirtualNetworksClientListResponse{}, err } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md b/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md index ed53855a5ed6..2340572d1190 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md @@ -1,5 +1,264 @@ # Release History +## 0.3.0 (2022-04-13) +### Breaking Changes + +- Function `*Client.BeginUpdate` return value(s) have been changed from `(ClientUpdatePollerResponse, error)` to `(*armruntime.Poller[ClientUpdateResponse], error)` +- Function `*SharedPrivateLinkResourcesClient.BeginDelete` return value(s) have been changed from `(SharedPrivateLinkResourcesClientDeletePollerResponse, error)` to `(*armruntime.Poller[SharedPrivateLinkResourcesClientDeleteResponse], error)` +- Function `*Client.BeginDelete` return value(s) have been changed from `(ClientDeletePollerResponse, error)` to `(*armruntime.Poller[ClientDeleteResponse], error)` +- Function `NewHubsClient` return value(s) have been changed from `(*HubsClient)` to `(*HubsClient, error)` +- Function `*PrivateEndpointConnectionsClient.BeginDelete` return value(s) have been changed from `(PrivateEndpointConnectionsClientDeletePollerResponse, error)` to `(*armruntime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error)` +- Function `*PrivateEndpointConnectionsClient.List` return value(s) have been changed from `(*PrivateEndpointConnectionsClientListPager)` to `(*runtime.Pager[PrivateEndpointConnectionsClientListResponse])` +- Function `*Client.BeginRestart` return value(s) have been changed from `(ClientRestartPollerResponse, error)` to `(*armruntime.Poller[ClientRestartResponse], error)` +- Function `NewPrivateLinkResourcesClient` return value(s) have been changed from `(*PrivateLinkResourcesClient)` to `(*PrivateLinkResourcesClient, error)` +- Function `*Client.ListByResourceGroup` return value(s) have been changed from `(*ClientListByResourceGroupPager)` to `(*runtime.Pager[ClientListByResourceGroupResponse])` +- Function `*Client.BeginRegenerateKey` return value(s) have been changed from `(ClientRegenerateKeyPollerResponse, error)` to `(*armruntime.Poller[ClientRegenerateKeyResponse], error)` +- Function `*PrivateLinkResourcesClient.List` return value(s) have been changed from `(*PrivateLinkResourcesClientListPager)` to `(*runtime.Pager[PrivateLinkResourcesClientListResponse])` +- Function `NewUsagesClient` return value(s) have been changed from `(*UsagesClient)` to `(*UsagesClient, error)` +- Function `NewPrivateEndpointConnectionsClient` return value(s) have been changed from `(*PrivateEndpointConnectionsClient)` to `(*PrivateEndpointConnectionsClient, error)` +- Function `*SharedPrivateLinkResourcesClient.BeginCreateOrUpdate` return value(s) have been changed from `(SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[SharedPrivateLinkResourcesClientCreateOrUpdateResponse], error)` +- Function `*UsagesClient.List` return value(s) have been changed from `(*UsagesClientListPager)` to `(*runtime.Pager[UsagesClientListResponse])` +- Function `NewClient` return value(s) have been changed from `(*Client)` to `(*Client, error)` +- Function `*Client.ListBySubscription` return value(s) have been changed from `(*ClientListBySubscriptionPager)` to `(*runtime.Pager[ClientListBySubscriptionResponse])` +- Function `*OperationsClient.List` return value(s) have been changed from `(*OperationsClientListPager)` to `(*runtime.Pager[OperationsClientListResponse])` +- Function `*HubsClient.BeginCreateOrUpdate` return value(s) have been changed from `(HubsClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[HubsClientCreateOrUpdateResponse], error)` +- Function `*SharedPrivateLinkResourcesClient.List` return value(s) have been changed from `(*SharedPrivateLinkResourcesClientListPager)` to `(*runtime.Pager[SharedPrivateLinkResourcesClientListResponse])` +- Function `*HubsClient.List` return value(s) have been changed from `(*HubsClientListPager)` to `(*runtime.Pager[HubsClientListResponse])` +- Function `*Client.BeginCreateOrUpdate` return value(s) have been changed from `(ClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[ClientCreateOrUpdateResponse], error)` +- Function `*HubsClient.BeginDelete` return value(s) have been changed from `(HubsClientDeletePollerResponse, error)` to `(*armruntime.Poller[HubsClientDeleteResponse], error)` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `NewSharedPrivateLinkResourcesClient` return value(s) have been changed from `(*SharedPrivateLinkResourcesClient)` to `(*SharedPrivateLinkResourcesClient, error)` +- Function `*HubsClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*SharedPrivateLinkResourcesClientListPager.PageResponse` has been removed +- Function `*ClientRegenerateKeyPollerResponse.Resume` has been removed +- Function `HubsClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*SharedPrivateLinkResourcesClientDeletePollerResponse.Resume` has been removed +- Function `ClientRegenerateKeyPollerResponse.PollUntilDone` has been removed +- Function `*ClientRegenerateKeyPoller.ResumeToken` has been removed +- Function `*OperationsClientListPager.PageResponse` has been removed +- Function `*HubsClientCreateOrUpdatePoller.Done` has been removed +- Function `*PrivateLinkResourcesClientListPager.Err` has been removed +- Function `*HubsClientDeletePoller.Poll` has been removed +- Function `*SharedPrivateLinkResourcesClientListPager.Err` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePoller.Done` has been removed +- Function `*ClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*ClientRegenerateKeyPoller.Done` has been removed +- Function `*UsagesClientListPager.PageResponse` has been removed +- Function `*PrivateLinkResourcesClientListPager.PageResponse` has been removed +- Function `*SharedPrivateLinkResourcesClientDeletePoller.FinalResponse` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePoller.FinalResponse` has been removed +- Function `*ClientListBySubscriptionPager.PageResponse` has been removed +- Function `WebPubSubSKUTier.ToPtr` has been removed +- Function `ScaleType.ToPtr` has been removed +- Function `*ClientListByResourceGroupPager.NextPage` has been removed +- Function `*ClientUpdatePollerResponse.Resume` has been removed +- Function `*UsagesClientListPager.NextPage` has been removed +- Function `CreatedByType.ToPtr` has been removed +- Function `ClientUpdatePollerResponse.PollUntilDone` has been removed +- Function `*ClientListByResourceGroupPager.PageResponse` has been removed +- Function `*ClientRestartPoller.FinalResponse` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePoller.ResumeToken` has been removed +- Function `*ClientListBySubscriptionPager.Err` has been removed +- Function `*ClientDeletePollerResponse.Resume` has been removed +- Function `*SharedPrivateLinkResourcesClientDeletePoller.ResumeToken` has been removed +- Function `*HubsClientCreateOrUpdatePoller.Poll` has been removed +- Function `*SharedPrivateLinkResourcesClientListPager.NextPage` has been removed +- Function `*SharedPrivateLinkResourcesClientDeletePoller.Poll` has been removed +- Function `*PrivateLinkResourcesClientListPager.NextPage` has been removed +- Function `PrivateEndpointConnectionsClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePollerResponse.Resume` has been removed +- Function `ProvisioningState.ToPtr` has been removed +- Function `*HubsClientDeletePoller.FinalResponse` has been removed +- Function `ACLAction.ToPtr` has been removed +- Function `*ClientListByResourceGroupPager.Err` has been removed +- Function `SharedPrivateLinkResourcesClientDeletePollerResponse.PollUntilDone` has been removed +- Function `WebPubSubRequestType.ToPtr` has been removed +- Function `*ClientDeletePoller.Done` has been removed +- Function `*HubsClientDeletePoller.Done` has been removed +- Function `SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*PrivateEndpointConnectionsClientListPager.NextPage` has been removed +- Function `*ClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*SharedPrivateLinkResourcesClientCreateOrUpdatePoller.Poll` has been removed +- Function `*HubsClientListPager.NextPage` has been removed +- Function `*HubsClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*HubsClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*HubsClientListPager.PageResponse` has been removed +- Function `ClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*OperationsClientListPager.Err` has been removed +- Function `*ClientDeletePoller.Poll` has been removed +- Function `PrivateLinkServiceConnectionStatus.ToPtr` has been removed +- Function `*ClientDeletePoller.FinalResponse` has been removed +- Function `SharedPrivateLinkResourceStatus.ToPtr` has been removed +- Function `*ClientRestartPoller.Poll` has been removed +- Function `*SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*ClientRegenerateKeyPoller.FinalResponse` has been removed +- Function `*ClientUpdatePoller.FinalResponse` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePoller.Poll` has been removed +- Function `*PrivateEndpointConnectionsClientListPager.PageResponse` has been removed +- Function `*HubsClientDeletePoller.ResumeToken` has been removed +- Function `*ClientRegenerateKeyPoller.Poll` has been removed +- Function `*ClientUpdatePoller.ResumeToken` has been removed +- Function `*HubsClientListPager.Err` has been removed +- Function `*UsagesClientListPager.Err` has been removed +- Function `ClientRestartPollerResponse.PollUntilDone` has been removed +- Function `*ClientRestartPoller.Done` has been removed +- Function `*ClientListBySubscriptionPager.NextPage` has been removed +- Function `*SharedPrivateLinkResourcesClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*ClientUpdatePoller.Poll` has been removed +- Function `*ClientRestartPollerResponse.Resume` has been removed +- Function `KeyType.ToPtr` has been removed +- Function `*HubsClientDeletePollerResponse.Resume` has been removed +- Function `*PrivateEndpointConnectionsClientListPager.Err` has been removed +- Function `*ClientCreateOrUpdatePoller.Poll` has been removed +- Function `*ClientRestartPoller.ResumeToken` has been removed +- Function `*ClientUpdatePoller.Done` has been removed +- Function `UpstreamAuthType.ToPtr` has been removed +- Function `*SharedPrivateLinkResourcesClientDeletePoller.Done` has been removed +- Function `*ClientDeletePoller.ResumeToken` has been removed +- Function `*SharedPrivateLinkResourcesClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*OperationsClientListPager.NextPage` has been removed +- Function `ManagedIdentityType.ToPtr` has been removed +- Function `ClientDeletePollerResponse.PollUntilDone` has been removed +- Function `HubsClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*ClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*SharedPrivateLinkResourcesClientCreateOrUpdatePoller.Done` has been removed +- Function `*ClientCreateOrUpdatePoller.Done` has been removed +- Struct `ClientCheckNameAvailabilityResult` has been removed +- Struct `ClientCreateOrUpdatePoller` has been removed +- Struct `ClientCreateOrUpdatePollerResponse` has been removed +- Struct `ClientCreateOrUpdateResult` has been removed +- Struct `ClientDeletePoller` has been removed +- Struct `ClientDeletePollerResponse` has been removed +- Struct `ClientGetResult` has been removed +- Struct `ClientListByResourceGroupPager` has been removed +- Struct `ClientListByResourceGroupResult` has been removed +- Struct `ClientListBySubscriptionPager` has been removed +- Struct `ClientListBySubscriptionResult` has been removed +- Struct `ClientListKeysResult` has been removed +- Struct `ClientListSKUsResult` has been removed +- Struct `ClientRegenerateKeyPoller` has been removed +- Struct `ClientRegenerateKeyPollerResponse` has been removed +- Struct `ClientRegenerateKeyResult` has been removed +- Struct `ClientRestartPoller` has been removed +- Struct `ClientRestartPollerResponse` has been removed +- Struct `ClientUpdatePoller` has been removed +- Struct `ClientUpdatePollerResponse` has been removed +- Struct `ClientUpdateResult` has been removed +- Struct `HubsClientCreateOrUpdatePoller` has been removed +- Struct `HubsClientCreateOrUpdatePollerResponse` has been removed +- Struct `HubsClientCreateOrUpdateResult` has been removed +- Struct `HubsClientDeletePoller` has been removed +- Struct `HubsClientDeletePollerResponse` has been removed +- Struct `HubsClientGetResult` has been removed +- Struct `HubsClientListPager` has been removed +- Struct `HubsClientListResult` has been removed +- Struct `OperationsClientListPager` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `PrivateEndpointConnectionsClientDeletePoller` has been removed +- Struct `PrivateEndpointConnectionsClientDeletePollerResponse` has been removed +- Struct `PrivateEndpointConnectionsClientGetResult` has been removed +- Struct `PrivateEndpointConnectionsClientListPager` has been removed +- Struct `PrivateEndpointConnectionsClientListResult` has been removed +- Struct `PrivateEndpointConnectionsClientUpdateResult` has been removed +- Struct `PrivateLinkResourcesClientListPager` has been removed +- Struct `PrivateLinkResourcesClientListResult` has been removed +- Struct `SharedPrivateLinkResourcesClientCreateOrUpdatePoller` has been removed +- Struct `SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse` has been removed +- Struct `SharedPrivateLinkResourcesClientCreateOrUpdateResult` has been removed +- Struct `SharedPrivateLinkResourcesClientDeletePoller` has been removed +- Struct `SharedPrivateLinkResourcesClientDeletePollerResponse` has been removed +- Struct `SharedPrivateLinkResourcesClientGetResult` has been removed +- Struct `SharedPrivateLinkResourcesClientListPager` has been removed +- Struct `SharedPrivateLinkResourcesClientListResult` has been removed +- Struct `UsagesClientListPager` has been removed +- Struct `UsagesClientListResult` has been removed +- Field `HubsClientGetResult` of struct `HubsClientGetResponse` has been removed +- Field `RawResponse` of struct `HubsClientGetResponse` has been removed +- Field `ClientCreateOrUpdateResult` of struct `ClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ClientCreateOrUpdateResponse` has been removed +- Field `UsagesClientListResult` of struct `UsagesClientListResponse` has been removed +- Field `RawResponse` of struct `UsagesClientListResponse` has been removed +- Field `SharedPrivateLinkResourcesClientCreateOrUpdateResult` of struct `SharedPrivateLinkResourcesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `SharedPrivateLinkResourcesClientCreateOrUpdateResponse` has been removed +- Field `ClientListSKUsResult` of struct `ClientListSKUsResponse` has been removed +- Field `RawResponse` of struct `ClientListSKUsResponse` has been removed +- Field `HubsClientListResult` of struct `HubsClientListResponse` has been removed +- Field `RawResponse` of struct `HubsClientListResponse` has been removed +- Field `ClientListByResourceGroupResult` of struct `ClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `ClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `HubsClientDeleteResponse` has been removed +- Field `RawResponse` of struct `ClientDeleteResponse` has been removed +- Field `ClientListKeysResult` of struct `ClientListKeysResponse` has been removed +- Field `RawResponse` of struct `ClientListKeysResponse` has been removed +- Field `ClientListBySubscriptionResult` of struct `ClientListBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `ClientListBySubscriptionResponse` has been removed +- Field `PrivateLinkResourcesClientListResult` of struct `PrivateLinkResourcesClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateLinkResourcesClientListResponse` has been removed +- Field `RawResponse` of struct `ClientRestartResponse` has been removed +- Field `ClientCheckNameAvailabilityResult` of struct `ClientCheckNameAvailabilityResponse` has been removed +- Field `RawResponse` of struct `ClientCheckNameAvailabilityResponse` has been removed +- Field `ClientRegenerateKeyResult` of struct `ClientRegenerateKeyResponse` has been removed +- Field `RawResponse` of struct `ClientRegenerateKeyResponse` has been removed +- Field `ClientUpdateResult` of struct `ClientUpdateResponse` has been removed +- Field `RawResponse` of struct `ClientUpdateResponse` has been removed +- Field `RawResponse` of struct `SharedPrivateLinkResourcesClientDeleteResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientDeleteResponse` has been removed +- Field `PrivateEndpointConnectionsClientUpdateResult` of struct `PrivateEndpointConnectionsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientUpdateResponse` has been removed +- Field `ClientGetResult` of struct `ClientGetResponse` has been removed +- Field `RawResponse` of struct `ClientGetResponse` has been removed +- Field `SharedPrivateLinkResourcesClientGetResult` of struct `SharedPrivateLinkResourcesClientGetResponse` has been removed +- Field `RawResponse` of struct `SharedPrivateLinkResourcesClientGetResponse` has been removed +- Field `SharedPrivateLinkResourcesClientListResult` of struct `SharedPrivateLinkResourcesClientListResponse` has been removed +- Field `RawResponse` of struct `SharedPrivateLinkResourcesClientListResponse` has been removed +- Field `PrivateEndpointConnectionsClientGetResult` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `PrivateEndpointConnectionsClientListResult` of struct `PrivateEndpointConnectionsClientListResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientListResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `HubsClientCreateOrUpdateResult` of struct `HubsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `HubsClientCreateOrUpdateResponse` has been removed + +### Features Added + +- New function `ErrorDetail.MarshalJSON() ([]byte, error)` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ErrorResponse` +- New field `ResumeToken` in struct `ClientBeginRegenerateKeyOptions` +- New anonymous field `SharedPrivateLinkResourceList` in struct `SharedPrivateLinkResourcesClientListResponse` +- New anonymous field `ResourceInfoList` in struct `ClientListBySubscriptionResponse` +- New anonymous field `ResourceInfoList` in struct `ClientListByResourceGroupResponse` +- New anonymous field `PrivateEndpointConnectionList` in struct `PrivateEndpointConnectionsClientListResponse` +- New anonymous field `HubList` in struct `HubsClientListResponse` +- New anonymous field `OperationList` in struct `OperationsClientListResponse` +- New anonymous field `Keys` in struct `ClientListKeysResponse` +- New anonymous field `Hub` in struct `HubsClientCreateOrUpdateResponse` +- New anonymous field `NameAvailability` in struct `ClientCheckNameAvailabilityResponse` +- New anonymous field `SKUList` in struct `ClientListSKUsResponse` +- New anonymous field `Keys` in struct `ClientRegenerateKeyResponse` +- New field `ResumeToken` in struct `ClientBeginRestartOptions` +- New anonymous field `ResourceInfo` in struct `ClientCreateOrUpdateResponse` +- New field `ResumeToken` in struct `HubsClientBeginCreateOrUpdateOptions` +- New anonymous field `SharedPrivateLinkResource` in struct `SharedPrivateLinkResourcesClientGetResponse` +- New field `ResumeToken` in struct `SharedPrivateLinkResourcesClientBeginDeleteOptions` +- New anonymous field `Hub` in struct `HubsClientGetResponse` +- New field `ResumeToken` in struct `ClientBeginDeleteOptions` +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsClientGetResponse` +- New anonymous field `ResourceInfo` in struct `ClientGetResponse` +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsClientUpdateResponse` +- New field `ResumeToken` in struct `ClientBeginCreateOrUpdateOptions` +- New anonymous field `ResourceInfo` in struct `ClientUpdateResponse` +- New anonymous field `SignalRServiceUsageList` in struct `UsagesClientListResponse` +- New field `ResumeToken` in struct `SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions` +- New anonymous field `SharedPrivateLinkResource` in struct `SharedPrivateLinkResourcesClientCreateOrUpdateResponse` +- New field `ResumeToken` in struct `PrivateEndpointConnectionsClientBeginDeleteOptions` +- New anonymous field `PrivateLinkResourceList` in struct `PrivateLinkResourcesClientListResponse` +- New field `ResumeToken` in struct `HubsClientBeginDeleteOptions` +- New field `ResumeToken` in struct `ClientBeginUpdateOptions` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/README.md b/sdk/resourcemanager/webpubsub/armwebpubsub/README.md index dd91ff6ef233..514cd73cb6c8 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/README.md +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/README.md @@ -11,7 +11,7 @@ The `armwebpubsub` module provides operations for working with Azure Web PubSub. ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Web PubSub modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -client := armwebpubsub.NewWebPubSubSharedPrivateLinkResourcesClient(<subscription ID>, cred, nil) +client, err := armwebpubsub.NewWebPubSubSharedPrivateLinkResourcesClient(<subscription ID>, cred, nil) ``` You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armwebpubsub.NewWebPubSubSharedPrivateLinkResourcesClient(<subscription ID>, cred, &options) +client, err := armwebpubsub.NewWebPubSubSharedPrivateLinkResourcesClient(<subscription ID>, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md b/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md index 2d14538d9b83..a96287c03c49 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/cf47fa91b882618a1043e3aeb5803b3a7397cd08/specification/webpubsub/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/cf47fa91b882618a1043e3aeb5803b3a7397cd08/specification/webpubsub/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/webpubsub/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/webpubsub/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod b/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod index 4d4df09f51cd..411c1ff0811b 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum b/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_operations_client_test.go index 9b557d599aa2..89c9164165ea 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_operations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,25 +16,29 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Operations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Operations_List.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewOperationsClient(cred, nil) + client, err := armwebpubsub.NewOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_usages_client_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_usages_client_test.go index ad10c19715a1..418fc6852074 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_usages_client_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_usages_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,26 +16,30 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Usages_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Usages_List.json func ExampleUsagesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewUsagesClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewUsagesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<location>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsub_client_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsub_client_test.go index c638aa43087f..143a6221af71 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsub_client_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsub_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,302 +19,368 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_CheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_CheckNameAvailability.json func ExampleClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CheckNameAvailability(ctx, "<location>", armwebpubsub.NameAvailabilityParameters{ - Name: to.StringPtr("<name>"), - Type: to.StringPtr("<type>"), + Name: to.Ptr("<name>"), + Type: to.Ptr("<type>"), }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ClientCheckNameAvailabilityResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_ListBySubscription.json func ExampleClient_ListBySubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListBySubscription(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_ListByResourceGroup.json func ExampleClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByResourceGroup("<resource-group-name>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_Get.json func ExampleClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<resource-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_CreateOrUpdate.json func ExampleClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "<resource-group-name>", "<resource-name>", armwebpubsub.ResourceInfo{ - Location: to.StringPtr("<location>"), + Location: to.Ptr("<location>"), Tags: map[string]*string{ - "key1": to.StringPtr("value1"), + "key1": to.Ptr("value1"), }, Identity: &armwebpubsub.ManagedIdentity{ - Type: armwebpubsub.ManagedIdentityType("SystemAssigned").ToPtr(), + Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), }, Properties: &armwebpubsub.Properties{ - DisableAADAuth: to.BoolPtr(false), - DisableLocalAuth: to.BoolPtr(false), + DisableAADAuth: to.Ptr(false), + DisableLocalAuth: to.Ptr(false), LiveTraceConfiguration: &armwebpubsub.LiveTraceConfiguration{ Categories: []*armwebpubsub.LiveTraceCategory{ { - Name: to.StringPtr("<name>"), - Enabled: to.StringPtr("<enabled>"), + Name: to.Ptr("<name>"), + Enabled: to.Ptr("<enabled>"), }}, - Enabled: to.StringPtr("<enabled>"), + Enabled: to.Ptr("<enabled>"), }, NetworkACLs: &armwebpubsub.NetworkACLs{ - DefaultAction: armwebpubsub.ACLAction("Deny").ToPtr(), + DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ { Allow: []*armwebpubsub.WebPubSubRequestType{ - armwebpubsub.WebPubSubRequestType("ServerConnection").ToPtr()}, - Name: to.StringPtr("<name>"), + to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, + Name: to.Ptr("<name>"), }}, PublicNetwork: &armwebpubsub.NetworkACL{ Allow: []*armwebpubsub.WebPubSubRequestType{ - armwebpubsub.WebPubSubRequestType("ClientConnection").ToPtr()}, + to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, }, }, - PublicNetworkAccess: to.StringPtr("<public-network-access>"), + PublicNetworkAccess: to.Ptr("<public-network-access>"), TLS: &armwebpubsub.TLSSettings{ - ClientCertEnabled: to.BoolPtr(false), + ClientCertEnabled: to.Ptr(false), }, }, SKU: &armwebpubsub.ResourceSKU{ - Name: to.StringPtr("<name>"), - Capacity: to.Int32Ptr(1), - Tier: armwebpubsub.WebPubSubSKUTier("Standard").ToPtr(), + Name: to.Ptr("<name>"), + Capacity: to.Ptr[int32](1), + Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), }, }, - nil) + &armwebpubsub.ClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.ClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_Delete.json func ExampleClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "<resource-group-name>", "<resource-name>", - nil) + &armwebpubsub.ClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_Update.json func ExampleClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginUpdate(ctx, "<resource-group-name>", "<resource-name>", armwebpubsub.ResourceInfo{ - Location: to.StringPtr("<location>"), + Location: to.Ptr("<location>"), Tags: map[string]*string{ - "key1": to.StringPtr("value1"), + "key1": to.Ptr("value1"), }, Identity: &armwebpubsub.ManagedIdentity{ - Type: armwebpubsub.ManagedIdentityType("SystemAssigned").ToPtr(), + Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), }, Properties: &armwebpubsub.Properties{ - DisableAADAuth: to.BoolPtr(false), - DisableLocalAuth: to.BoolPtr(false), + DisableAADAuth: to.Ptr(false), + DisableLocalAuth: to.Ptr(false), LiveTraceConfiguration: &armwebpubsub.LiveTraceConfiguration{ Categories: []*armwebpubsub.LiveTraceCategory{ { - Name: to.StringPtr("<name>"), - Enabled: to.StringPtr("<enabled>"), + Name: to.Ptr("<name>"), + Enabled: to.Ptr("<enabled>"), }}, - Enabled: to.StringPtr("<enabled>"), + Enabled: to.Ptr("<enabled>"), }, NetworkACLs: &armwebpubsub.NetworkACLs{ - DefaultAction: armwebpubsub.ACLAction("Deny").ToPtr(), + DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ { Allow: []*armwebpubsub.WebPubSubRequestType{ - armwebpubsub.WebPubSubRequestType("ServerConnection").ToPtr()}, - Name: to.StringPtr("<name>"), + to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, + Name: to.Ptr("<name>"), }}, PublicNetwork: &armwebpubsub.NetworkACL{ Allow: []*armwebpubsub.WebPubSubRequestType{ - armwebpubsub.WebPubSubRequestType("ClientConnection").ToPtr()}, + to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, }, }, - PublicNetworkAccess: to.StringPtr("<public-network-access>"), + PublicNetworkAccess: to.Ptr("<public-network-access>"), TLS: &armwebpubsub.TLSSettings{ - ClientCertEnabled: to.BoolPtr(false), + ClientCertEnabled: to.Ptr(false), }, }, SKU: &armwebpubsub.ResourceSKU{ - Name: to.StringPtr("<name>"), - Capacity: to.Int32Ptr(1), - Tier: armwebpubsub.WebPubSubSKUTier("Standard").ToPtr(), + Name: to.Ptr("<name>"), + Capacity: to.Ptr[int32](1), + Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), }, }, - nil) + &armwebpubsub.ClientBeginUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.ClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_ListKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_ListKeys.json func ExampleClient_ListKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.ListKeys(ctx, "<resource-group-name>", "<resource-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ClientListKeysResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_RegenerateKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_RegenerateKey.json func ExampleClient_BeginRegenerateKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginRegenerateKey(ctx, "<resource-group-name>", "<resource-name>", armwebpubsub.RegenerateKeyParameters{ - KeyType: armwebpubsub.KeyType("Primary").ToPtr(), + KeyType: to.Ptr(armwebpubsub.KeyTypePrimary), }, - nil) + &armwebpubsub.ClientBeginRegenerateKeyOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_Restart.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_Restart.json func ExampleClient_BeginRestart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginRestart(ctx, "<resource-group-name>", "<resource-name>", - nil) + &armwebpubsub.ClientBeginRestartOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubhubs_client_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubhubs_client_test.go index 9d165c8c7314..c9d86a91e335 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubhubs_client_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubhubs_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,58 +19,74 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubHubs_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubHubs_List.json func ExampleHubsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewHubsClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewHubsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<resource-group-name>", "<resource-name>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubHubs_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubHubs_Get.json func ExampleHubsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewHubsClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewHubsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<hub-name>", "<resource-group-name>", "<resource-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.HubsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubHubs_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubHubs_CreateOrUpdate.json func ExampleHubsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewHubsClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewHubsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "<hub-name>", "<resource-group-name>", @@ -80,48 +96,58 @@ func ExampleHubsClient_BeginCreateOrUpdate() { EventHandlers: []*armwebpubsub.EventHandler{ { Auth: &armwebpubsub.UpstreamAuthSettings{ - Type: armwebpubsub.UpstreamAuthType("ManagedIdentity").ToPtr(), + Type: to.Ptr(armwebpubsub.UpstreamAuthTypeManagedIdentity), ManagedIdentity: &armwebpubsub.ManagedIdentitySettings{ - Resource: to.StringPtr("<resource>"), + Resource: to.Ptr("<resource>"), }, }, SystemEvents: []*string{ - to.StringPtr("connect"), - to.StringPtr("connected")}, - URLTemplate: to.StringPtr("<urltemplate>"), - UserEventPattern: to.StringPtr("<user-event-pattern>"), + to.Ptr("connect"), + to.Ptr("connected")}, + URLTemplate: to.Ptr("<urltemplate>"), + UserEventPattern: to.Ptr("<user-event-pattern>"), }}, }, }, - nil) + &armwebpubsub.HubsClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.HubsClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubHubs_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubHubs_Delete.json func ExampleHubsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewHubsClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewHubsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "<hub-name>", "<resource-group-name>", "<resource-name>", - nil) + &armwebpubsub.HubsClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubprivateendpointconnections_client_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubprivateendpointconnections_client_test.go index deadc471977e..c4870c7a2ffb 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubprivateendpointconnections_client_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubprivateendpointconnections_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,58 +19,74 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubPrivateEndpointConnections_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubPrivateEndpointConnections_List.json func ExamplePrivateEndpointConnectionsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<resource-group-name>", "<resource-name>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubPrivateEndpointConnections_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubPrivateEndpointConnections_Get.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<private-endpoint-connection-name>", "<resource-group-name>", "<resource-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubPrivateEndpointConnections_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubPrivateEndpointConnections_Update.json func ExamplePrivateEndpointConnectionsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "<private-endpoint-connection-name>", "<resource-group-name>", @@ -78,39 +94,48 @@ func ExamplePrivateEndpointConnectionsClient_Update() { armwebpubsub.PrivateEndpointConnection{ Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ - ID: to.StringPtr("<id>"), + ID: to.Ptr("<id>"), }, PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ - ActionsRequired: to.StringPtr("<actions-required>"), - Status: armwebpubsub.PrivateLinkServiceConnectionStatus("Approved").ToPtr(), + ActionsRequired: to.Ptr("<actions-required>"), + Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), }, }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubPrivateEndpointConnections_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubPrivateEndpointConnections_Delete.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewPrivateEndpointConnectionsClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "<private-endpoint-connection-name>", "<resource-group-name>", "<resource-name>", - nil) + &armwebpubsub.PrivateEndpointConnectionsClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubprivatelinkresources_client_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubprivatelinkresources_client_test.go index 4546cfaa6cbe..00ec2ebfd7c2 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubprivatelinkresources_client_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubprivatelinkresources_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,27 +16,31 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubPrivateLinkResources_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubPrivateLinkResources_List.json func ExamplePrivateLinkResourcesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewPrivateLinkResourcesClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewPrivateLinkResourcesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<resource-group-name>", "<resource-name>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubsharedprivatelinkresources_client_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubsharedprivatelinkresources_client_test.go index 04c7d7356739..a157317e1785 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubsharedprivatelinkresources_client_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/ze_generated_example_webpubsubsharedprivatelinkresources_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,98 +19,124 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubSharedPrivateLinkResources_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubSharedPrivateLinkResources_List.json func ExampleSharedPrivateLinkResourcesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewSharedPrivateLinkResourcesClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewSharedPrivateLinkResourcesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<resource-group-name>", "<resource-name>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubSharedPrivateLinkResources_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubSharedPrivateLinkResources_Get.json func ExampleSharedPrivateLinkResourcesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewSharedPrivateLinkResourcesClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewSharedPrivateLinkResourcesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<shared-private-link-resource-name>", "<resource-group-name>", "<resource-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.SharedPrivateLinkResourcesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubSharedPrivateLinkResources_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubSharedPrivateLinkResources_CreateOrUpdate.json func ExampleSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewSharedPrivateLinkResourcesClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewSharedPrivateLinkResourcesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreateOrUpdate(ctx, "<shared-private-link-resource-name>", "<resource-group-name>", "<resource-name>", armwebpubsub.SharedPrivateLinkResource{ Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ - GroupID: to.StringPtr("<group-id>"), - PrivateLinkResourceID: to.StringPtr("<private-link-resource-id>"), - RequestMessage: to.StringPtr("<request-message>"), + GroupID: to.Ptr("<group-id>"), + PrivateLinkResourceID: to.Ptr("<private-link-resource-id>"), + RequestMessage: to.Ptr("<request-message>"), }, }, - nil) + &armwebpubsub.SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.SharedPrivateLinkResourcesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubSharedPrivateLinkResources_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubSharedPrivateLinkResources_Delete.json func ExampleSharedPrivateLinkResourcesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwebpubsub.NewSharedPrivateLinkResourcesClient("<subscription-id>", cred, nil) + client, err := armwebpubsub.NewSharedPrivateLinkResourcesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginDelete(ctx, "<shared-private-link-resource-name>", "<resource-group-name>", "<resource-name>", - nil) + &armwebpubsub.SharedPrivateLinkResourcesClientBeginDeleteOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } _, err = poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_client.go index 5aa1200ef05b..7ea11e359e37 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type Client struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *Client { +func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &Client{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // CheckNameAvailability - Checks that the resource name is valid and is not already in use. @@ -94,7 +99,7 @@ func (client *Client) checkNameAvailabilityCreateRequest(ctx context.Context, lo // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. func (client *Client) checkNameAvailabilityHandleResponse(resp *http.Response) (ClientCheckNameAvailabilityResponse, error) { - result := ClientCheckNameAvailabilityResponse{RawResponse: resp} + result := ClientCheckNameAvailabilityResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { return ClientCheckNameAvailabilityResponse{}, err } @@ -108,22 +113,16 @@ func (client *Client) checkNameAvailabilityHandleResponse(resp *http.Response) ( // resourceName - The name of the resource. // parameters - Parameters for the create or update operation // options - ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. -func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginCreateOrUpdateOptions) (ClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, parameters, options) - if err != nil { - return ClientCreateOrUpdatePollerResponse{}, err - } - result := ClientCreateOrUpdatePollerResponse{ - RawResponse: resp, +func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginCreateOrUpdateOptions) (*armruntime.Poller[ClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("Client.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return ClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &ClientCreateOrUpdatePoller{ - pt: pt, - } - return result, nil } // CreateOrUpdate - Create or update a resource. @@ -175,22 +174,16 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG // Resource Manager API or the portal. // resourceName - The name of the resource. // options - ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. -func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginDeleteOptions) (ClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, options) - if err != nil { - return ClientDeletePollerResponse{}, err - } - result := ClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("Client.Delete", "", resp, client.pl) - if err != nil { - return ClientDeletePollerResponse{}, err - } - result.Poller = &ClientDeletePoller{ - pt: pt, +func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginDeleteOptions) (*armruntime.Poller[ClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - Operation to delete a resource. @@ -285,7 +278,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName st // getHandleResponse handles the Get response. func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, error) { - result := ClientGetResponse{RawResponse: resp} + result := ClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceInfo); err != nil { return ClientGetResponse{}, err } @@ -297,16 +290,32 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // options - ClientListByResourceGroupOptions contains the optional parameters for the Client.ListByResourceGroup method. -func (client *Client) ListByResourceGroup(resourceGroupName string, options *ClientListByResourceGroupOptions) *ClientListByResourceGroupPager { - return &ClientListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) +func (client *Client) ListByResourceGroup(resourceGroupName string, options *ClientListByResourceGroupOptions) *runtime.Pager[ClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[ClientListByResourceGroupResponse]{ + More: func(page ClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ClientListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ResourceInfoList.NextLink) + Fetcher: func(ctx context.Context, page *ClientListByResourceGroupResponse) (ClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) }, - } + }) } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. @@ -333,7 +342,7 @@ func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, reso // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (ClientListByResourceGroupResponse, error) { - result := ClientListByResourceGroupResponse{RawResponse: resp} + result := ClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceInfoList); err != nil { return ClientListByResourceGroupResponse{}, err } @@ -343,16 +352,32 @@ func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (Cl // ListBySubscription - Handles requests to list all resources in a subscription. // If the operation fails it returns an *azcore.ResponseError type. // options - ClientListBySubscriptionOptions contains the optional parameters for the Client.ListBySubscription method. -func (client *Client) ListBySubscription(options *ClientListBySubscriptionOptions) *ClientListBySubscriptionPager { - return &ClientListBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) +func (client *Client) ListBySubscription(options *ClientListBySubscriptionOptions) *runtime.Pager[ClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[ClientListBySubscriptionResponse]{ + More: func(page ClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ClientListBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ResourceInfoList.NextLink) + Fetcher: func(ctx context.Context, page *ClientListBySubscriptionResponse) (ClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) }, - } + }) } // listBySubscriptionCreateRequest creates the ListBySubscription request. @@ -375,7 +400,7 @@ func (client *Client) listBySubscriptionCreateRequest(ctx context.Context, optio // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *Client) listBySubscriptionHandleResponse(resp *http.Response) (ClientListBySubscriptionResponse, error) { - result := ClientListBySubscriptionResponse{RawResponse: resp} + result := ClientListBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceInfoList); err != nil { return ClientListBySubscriptionResponse{}, err } @@ -431,7 +456,7 @@ func (client *Client) listKeysCreateRequest(ctx context.Context, resourceGroupNa // listKeysHandleResponse handles the ListKeys response. func (client *Client) listKeysHandleResponse(resp *http.Response) (ClientListKeysResponse, error) { - result := ClientListKeysResponse{RawResponse: resp} + result := ClientListKeysResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Keys); err != nil { return ClientListKeysResponse{}, err } @@ -487,7 +512,7 @@ func (client *Client) listSKUsCreateRequest(ctx context.Context, resourceGroupNa // listSKUsHandleResponse handles the ListSKUs response. func (client *Client) listSKUsHandleResponse(resp *http.Response) (ClientListSKUsResponse, error) { - result := ClientListSKUsResponse{RawResponse: resp} + result := ClientListSKUsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SKUList); err != nil { return ClientListSKUsResponse{}, err } @@ -502,22 +527,18 @@ func (client *Client) listSKUsHandleResponse(resp *http.Response) (ClientListSKU // resourceName - The name of the resource. // parameters - Parameter that describes the Regenerate Key Operation. // options - ClientBeginRegenerateKeyOptions contains the optional parameters for the Client.BeginRegenerateKey method. -func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *ClientBeginRegenerateKeyOptions) (ClientRegenerateKeyPollerResponse, error) { - resp, err := client.regenerateKey(ctx, resourceGroupName, resourceName, parameters, options) - if err != nil { - return ClientRegenerateKeyPollerResponse{}, err +func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *ClientBeginRegenerateKeyOptions) (*armruntime.Poller[ClientRegenerateKeyResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.regenerateKey(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[ClientRegenerateKeyResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[ClientRegenerateKeyResponse](options.ResumeToken, client.pl, nil) } - result := ClientRegenerateKeyPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("Client.RegenerateKey", "azure-async-operation", resp, client.pl) - if err != nil { - return ClientRegenerateKeyPollerResponse{}, err - } - result.Poller = &ClientRegenerateKeyPoller{ - pt: pt, - } - return result, nil } // RegenerateKey - Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same @@ -570,22 +591,18 @@ func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGr // Resource Manager API or the portal. // resourceName - The name of the resource. // options - ClientBeginRestartOptions contains the optional parameters for the Client.BeginRestart method. -func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginRestartOptions) (ClientRestartPollerResponse, error) { - resp, err := client.restart(ctx, resourceGroupName, resourceName, options) - if err != nil { - return ClientRestartPollerResponse{}, err - } - result := ClientRestartPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("Client.Restart", "azure-async-operation", resp, client.pl) - if err != nil { - return ClientRestartPollerResponse{}, err +func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginRestartOptions) (*armruntime.Poller[ClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[ClientRestartResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[ClientRestartResponse](options.ResumeToken, client.pl, nil) } - result.Poller = &ClientRestartPoller{ - pt: pt, - } - return result, nil } // Restart - Operation to restart a resource. @@ -638,22 +655,16 @@ func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupNam // resourceName - The name of the resource. // parameters - Parameters for the update operation // options - ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. -func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginUpdateOptions) (ClientUpdatePollerResponse, error) { - resp, err := client.update(ctx, resourceGroupName, resourceName, parameters, options) - if err != nil { - return ClientUpdatePollerResponse{}, err - } - result := ClientUpdatePollerResponse{ - RawResponse: resp, +func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginUpdateOptions) (*armruntime.Poller[ClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ClientUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ClientUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("Client.Update", "", resp, client.pl) - if err != nil { - return ClientUpdatePollerResponse{}, err - } - result.Poller = &ClientUpdatePoller{ - pt: pt, - } - return result, nil } // Update - Operation to update an exiting resource. diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_constants.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_constants.go index a6d260d7eb5d..4cdac7b7f30c 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_constants.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armwebpubsub const ( moduleName = "armwebpubsub" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // ACLAction - Azure Networking ACL Action. @@ -29,11 +29,6 @@ func PossibleACLActionValues() []ACLAction { } } -// ToPtr returns a *ACLAction pointing to the current value. -func (c ACLAction) ToPtr() *ACLAction { - return &c -} - // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -54,11 +49,6 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// ToPtr returns a *CreatedByType pointing to the current value. -func (c CreatedByType) ToPtr() *CreatedByType { - return &c -} - // KeyType - The type of access key. type KeyType string @@ -77,11 +67,6 @@ func PossibleKeyTypeValues() []KeyType { } } -// ToPtr returns a *KeyType pointing to the current value. -func (c KeyType) ToPtr() *KeyType { - return &c -} - // ManagedIdentityType - Represents the identity type: systemAssigned, userAssigned, None type ManagedIdentityType string @@ -100,11 +85,6 @@ func PossibleManagedIdentityTypeValues() []ManagedIdentityType { } } -// ToPtr returns a *ManagedIdentityType pointing to the current value. -func (c ManagedIdentityType) ToPtr() *ManagedIdentityType { - return &c -} - // PrivateLinkServiceConnectionStatus - Indicates whether the connection has been Approved/Rejected/Removed by the owner of // the service. type PrivateLinkServiceConnectionStatus string @@ -126,11 +106,6 @@ func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConn } } -// ToPtr returns a *PrivateLinkServiceConnectionStatus pointing to the current value. -func (c PrivateLinkServiceConnectionStatus) ToPtr() *PrivateLinkServiceConnectionStatus { - return &c -} - // ProvisioningState - Provisioning state of the resource. type ProvisioningState string @@ -161,11 +136,6 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// ToPtr returns a *ProvisioningState pointing to the current value. -func (c ProvisioningState) ToPtr() *ProvisioningState { - return &c -} - // ScaleType - The scale type applicable to the sku. type ScaleType string @@ -184,11 +154,6 @@ func PossibleScaleTypeValues() []ScaleType { } } -// ToPtr returns a *ScaleType pointing to the current value. -func (c ScaleType) ToPtr() *ScaleType { - return &c -} - // SharedPrivateLinkResourceStatus - Status of the shared private link resource type SharedPrivateLinkResourceStatus string @@ -211,11 +176,6 @@ func PossibleSharedPrivateLinkResourceStatusValues() []SharedPrivateLinkResource } } -// ToPtr returns a *SharedPrivateLinkResourceStatus pointing to the current value. -func (c SharedPrivateLinkResourceStatus) ToPtr() *SharedPrivateLinkResourceStatus { - return &c -} - // UpstreamAuthType - Upstream auth type enum. type UpstreamAuthType string @@ -232,11 +192,6 @@ func PossibleUpstreamAuthTypeValues() []UpstreamAuthType { } } -// ToPtr returns a *UpstreamAuthType pointing to the current value. -func (c UpstreamAuthType) ToPtr() *UpstreamAuthType { - return &c -} - // WebPubSubRequestType - The incoming request type to the service type WebPubSubRequestType string @@ -257,11 +212,6 @@ func PossibleWebPubSubRequestTypeValues() []WebPubSubRequestType { } } -// ToPtr returns a *WebPubSubRequestType pointing to the current value. -func (c WebPubSubRequestType) ToPtr() *WebPubSubRequestType { - return &c -} - // WebPubSubSKUTier - Optional tier of this particular SKU. 'Standard' or 'Free'. // Basic is deprecated, use Standard instead. type WebPubSubSKUTier string @@ -282,8 +232,3 @@ func PossibleWebPubSubSKUTierValues() []WebPubSubSKUTier { WebPubSubSKUTierStandard, } } - -// ToPtr returns a *WebPubSubSKUTier pointing to the current value. -func (c WebPubSubSKUTier) ToPtr() *WebPubSubSKUTier { - return &c -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_hubs_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_hubs_client.go index 7dca0930cedf..c9bf9a09b97d 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_hubs_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_hubs_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type HubsClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewHubsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *HubsClient { +func NewHubsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HubsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &HubsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Create or update a hub setting. @@ -59,22 +64,16 @@ func NewHubsClient(subscriptionID string, credential azcore.TokenCredential, opt // parameters - The resource of WebPubSubHub and its properties // options - HubsClientBeginCreateOrUpdateOptions contains the optional parameters for the HubsClient.BeginCreateOrUpdate // method. -func (client *HubsClient) BeginCreateOrUpdate(ctx context.Context, hubName string, resourceGroupName string, resourceName string, parameters Hub, options *HubsClientBeginCreateOrUpdateOptions) (HubsClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, hubName, resourceGroupName, resourceName, parameters, options) - if err != nil { - return HubsClientCreateOrUpdatePollerResponse{}, err - } - result := HubsClientCreateOrUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("HubsClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return HubsClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &HubsClientCreateOrUpdatePoller{ - pt: pt, +func (client *HubsClient) BeginCreateOrUpdate(ctx context.Context, hubName string, resourceGroupName string, resourceName string, parameters Hub, options *HubsClientBeginCreateOrUpdateOptions) (*armruntime.Poller[HubsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, hubName, resourceGroupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[HubsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[HubsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // CreateOrUpdate - Create or update a hub setting. @@ -131,22 +130,16 @@ func (client *HubsClient) createOrUpdateCreateRequest(ctx context.Context, hubNa // Resource Manager API or the portal. // resourceName - The name of the resource. // options - HubsClientBeginDeleteOptions contains the optional parameters for the HubsClient.BeginDelete method. -func (client *HubsClient) BeginDelete(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientBeginDeleteOptions) (HubsClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, hubName, resourceGroupName, resourceName, options) - if err != nil { - return HubsClientDeletePollerResponse{}, err - } - result := HubsClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("HubsClient.Delete", "", resp, client.pl) - if err != nil { - return HubsClientDeletePollerResponse{}, err - } - result.Poller = &HubsClientDeletePoller{ - pt: pt, +func (client *HubsClient) BeginDelete(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientBeginDeleteOptions) (*armruntime.Poller[HubsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, hubName, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[HubsClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[HubsClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - Delete a hub setting. @@ -250,7 +243,7 @@ func (client *HubsClient) getCreateRequest(ctx context.Context, hubName string, // getHandleResponse handles the Get response. func (client *HubsClient) getHandleResponse(resp *http.Response) (HubsClientGetResponse, error) { - result := HubsClientGetResponse{RawResponse: resp} + result := HubsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Hub); err != nil { return HubsClientGetResponse{}, err } @@ -263,16 +256,32 @@ func (client *HubsClient) getHandleResponse(resp *http.Response) (HubsClientGetR // Resource Manager API or the portal. // resourceName - The name of the resource. // options - HubsClientListOptions contains the optional parameters for the HubsClient.List method. -func (client *HubsClient) List(resourceGroupName string, resourceName string, options *HubsClientListOptions) *HubsClientListPager { - return &HubsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) +func (client *HubsClient) List(resourceGroupName string, resourceName string, options *HubsClientListOptions) *runtime.Pager[HubsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[HubsClientListResponse]{ + More: func(page HubsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp HubsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.HubList.NextLink) + Fetcher: func(ctx context.Context, page *HubsClientListResponse) (HubsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return HubsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HubsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HubsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -303,7 +312,7 @@ func (client *HubsClient) listCreateRequest(ctx context.Context, resourceGroupNa // listHandleResponse handles the List response. func (client *HubsClient) listHandleResponse(resp *http.Response) (HubsClientListResponse, error) { - result := HubsClientListResponse{RawResponse: resp} + result := HubsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.HubList); err != nil { return HubsClientListResponse{}, err } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_models.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_models.go index 6457dc5fbcf1..ba865ee3334f 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_models.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,36 +8,36 @@ package armwebpubsub -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. type ClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. type ClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ClientBeginRegenerateKeyOptions contains the optional parameters for the Client.BeginRegenerateKey method. type ClientBeginRegenerateKeyOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ClientBeginRestartOptions contains the optional parameters for the Client.BeginRestart method. type ClientBeginRestartOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. type ClientBeginUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ClientCheckNameAvailabilityOptions contains the optional parameters for the Client.CheckNameAvailability method. @@ -85,6 +85,40 @@ type Dimension struct { ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` } +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty" azure:"ro"` + + // READ-ONLY; The additional info type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The error target. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + // EventHandler - Properties of event handler. type EventHandler struct { // REQUIRED; Gets or sets the EventHandler URL template. You can use a predefined parameter {hub} and {event} inside the template, @@ -104,16 +138,6 @@ type EventHandler struct { UserEventPattern *string `json:"userEventPattern,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type EventHandler. -func (e EventHandler) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "auth", e.Auth) - populate(objectMap, "systemEvents", e.SystemEvents) - populate(objectMap, "urlTemplate", e.URLTemplate) - populate(objectMap, "userEventPattern", e.UserEventPattern) - return json.Marshal(objectMap) -} - // Hub - A hub setting type Hub struct { // REQUIRED; Properties of a hub. @@ -142,14 +166,6 @@ type HubList struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type HubList. -func (h HubList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", h.NextLink) - populate(objectMap, "value", h.Value) - return json.Marshal(objectMap) -} - // HubProperties - Properties of a hub. type HubProperties struct { // The settings for configuring if anonymous connections are allowed for this hub: "allow" or "deny". Default to "deny". @@ -159,22 +175,16 @@ type HubProperties struct { EventHandlers []*EventHandler `json:"eventHandlers,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type HubProperties. -func (h HubProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "anonymousConnectPolicy", h.AnonymousConnectPolicy) - populate(objectMap, "eventHandlers", h.EventHandlers) - return json.Marshal(objectMap) -} - // HubsClientBeginCreateOrUpdateOptions contains the optional parameters for the HubsClient.BeginCreateOrUpdate method. type HubsClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // HubsClientBeginDeleteOptions contains the optional parameters for the HubsClient.BeginDelete method. type HubsClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // HubsClientGetOptions contains the optional parameters for the HubsClient.Get method. @@ -222,14 +232,6 @@ type LiveTraceConfiguration struct { Enabled *string `json:"enabled,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type LiveTraceConfiguration. -func (l LiveTraceConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "categories", l.Categories) - populate(objectMap, "enabled", l.Enabled) - return json.Marshal(objectMap) -} - // LogSpecification - Specifications of the Logs for Azure Monitoring. type LogSpecification struct { // Localized friendly display name of the log. @@ -254,16 +256,6 @@ type ManagedIdentity struct { TenantID *string `json:"tenantId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ManagedIdentity. -func (m ManagedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", m.PrincipalID) - populate(objectMap, "tenantId", m.TenantID) - populate(objectMap, "type", m.Type) - populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) - return json.Marshal(objectMap) -} - // ManagedIdentitySettings - Managed identity settings for upstream. type ManagedIdentitySettings struct { // The Resource indicating the App ID URI of the target resource. It also appears in the aud (audience) claim of the issued @@ -301,20 +293,6 @@ type MetricSpecification struct { Unit *string `json:"unit,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. -func (m MetricSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregationType", m.AggregationType) - populate(objectMap, "category", m.Category) - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "displayDescription", m.DisplayDescription) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "fillGapWithZero", m.FillGapWithZero) - populate(objectMap, "name", m.Name) - populate(objectMap, "unit", m.Unit) - return json.Marshal(objectMap) -} - // NameAvailability - Result of the request to check name availability. It contains a flag and possible reason of failure. type NameAvailability struct { // The message of the operation. @@ -345,14 +323,6 @@ type NetworkACL struct { Deny []*WebPubSubRequestType `json:"deny,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type NetworkACL. -func (n NetworkACL) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allow", n.Allow) - populate(objectMap, "deny", n.Deny) - return json.Marshal(objectMap) -} - // NetworkACLs - Network ACLs for the resource type NetworkACLs struct { // Azure Networking ACL Action. @@ -365,15 +335,6 @@ type NetworkACLs struct { PublicNetwork *NetworkACL `json:"publicNetwork,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type NetworkACLs. -func (n NetworkACLs) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "defaultAction", n.DefaultAction) - populate(objectMap, "privateEndpoints", n.PrivateEndpoints) - populate(objectMap, "publicNetwork", n.PublicNetwork) - return json.Marshal(objectMap) -} - // Operation - REST API operation supported by resource provider. type Operation struct { // The object that describes a operation. @@ -417,14 +378,6 @@ type OperationList struct { Value []*Operation `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OperationList. -func (o OperationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationProperties - Extra Operation properties. type OperationProperties struct { // An object that describes a specification. @@ -454,15 +407,6 @@ type PrivateEndpointACL struct { Deny []*WebPubSubRequestType `json:"deny,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointACL. -func (p PrivateEndpointACL) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allow", p.Allow) - populate(objectMap, "deny", p.Deny) - populate(objectMap, "name", p.Name) - return json.Marshal(objectMap) -} - // PrivateEndpointConnection - A private endpoint connection to an azure resource type PrivateEndpointConnection struct { // Private endpoint connection properties @@ -491,14 +435,6 @@ type PrivateEndpointConnectionList struct { Value []*PrivateEndpointConnection `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionList. -func (p PrivateEndpointConnectionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PrivateEndpointConnectionProperties - Private endpoint connection properties type PrivateEndpointConnectionProperties struct { // Private endpoint @@ -514,20 +450,11 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. -func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupIds", p.GroupIDs) - populate(objectMap, "privateEndpoint", p.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", p.ProvisioningState) - return json.Marshal(objectMap) -} - // PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get @@ -572,14 +499,6 @@ type PrivateLinkResourceList struct { Value []*PrivateLinkResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceList. -func (p PrivateLinkResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // PrivateLinkResourceProperties - Private link resource properties type PrivateLinkResourceProperties struct { // Group Id of the private link resource @@ -595,16 +514,6 @@ type PrivateLinkResourceProperties struct { ShareablePrivateLinkResourceTypes []*ShareablePrivateLinkResourceType `json:"shareablePrivateLinkResourceTypes,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) - populate(objectMap, "shareablePrivateLinkResourceTypes", p.ShareablePrivateLinkResourceTypes) - return json.Marshal(objectMap) -} - // PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List method. type PrivateLinkResourcesClientListOptions struct { // placeholder for future optional parameters @@ -675,28 +584,6 @@ type Properties struct { Version *string `json:"version,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Properties. -func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "disableAadAuth", p.DisableAADAuth) - populate(objectMap, "disableLocalAuth", p.DisableLocalAuth) - populate(objectMap, "externalIP", p.ExternalIP) - populate(objectMap, "hostName", p.HostName) - populate(objectMap, "hostNamePrefix", p.HostNamePrefix) - populate(objectMap, "liveTraceConfiguration", p.LiveTraceConfiguration) - populate(objectMap, "networkACLs", p.NetworkACLs) - populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) - populate(objectMap, "publicPort", p.PublicPort) - populate(objectMap, "resourceLogConfiguration", p.ResourceLogConfiguration) - populate(objectMap, "serverPort", p.ServerPort) - populate(objectMap, "sharedPrivateLinkResources", p.SharedPrivateLinkResources) - populate(objectMap, "tls", p.TLS) - populate(objectMap, "version", p.Version) - return json.Marshal(objectMap) -} - // ProxyResource - The resource model definition for a ARM proxy resource. It will have everything other than required location // and tags type ProxyResource struct { @@ -758,21 +645,6 @@ type ResourceInfo struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ResourceInfo. -func (r ResourceInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "identity", r.Identity) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "sku", r.SKU) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - // ResourceInfoList - Object that includes an array of resources and a possible link for next set. type ResourceInfoList struct { // The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -782,14 +654,6 @@ type ResourceInfoList struct { Value []*ResourceInfo `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ResourceInfoList. -func (r ResourceInfoList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - // ResourceLogCategory - Resource log category configuration of a Microsoft.SignalRService resource. type ResourceLogCategory struct { // Indicates whether or the resource log category is enabled. Available values: true, false. Case insensitive. @@ -805,13 +669,6 @@ type ResourceLogConfiguration struct { Categories []*ResourceLogCategory `json:"categories,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ResourceLogConfiguration. -func (r ResourceLogConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "categories", r.Categories) - return json.Marshal(objectMap) -} - // ResourceSKU - The billing information of the resource. type ResourceSKU struct { // REQUIRED; The name of the SKU. Required. @@ -863,17 +720,6 @@ type SKUCapacity struct { ScaleType *ScaleType `json:"scaleType,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type SKUCapacity. -func (s SKUCapacity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowedValues", s.AllowedValues) - populate(objectMap, "default", s.Default) - populate(objectMap, "maximum", s.Maximum) - populate(objectMap, "minimum", s.Minimum) - populate(objectMap, "scaleType", s.ScaleType) - return json.Marshal(objectMap) -} - // SKUList - The list skus operation response type SKUList struct { // READ-ONLY; The URL the client should use to fetch the next page (per server side paging). It's null for now, added for @@ -884,14 +730,6 @@ type SKUList struct { Value []*SKU `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type SKUList. -func (s SKUList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - // ServiceSpecification - An object that describes a specification. type ServiceSpecification struct { // Specifications of the Logs for Azure Monitoring. @@ -901,14 +739,6 @@ type ServiceSpecification struct { MetricSpecifications []*MetricSpecification `json:"metricSpecifications,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. -func (s ServiceSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "logSpecifications", s.LogSpecifications) - populate(objectMap, "metricSpecifications", s.MetricSpecifications) - return json.Marshal(objectMap) -} - // ShareablePrivateLinkResourceProperties - Describes the properties of a resource type that has been onboarded to private // link service type ShareablePrivateLinkResourceProperties struct { @@ -959,14 +789,6 @@ type SharedPrivateLinkResourceList struct { Value []*SharedPrivateLinkResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SharedPrivateLinkResourceList. -func (s SharedPrivateLinkResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - // SharedPrivateLinkResourceProperties - Describes the properties of an existing Shared Private Link Resource type SharedPrivateLinkResourceProperties struct { // REQUIRED; The group id from the provider of resource the shared private link resource is for @@ -988,13 +810,15 @@ type SharedPrivateLinkResourceProperties struct { // SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate // method. type SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // SharedPrivateLinkResourcesClientBeginDeleteOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginDelete // method. type SharedPrivateLinkResourcesClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get @@ -1036,14 +860,6 @@ type SignalRServiceUsageList struct { Value []*SignalRServiceUsage `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SignalRServiceUsageList. -func (s SignalRServiceUsageList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - // SignalRServiceUsageName - Localizable String object containing the name and a localized value. type SignalRServiceUsageName struct { // Localized name of the usage. @@ -1074,53 +890,6 @@ type SystemData struct { LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // TLSSettings - TLS settings for the resource type TLSSettings struct { // Request client certificate during TLS handshake if enabled @@ -1145,17 +914,6 @@ type TrackedResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - // UpstreamAuthSettings - Upstream auth settings. If not set, no auth is used for upstream messages. type UpstreamAuthSettings struct { // Managed identity settings for upstream. @@ -1178,20 +936,3 @@ type UserAssignedIdentityProperty struct { // READ-ONLY; Get the principal id for the user assigned identity PrincipalID *string `json:"principalId,omitempty" azure:"ro"` } - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_models_serde.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_models_serde.go new file mode 100644 index 000000000000..3575c3c7f296 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_models_serde.go @@ -0,0 +1,324 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armwebpubsub + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type EventHandler. +func (e EventHandler) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "auth", e.Auth) + populate(objectMap, "systemEvents", e.SystemEvents) + populate(objectMap, "urlTemplate", e.URLTemplate) + populate(objectMap, "userEventPattern", e.UserEventPattern) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type HubList. +func (h HubList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type HubProperties. +func (h HubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "anonymousConnectPolicy", h.AnonymousConnectPolicy) + populate(objectMap, "eventHandlers", h.EventHandlers) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type LiveTraceConfiguration. +func (l LiveTraceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "categories", l.Categories) + populate(objectMap, "enabled", l.Enabled) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedIdentity. +func (m ManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. +func (m MetricSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "category", m.Category) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "fillGapWithZero", m.FillGapWithZero) + populate(objectMap, "name", m.Name) + populate(objectMap, "unit", m.Unit) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkACL. +func (n NetworkACL) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allow", n.Allow) + populate(objectMap, "deny", n.Deny) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkACLs. +func (n NetworkACLs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultAction", n.DefaultAction) + populate(objectMap, "privateEndpoints", n.PrivateEndpoints) + populate(objectMap, "publicNetwork", n.PublicNetwork) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OperationList. +func (o OperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointACL. +func (p PrivateEndpointACL) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allow", p.Allow) + populate(objectMap, "deny", p.Deny) + populate(objectMap, "name", p.Name) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionList. +func (p PrivateEndpointConnectionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceList. +func (p PrivateLinkResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + populate(objectMap, "shareablePrivateLinkResourceTypes", p.ShareablePrivateLinkResourceTypes) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "disableAadAuth", p.DisableAADAuth) + populate(objectMap, "disableLocalAuth", p.DisableLocalAuth) + populate(objectMap, "externalIP", p.ExternalIP) + populate(objectMap, "hostName", p.HostName) + populate(objectMap, "hostNamePrefix", p.HostNamePrefix) + populate(objectMap, "liveTraceConfiguration", p.LiveTraceConfiguration) + populate(objectMap, "networkACLs", p.NetworkACLs) + populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) + populate(objectMap, "publicPort", p.PublicPort) + populate(objectMap, "resourceLogConfiguration", p.ResourceLogConfiguration) + populate(objectMap, "serverPort", p.ServerPort) + populate(objectMap, "sharedPrivateLinkResources", p.SharedPrivateLinkResources) + populate(objectMap, "tls", p.TLS) + populate(objectMap, "version", p.Version) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceInfo. +func (r ResourceInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceInfoList. +func (r ResourceInfoList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceLogConfiguration. +func (r ResourceLogConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "categories", r.Categories) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type SKUCapacity. +func (s SKUCapacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedValues", s.AllowedValues) + populate(objectMap, "default", s.Default) + populate(objectMap, "maximum", s.Maximum) + populate(objectMap, "minimum", s.Minimum) + populate(objectMap, "scaleType", s.ScaleType) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type SKUList. +func (s SKUList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. +func (s ServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logSpecifications", s.LogSpecifications) + populate(objectMap, "metricSpecifications", s.MetricSpecifications) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type SharedPrivateLinkResourceList. +func (s SharedPrivateLinkResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type SignalRServiceUsageList. +func (s SignalRServiceUsageList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_operations_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_operations_client.go index 88945a3354ac..48292c939c6d 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_operations_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,34 +29,54 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // List - Lists all of the available REST API operations of the Microsoft.SignalRService provider. // If the operation fails it returns an *azcore.ResponseError type. // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(options *OperationsClientListOptions) *OperationsClientListPager { - return &OperationsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *OperationsClient) List(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp OperationsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationList.NextLink) + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -74,7 +95,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationList); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_pagers.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_pagers.go deleted file mode 100644 index 06764e22dbcc..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_pagers.go +++ /dev/null @@ -1,449 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armwebpubsub - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// ClientListByResourceGroupPager provides operations for iterating over paged responses. -type ClientListByResourceGroupPager struct { - client *Client - current ClientListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ClientListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ClientListByResourceGroupPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ClientListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ResourceInfoList.NextLink == nil || len(*p.current.ResourceInfoList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByResourceGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ClientListByResourceGroupResponse page. -func (p *ClientListByResourceGroupPager) PageResponse() ClientListByResourceGroupResponse { - return p.current -} - -// ClientListBySubscriptionPager provides operations for iterating over paged responses. -type ClientListBySubscriptionPager struct { - client *Client - current ClientListBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ClientListBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ClientListBySubscriptionPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ClientListBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ResourceInfoList.NextLink == nil || len(*p.current.ResourceInfoList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listBySubscriptionHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ClientListBySubscriptionResponse page. -func (p *ClientListBySubscriptionPager) PageResponse() ClientListBySubscriptionResponse { - return p.current -} - -// HubsClientListPager provides operations for iterating over paged responses. -type HubsClientListPager struct { - client *HubsClient - current HubsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, HubsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *HubsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *HubsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.HubList.NextLink == nil || len(*p.current.HubList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current HubsClientListResponse page. -func (p *HubsClientListPager) PageResponse() HubsClientListResponse { - return p.current -} - -// OperationsClientListPager provides operations for iterating over paged responses. -type OperationsClientListPager struct { - client *OperationsClient - current OperationsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, OperationsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *OperationsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *OperationsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.OperationList.NextLink == nil || len(*p.current.OperationList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current OperationsClientListResponse page. -func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse { - return p.current -} - -// PrivateEndpointConnectionsClientListPager provides operations for iterating over paged responses. -type PrivateEndpointConnectionsClientListPager struct { - client *PrivateEndpointConnectionsClient - current PrivateEndpointConnectionsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PrivateEndpointConnectionsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PrivateEndpointConnectionsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *PrivateEndpointConnectionsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PrivateEndpointConnectionList.NextLink == nil || len(*p.current.PrivateEndpointConnectionList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PrivateEndpointConnectionsClientListResponse page. -func (p *PrivateEndpointConnectionsClientListPager) PageResponse() PrivateEndpointConnectionsClientListResponse { - return p.current -} - -// PrivateLinkResourcesClientListPager provides operations for iterating over paged responses. -type PrivateLinkResourcesClientListPager struct { - client *PrivateLinkResourcesClient - current PrivateLinkResourcesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PrivateLinkResourcesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PrivateLinkResourcesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *PrivateLinkResourcesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PrivateLinkResourceList.NextLink == nil || len(*p.current.PrivateLinkResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PrivateLinkResourcesClientListResponse page. -func (p *PrivateLinkResourcesClientListPager) PageResponse() PrivateLinkResourcesClientListResponse { - return p.current -} - -// SharedPrivateLinkResourcesClientListPager provides operations for iterating over paged responses. -type SharedPrivateLinkResourcesClientListPager struct { - client *SharedPrivateLinkResourcesClient - current SharedPrivateLinkResourcesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, SharedPrivateLinkResourcesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *SharedPrivateLinkResourcesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *SharedPrivateLinkResourcesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.SharedPrivateLinkResourceList.NextLink == nil || len(*p.current.SharedPrivateLinkResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current SharedPrivateLinkResourcesClientListResponse page. -func (p *SharedPrivateLinkResourcesClientListPager) PageResponse() SharedPrivateLinkResourcesClientListResponse { - return p.current -} - -// UsagesClientListPager provides operations for iterating over paged responses. -type UsagesClientListPager struct { - client *UsagesClient - current UsagesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, UsagesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *UsagesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *UsagesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.SignalRServiceUsageList.NextLink == nil || len(*p.current.SignalRServiceUsageList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current UsagesClientListResponse page. -func (p *UsagesClientListPager) PageResponse() UsagesClientListResponse { - return p.current -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_pollers.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_pollers.go deleted file mode 100644 index af013b4abeeb..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_pollers.go +++ /dev/null @@ -1,445 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armwebpubsub - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// ClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type ClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ClientCreateOrUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *ClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final ClientCreateOrUpdateResponse will be returned. -func (p *ClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (ClientCreateOrUpdateResponse, error) { - respType := ClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ResourceInfo) - if err != nil { - return ClientCreateOrUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *ClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type ClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ClientDeletePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *ClientDeletePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final ClientDeleteResponse will be returned. -func (p *ClientDeletePoller) FinalResponse(ctx context.Context) (ClientDeleteResponse, error) { - respType := ClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return ClientDeleteResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *ClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ClientRegenerateKeyPoller provides polling facilities until the operation reaches a terminal state. -type ClientRegenerateKeyPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ClientRegenerateKeyPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *ClientRegenerateKeyPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final ClientRegenerateKeyResponse will be returned. -func (p *ClientRegenerateKeyPoller) FinalResponse(ctx context.Context) (ClientRegenerateKeyResponse, error) { - respType := ClientRegenerateKeyResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.Keys) - if err != nil { - return ClientRegenerateKeyResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *ClientRegenerateKeyPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ClientRestartPoller provides polling facilities until the operation reaches a terminal state. -type ClientRestartPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ClientRestartPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *ClientRestartPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final ClientRestartResponse will be returned. -func (p *ClientRestartPoller) FinalResponse(ctx context.Context) (ClientRestartResponse, error) { - respType := ClientRestartResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return ClientRestartResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *ClientRestartPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ClientUpdatePoller provides polling facilities until the operation reaches a terminal state. -type ClientUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ClientUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *ClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final ClientUpdateResponse will be returned. -func (p *ClientUpdatePoller) FinalResponse(ctx context.Context) (ClientUpdateResponse, error) { - respType := ClientUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ResourceInfo) - if err != nil { - return ClientUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *ClientUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// HubsClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type HubsClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *HubsClientCreateOrUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *HubsClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final HubsClientCreateOrUpdateResponse will be returned. -func (p *HubsClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (HubsClientCreateOrUpdateResponse, error) { - respType := HubsClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.Hub) - if err != nil { - return HubsClientCreateOrUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *HubsClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// HubsClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type HubsClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *HubsClientDeletePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *HubsClientDeletePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final HubsClientDeleteResponse will be returned. -func (p *HubsClientDeletePoller) FinalResponse(ctx context.Context) (HubsClientDeleteResponse, error) { - respType := HubsClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return HubsClientDeleteResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *HubsClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PrivateEndpointConnectionsClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type PrivateEndpointConnectionsClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PrivateEndpointConnectionsClientDeletePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *PrivateEndpointConnectionsClientDeletePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final PrivateEndpointConnectionsClientDeleteResponse will be returned. -func (p *PrivateEndpointConnectionsClientDeletePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsClientDeleteResponse, error) { - respType := PrivateEndpointConnectionsClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return PrivateEndpointConnectionsClientDeleteResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *PrivateEndpointConnectionsClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// SharedPrivateLinkResourcesClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type SharedPrivateLinkResourcesClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *SharedPrivateLinkResourcesClientCreateOrUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *SharedPrivateLinkResourcesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final SharedPrivateLinkResourcesClientCreateOrUpdateResponse will be returned. -func (p *SharedPrivateLinkResourcesClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (SharedPrivateLinkResourcesClientCreateOrUpdateResponse, error) { - respType := SharedPrivateLinkResourcesClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.SharedPrivateLinkResource) - if err != nil { - return SharedPrivateLinkResourcesClientCreateOrUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *SharedPrivateLinkResourcesClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// SharedPrivateLinkResourcesClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type SharedPrivateLinkResourcesClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *SharedPrivateLinkResourcesClientDeletePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *SharedPrivateLinkResourcesClientDeletePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final SharedPrivateLinkResourcesClientDeleteResponse will be returned. -func (p *SharedPrivateLinkResourcesClientDeletePoller) FinalResponse(ctx context.Context) (SharedPrivateLinkResourcesClientDeleteResponse, error) { - respType := SharedPrivateLinkResourcesClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return SharedPrivateLinkResourcesClientDeleteResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *SharedPrivateLinkResourcesClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_privateendpointconnections_client.go index d3eea386fd6b..3b4dd31da46a 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_privateendpointconnections_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type PrivateEndpointConnectionsClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateEndpointConnectionsClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // BeginDelete - Delete the specified private endpoint connection @@ -58,22 +63,16 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // resourceName - The name of the resource. // options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. -func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (PrivateEndpointConnectionsClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) - if err != nil { - return PrivateEndpointConnectionsClientDeletePollerResponse{}, err - } - result := PrivateEndpointConnectionsClientDeletePollerResponse{ - RawResponse: resp, +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*armruntime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("PrivateEndpointConnectionsClient.Delete", "", resp, client.pl) - if err != nil { - return PrivateEndpointConnectionsClientDeletePollerResponse{}, err - } - result.Poller = &PrivateEndpointConnectionsClientDeletePoller{ - pt: pt, - } - return result, nil } // Delete - Delete the specified private endpoint connection @@ -178,7 +177,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con // getHandleResponse handles the Get response. func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { - result := PrivateEndpointConnectionsClientGetResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } @@ -192,16 +191,32 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // resourceName - The name of the resource. // options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List // method. -func (client *PrivateEndpointConnectionsClient) List(resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientListOptions) *PrivateEndpointConnectionsClientListPager { - return &PrivateEndpointConnectionsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) +func (client *PrivateEndpointConnectionsClient) List(resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[PrivateEndpointConnectionsClientListResponse]{ + More: func(page PrivateEndpointConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp PrivateEndpointConnectionsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateEndpointConnectionList.NextLink) + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListResponse) (PrivateEndpointConnectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -232,7 +247,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co // listHandleResponse handles the List response. func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListResponse, error) { - result := PrivateEndpointConnectionsClientListResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionList); err != nil { return PrivateEndpointConnectionsClientListResponse{}, err } @@ -295,7 +310,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. // updateHandleResponse handles the Update response. func (client *PrivateEndpointConnectionsClient) updateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientUpdateResponse, error) { - result := PrivateEndpointConnectionsClientUpdateResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { return PrivateEndpointConnectionsClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_privatelinkresources_client.go index cf0be0dd4bb6..45b36780f02e 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_privatelinkresources_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type PrivateLinkResourcesClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &PrivateLinkResourcesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // List - Get the private link resources that need to be created for a resource. @@ -57,16 +62,32 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // resourceName - The name of the resource. // options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List // method. -func (client *PrivateLinkResourcesClient) List(resourceGroupName string, resourceName string, options *PrivateLinkResourcesClientListOptions) *PrivateLinkResourcesClientListPager { - return &PrivateLinkResourcesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) +func (client *PrivateLinkResourcesClient) List(resourceGroupName string, resourceName string, options *PrivateLinkResourcesClientListOptions) *runtime.Pager[PrivateLinkResourcesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[PrivateLinkResourcesClientListResponse]{ + More: func(page PrivateLinkResourcesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp PrivateLinkResourcesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkResourceList.NextLink) + Fetcher: func(ctx context.Context, page *PrivateLinkResourcesClientListResponse) (PrivateLinkResourcesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -97,7 +118,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, // listHandleResponse handles the List response. func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListResponse, error) { - result := PrivateLinkResourcesClientListResponse{RawResponse: resp} + result := PrivateLinkResourcesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceList); err != nil { return PrivateLinkResourcesClientListResponse{}, err } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_response_types.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_response_types.go index b13f883ac012..12a993e7adc8 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_response_types.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,691 +8,132 @@ package armwebpubsub -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - // ClientCheckNameAvailabilityResponse contains the response from method Client.CheckNameAvailability. type ClientCheckNameAvailabilityResponse struct { - ClientCheckNameAvailabilityResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientCheckNameAvailabilityResult contains the result from method Client.CheckNameAvailability. -type ClientCheckNameAvailabilityResult struct { NameAvailability } -// ClientCreateOrUpdatePollerResponse contains the response from method Client.CreateOrUpdate. -type ClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *ClientCreateOrUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l ClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClientCreateOrUpdateResponse, error) { - respType := ClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ResourceInfo) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *ClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *Client, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("Client.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &ClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ClientCreateOrUpdateResponse contains the response from method Client.CreateOrUpdate. type ClientCreateOrUpdateResponse struct { - ClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientCreateOrUpdateResult contains the result from method Client.CreateOrUpdate. -type ClientCreateOrUpdateResult struct { ResourceInfo } -// ClientDeletePollerResponse contains the response from method Client.Delete. -type ClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *ClientDeletePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l ClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClientDeleteResponse, error) { - respType := ClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ClientDeletePollerResponse from the provided client and resume token. -func (l *ClientDeletePollerResponse) Resume(ctx context.Context, client *Client, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("Client.Delete", token, client.pl) - if err != nil { - return err - } - poller := &ClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ClientDeleteResponse contains the response from method Client.Delete. type ClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // ClientGetResponse contains the response from method Client.Get. type ClientGetResponse struct { - ClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientGetResult contains the result from method Client.Get. -type ClientGetResult struct { ResourceInfo } // ClientListByResourceGroupResponse contains the response from method Client.ListByResourceGroup. type ClientListByResourceGroupResponse struct { - ClientListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListByResourceGroupResult contains the result from method Client.ListByResourceGroup. -type ClientListByResourceGroupResult struct { ResourceInfoList } // ClientListBySubscriptionResponse contains the response from method Client.ListBySubscription. type ClientListBySubscriptionResponse struct { - ClientListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListBySubscriptionResult contains the result from method Client.ListBySubscription. -type ClientListBySubscriptionResult struct { ResourceInfoList } // ClientListKeysResponse contains the response from method Client.ListKeys. type ClientListKeysResponse struct { - ClientListKeysResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListKeysResult contains the result from method Client.ListKeys. -type ClientListKeysResult struct { Keys } // ClientListSKUsResponse contains the response from method Client.ListSKUs. type ClientListSKUsResponse struct { - ClientListSKUsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListSKUsResult contains the result from method Client.ListSKUs. -type ClientListSKUsResult struct { SKUList } -// ClientRegenerateKeyPollerResponse contains the response from method Client.RegenerateKey. -type ClientRegenerateKeyPollerResponse struct { - // Poller contains an initialized poller. - Poller *ClientRegenerateKeyPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l ClientRegenerateKeyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClientRegenerateKeyResponse, error) { - respType := ClientRegenerateKeyResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Keys) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ClientRegenerateKeyPollerResponse from the provided client and resume token. -func (l *ClientRegenerateKeyPollerResponse) Resume(ctx context.Context, client *Client, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("Client.RegenerateKey", token, client.pl) - if err != nil { - return err - } - poller := &ClientRegenerateKeyPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ClientRegenerateKeyResponse contains the response from method Client.RegenerateKey. type ClientRegenerateKeyResponse struct { - ClientRegenerateKeyResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientRegenerateKeyResult contains the result from method Client.RegenerateKey. -type ClientRegenerateKeyResult struct { Keys } -// ClientRestartPollerResponse contains the response from method Client.Restart. -type ClientRestartPollerResponse struct { - // Poller contains an initialized poller. - Poller *ClientRestartPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l ClientRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClientRestartResponse, error) { - respType := ClientRestartResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ClientRestartPollerResponse from the provided client and resume token. -func (l *ClientRestartPollerResponse) Resume(ctx context.Context, client *Client, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("Client.Restart", token, client.pl) - if err != nil { - return err - } - poller := &ClientRestartPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ClientRestartResponse contains the response from method Client.Restart. type ClientRestartResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientUpdatePollerResponse contains the response from method Client.Update. -type ClientUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *ClientUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l ClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClientUpdateResponse, error) { - respType := ClientUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ResourceInfo) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ClientUpdatePollerResponse from the provided client and resume token. -func (l *ClientUpdatePollerResponse) Resume(ctx context.Context, client *Client, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("Client.Update", token, client.pl) - if err != nil { - return err - } - poller := &ClientUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil + // placeholder for future response values } // ClientUpdateResponse contains the response from method Client.Update. type ClientUpdateResponse struct { - ClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientUpdateResult contains the result from method Client.Update. -type ClientUpdateResult struct { ResourceInfo } -// HubsClientCreateOrUpdatePollerResponse contains the response from method HubsClient.CreateOrUpdate. -type HubsClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *HubsClientCreateOrUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l HubsClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (HubsClientCreateOrUpdateResponse, error) { - respType := HubsClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Hub) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a HubsClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *HubsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *HubsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("HubsClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &HubsClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // HubsClientCreateOrUpdateResponse contains the response from method HubsClient.CreateOrUpdate. type HubsClientCreateOrUpdateResponse struct { - HubsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// HubsClientCreateOrUpdateResult contains the result from method HubsClient.CreateOrUpdate. -type HubsClientCreateOrUpdateResult struct { Hub } -// HubsClientDeletePollerResponse contains the response from method HubsClient.Delete. -type HubsClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *HubsClientDeletePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l HubsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (HubsClientDeleteResponse, error) { - respType := HubsClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a HubsClientDeletePollerResponse from the provided client and resume token. -func (l *HubsClientDeletePollerResponse) Resume(ctx context.Context, client *HubsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("HubsClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &HubsClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // HubsClientDeleteResponse contains the response from method HubsClient.Delete. type HubsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // HubsClientGetResponse contains the response from method HubsClient.Get. type HubsClientGetResponse struct { - HubsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// HubsClientGetResult contains the result from method HubsClient.Get. -type HubsClientGetResult struct { Hub } // HubsClientListResponse contains the response from method HubsClient.List. type HubsClientListResponse struct { - HubsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// HubsClientListResult contains the result from method HubsClient.List. -type HubsClientListResult struct { HubList } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationList } -// PrivateEndpointConnectionsClientDeletePollerResponse contains the response from method PrivateEndpointConnectionsClient.Delete. -type PrivateEndpointConnectionsClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *PrivateEndpointConnectionsClientDeletePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l PrivateEndpointConnectionsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsClientDeleteResponse, error) { - respType := PrivateEndpointConnectionsClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PrivateEndpointConnectionsClientDeletePollerResponse from the provided client and resume token. -func (l *PrivateEndpointConnectionsClientDeletePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &PrivateEndpointConnectionsClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. type PrivateEndpointConnectionsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { - PrivateEndpointConnectionsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientGetResult contains the result from method PrivateEndpointConnectionsClient.Get. -type PrivateEndpointConnectionsClientGetResult struct { PrivateEndpointConnection } // PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.List. type PrivateEndpointConnectionsClientListResponse struct { - PrivateEndpointConnectionsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientListResult contains the result from method PrivateEndpointConnectionsClient.List. -type PrivateEndpointConnectionsClientListResult struct { PrivateEndpointConnectionList } // PrivateEndpointConnectionsClientUpdateResponse contains the response from method PrivateEndpointConnectionsClient.Update. type PrivateEndpointConnectionsClientUpdateResponse struct { - PrivateEndpointConnectionsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientUpdateResult contains the result from method PrivateEndpointConnectionsClient.Update. -type PrivateEndpointConnectionsClientUpdateResult struct { PrivateEndpointConnection } // PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.List. type PrivateLinkResourcesClientListResponse struct { - PrivateLinkResourcesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateLinkResourcesClientListResult contains the result from method PrivateLinkResourcesClient.List. -type PrivateLinkResourcesClientListResult struct { PrivateLinkResourceList } -// SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse contains the response from method SharedPrivateLinkResourcesClient.CreateOrUpdate. -type SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *SharedPrivateLinkResourcesClientCreateOrUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SharedPrivateLinkResourcesClientCreateOrUpdateResponse, error) { - respType := SharedPrivateLinkResourcesClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SharedPrivateLinkResource) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *SharedPrivateLinkResourcesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("SharedPrivateLinkResourcesClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &SharedPrivateLinkResourcesClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // SharedPrivateLinkResourcesClientCreateOrUpdateResponse contains the response from method SharedPrivateLinkResourcesClient.CreateOrUpdate. type SharedPrivateLinkResourcesClientCreateOrUpdateResponse struct { - SharedPrivateLinkResourcesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// SharedPrivateLinkResourcesClientCreateOrUpdateResult contains the result from method SharedPrivateLinkResourcesClient.CreateOrUpdate. -type SharedPrivateLinkResourcesClientCreateOrUpdateResult struct { SharedPrivateLinkResource } -// SharedPrivateLinkResourcesClientDeletePollerResponse contains the response from method SharedPrivateLinkResourcesClient.Delete. -type SharedPrivateLinkResourcesClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *SharedPrivateLinkResourcesClientDeletePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l SharedPrivateLinkResourcesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SharedPrivateLinkResourcesClientDeleteResponse, error) { - respType := SharedPrivateLinkResourcesClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a SharedPrivateLinkResourcesClientDeletePollerResponse from the provided client and resume token. -func (l *SharedPrivateLinkResourcesClientDeletePollerResponse) Resume(ctx context.Context, client *SharedPrivateLinkResourcesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("SharedPrivateLinkResourcesClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &SharedPrivateLinkResourcesClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // SharedPrivateLinkResourcesClientDeleteResponse contains the response from method SharedPrivateLinkResourcesClient.Delete. type SharedPrivateLinkResourcesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // SharedPrivateLinkResourcesClientGetResponse contains the response from method SharedPrivateLinkResourcesClient.Get. type SharedPrivateLinkResourcesClientGetResponse struct { - SharedPrivateLinkResourcesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// SharedPrivateLinkResourcesClientGetResult contains the result from method SharedPrivateLinkResourcesClient.Get. -type SharedPrivateLinkResourcesClientGetResult struct { SharedPrivateLinkResource } // SharedPrivateLinkResourcesClientListResponse contains the response from method SharedPrivateLinkResourcesClient.List. type SharedPrivateLinkResourcesClientListResponse struct { - SharedPrivateLinkResourcesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// SharedPrivateLinkResourcesClientListResult contains the result from method SharedPrivateLinkResourcesClient.List. -type SharedPrivateLinkResourcesClientListResult struct { SharedPrivateLinkResourceList } // UsagesClientListResponse contains the response from method UsagesClient.List. type UsagesClientListResponse struct { - UsagesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// UsagesClientListResult contains the result from method UsagesClient.List. -type UsagesClientListResult struct { SignalRServiceUsageList } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_sharedprivatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_sharedprivatelinkresources_client.go index f8dfc2b53264..568e0bd38c46 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_sharedprivatelinkresources_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_sharedprivatelinkresources_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type SharedPrivateLinkResourcesClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SharedPrivateLinkResourcesClient { +func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SharedPrivateLinkResourcesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &SharedPrivateLinkResourcesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Create or update a shared private link resource @@ -59,22 +64,16 @@ func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcor // parameters - The shared private link resource // options - SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate // method. -func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters, options) - if err != nil { - return SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse{}, err - } - result := SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("SharedPrivateLinkResourcesClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &SharedPrivateLinkResourcesClientCreateOrUpdatePoller{ - pt: pt, +func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*armruntime.Poller[SharedPrivateLinkResourcesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[SharedPrivateLinkResourcesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[SharedPrivateLinkResourcesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // CreateOrUpdate - Create or update a shared private link resource @@ -132,22 +131,16 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx // resourceName - The name of the resource. // options - SharedPrivateLinkResourcesClientBeginDeleteOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginDelete // method. -func (client *SharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (SharedPrivateLinkResourcesClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) - if err != nil { - return SharedPrivateLinkResourcesClientDeletePollerResponse{}, err - } - result := SharedPrivateLinkResourcesClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("SharedPrivateLinkResourcesClient.Delete", "", resp, client.pl) - if err != nil { - return SharedPrivateLinkResourcesClientDeletePollerResponse{}, err - } - result.Poller = &SharedPrivateLinkResourcesClientDeletePoller{ - pt: pt, +func (client *SharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*armruntime.Poller[SharedPrivateLinkResourcesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[SharedPrivateLinkResourcesClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[SharedPrivateLinkResourcesClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - Delete the specified shared private link resource @@ -252,7 +245,7 @@ func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Con // getHandleResponse handles the Get response. func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (SharedPrivateLinkResourcesClientGetResponse, error) { - result := SharedPrivateLinkResourcesClientGetResponse{RawResponse: resp} + result := SharedPrivateLinkResourcesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResource); err != nil { return SharedPrivateLinkResourcesClientGetResponse{}, err } @@ -266,16 +259,32 @@ func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Res // resourceName - The name of the resource. // options - SharedPrivateLinkResourcesClientListOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.List // method. -func (client *SharedPrivateLinkResourcesClient) List(resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientListOptions) *SharedPrivateLinkResourcesClientListPager { - return &SharedPrivateLinkResourcesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) +func (client *SharedPrivateLinkResourcesClient) List(resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientListOptions) *runtime.Pager[SharedPrivateLinkResourcesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[SharedPrivateLinkResourcesClientListResponse]{ + More: func(page SharedPrivateLinkResourcesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp SharedPrivateLinkResourcesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.SharedPrivateLinkResourceList.NextLink) + Fetcher: func(ctx context.Context, page *SharedPrivateLinkResourcesClientListResponse) (SharedPrivateLinkResourcesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SharedPrivateLinkResourcesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SharedPrivateLinkResourcesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SharedPrivateLinkResourcesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -306,7 +315,7 @@ func (client *SharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Co // listHandleResponse handles the List response. func (client *SharedPrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (SharedPrivateLinkResourcesClientListResponse, error) { - result := SharedPrivateLinkResourcesClientListResponse{RawResponse: resp} + result := SharedPrivateLinkResourcesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResourceList); err != nil { return SharedPrivateLinkResourcesClientListResponse{}, err } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_time_rfc3339.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_time_rfc3339.go index 9d49adab1b8c..b6323e304cd4 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_usages_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_usages_client.go index e1eb835a6cf3..7e0751126abb 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_usages_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/zz_generated_usages_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,36 +35,56 @@ type UsagesClient struct { // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UsagesClient { +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &UsagesClient{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // List - List resource usage quotas by location. // If the operation fails it returns an *azcore.ResponseError type. // location - the location like "eastus" // options - UsagesClientListOptions contains the optional parameters for the UsagesClient.List method. -func (client *UsagesClient) List(location string, options *UsagesClientListOptions) *UsagesClientListPager { - return &UsagesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, location, options) +func (client *UsagesClient) List(location string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[UsagesClientListResponse]{ + More: func(page UsagesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp UsagesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.SignalRServiceUsageList.NextLink) + Fetcher: func(ctx context.Context, page *UsagesClientListResponse) (UsagesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return UsagesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UsagesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UsagesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -90,7 +111,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri // listHandleResponse handles the List response. func (client *UsagesClient) listHandleResponse(resp *http.Response) (UsagesClientListResponse, error) { - result := UsagesClientListResponse{RawResponse: resp} + result := UsagesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SignalRServiceUsageList); err != nil { return UsagesClientListResponse{}, err } diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/CHANGELOG.md b/sdk/resourcemanager/windowsesu/armwindowsesu/CHANGELOG.md index 1c9a2d819c80..7ab8a1e80b0a 100644 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/CHANGELOG.md +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/CHANGELOG.md @@ -1,5 +1,68 @@ # Release History +## 0.3.0 (2022-04-13) +### Breaking Changes + +- Function `*MultipleActivationKeysClient.ListByResourceGroup` return value(s) have been changed from `(*MultipleActivationKeysClientListByResourceGroupPager)` to `(*runtime.Pager[MultipleActivationKeysClientListByResourceGroupResponse])` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `NewMultipleActivationKeysClient` return value(s) have been changed from `(*MultipleActivationKeysClient)` to `(*MultipleActivationKeysClient, error)` +- Function `*MultipleActivationKeysClient.BeginCreate` return value(s) have been changed from `(MultipleActivationKeysClientCreatePollerResponse, error)` to `(*armruntime.Poller[MultipleActivationKeysClientCreateResponse], error)` +- Function `*MultipleActivationKeysClient.List` return value(s) have been changed from `(*MultipleActivationKeysClientListPager)` to `(*runtime.Pager[MultipleActivationKeysClientListResponse])` +- Function `*OperationsClient.List` return value(s) have been changed from `(*OperationsClientListPager)` to `(*runtime.Pager[OperationsClientListResponse])` +- Function `MultipleActivationKeysClientCreatePollerResponse.PollUntilDone` has been removed +- Function `*OperationsClientListPager.Err` has been removed +- Function `*MultipleActivationKeysClientListByResourceGroupPager.Err` has been removed +- Function `*MultipleActivationKeysClientListPager.PageResponse` has been removed +- Function `*MultipleActivationKeysClientCreatePollerResponse.Resume` has been removed +- Function `*MultipleActivationKeysClientListPager.NextPage` has been removed +- Function `*MultipleActivationKeysClientCreatePoller.ResumeToken` has been removed +- Function `OsType.ToPtr` has been removed +- Function `*MultipleActivationKeysClientCreatePoller.FinalResponse` has been removed +- Function `*MultipleActivationKeysClientListByResourceGroupPager.NextPage` has been removed +- Function `SupportType.ToPtr` has been removed +- Function `*OperationsClientListPager.PageResponse` has been removed +- Function `*MultipleActivationKeysClientListPager.Err` has been removed +- Function `*OperationsClientListPager.NextPage` has been removed +- Function `*MultipleActivationKeysClientCreatePoller.Poll` has been removed +- Function `ProvisioningState.ToPtr` has been removed +- Function `*MultipleActivationKeysClientCreatePoller.Done` has been removed +- Function `*MultipleActivationKeysClientListByResourceGroupPager.PageResponse` has been removed +- Struct `MultipleActivationKeysClientCreatePoller` has been removed +- Struct `MultipleActivationKeysClientCreatePollerResponse` has been removed +- Struct `MultipleActivationKeysClientCreateResult` has been removed +- Struct `MultipleActivationKeysClientGetResult` has been removed +- Struct `MultipleActivationKeysClientListByResourceGroupPager` has been removed +- Struct `MultipleActivationKeysClientListByResourceGroupResult` has been removed +- Struct `MultipleActivationKeysClientListPager` has been removed +- Struct `MultipleActivationKeysClientListResult` has been removed +- Struct `MultipleActivationKeysClientUpdateResult` has been removed +- Struct `OperationsClientListPager` has been removed +- Struct `OperationsClientListResult` has been removed +- Field `MultipleActivationKeysClientListByResourceGroupResult` of struct `MultipleActivationKeysClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `MultipleActivationKeysClientListByResourceGroupResponse` has been removed +- Field `MultipleActivationKeysClientCreateResult` of struct `MultipleActivationKeysClientCreateResponse` has been removed +- Field `RawResponse` of struct `MultipleActivationKeysClientCreateResponse` has been removed +- Field `MultipleActivationKeysClientUpdateResult` of struct `MultipleActivationKeysClientUpdateResponse` has been removed +- Field `RawResponse` of struct `MultipleActivationKeysClientUpdateResponse` has been removed +- Field `MultipleActivationKeysClientGetResult` of struct `MultipleActivationKeysClientGetResponse` has been removed +- Field `RawResponse` of struct `MultipleActivationKeysClientGetResponse` has been removed +- Field `MultipleActivationKeysClientListResult` of struct `MultipleActivationKeysClientListResponse` has been removed +- Field `RawResponse` of struct `MultipleActivationKeysClientListResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `MultipleActivationKeysClientDeleteResponse` has been removed + +### Features Added + +- New anonymous field `MultipleActivationKeyList` in struct `MultipleActivationKeysClientListResponse` +- New anonymous field `MultipleActivationKeyList` in struct `MultipleActivationKeysClientListByResourceGroupResponse` +- New anonymous field `MultipleActivationKey` in struct `MultipleActivationKeysClientGetResponse` +- New anonymous field `MultipleActivationKey` in struct `MultipleActivationKeysClientUpdateResponse` +- New field `ResumeToken` in struct `MultipleActivationKeysClientBeginCreateOptions` +- New anonymous field `MultipleActivationKey` in struct `MultipleActivationKeysClientCreateResponse` +- New anonymous field `OperationList` in struct `OperationsClientListResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/README.md b/sdk/resourcemanager/windowsesu/armwindowsesu/README.md index 33b7f50e7af1..3e933d7ee39f 100644 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/README.md +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/README.md @@ -11,7 +11,7 @@ The `armwindowsesu` module provides operations for working with Azure Windows ES ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Windows ESU modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -client := armwindowsesu.NewMultipleActivationKeysClient(<subscription ID>, cred, nil) +client, err := armwindowsesu.NewMultipleActivationKeysClient(<subscription ID>, cred, nil) ``` You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armwindowsesu.NewMultipleActivationKeysClient(<subscription ID>, cred, &options) +client, err := armwindowsesu.NewMultipleActivationKeysClient(<subscription ID>, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/autorest.md b/sdk/resourcemanager/windowsesu/armwindowsesu/autorest.md index 33dcacb92704..ceb8c7c8a24f 100644 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/autorest.md +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/windowsesu/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/windowsesu/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/windowsesu/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/windowsesu/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/go.mod b/sdk/resourcemanager/windowsesu/armwindowsesu/go.mod index 58fa4731b1ab..8a6b6f802233 100644 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/go.mod +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsesu/armwindowsesu -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/go.sum b/sdk/resourcemanager/windowsesu/armwindowsesu/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/go.sum +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/ze_generated_example_multipleactivationkeys_client_test.go b/sdk/resourcemanager/windowsesu/armwindowsesu/ze_generated_example_multipleactivationkeys_client_test.go index 51be3d207243..51d78685c580 100644 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/ze_generated_example_multipleactivationkeys_client_test.go +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/ze_generated_example_multipleactivationkeys_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,140 +19,176 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsesu/armwindowsesu" ) -// x-ms-original-file: specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/ListMultipleActivationKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/ListMultipleActivationKeys.json func ExampleMultipleActivationKeysClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsesu.NewMultipleActivationKeysClient("<subscription-id>", cred, nil) + client, err := armwindowsesu.NewMultipleActivationKeysClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/ListMultipleActivationKeysByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/ListMultipleActivationKeysByResourceGroup.json func ExampleMultipleActivationKeysClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsesu.NewMultipleActivationKeysClient("<subscription-id>", cred, nil) + client, err := armwindowsesu.NewMultipleActivationKeysClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByResourceGroup("<resource-group-name>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/GetMultipleActivationKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/GetMultipleActivationKey.json func ExampleMultipleActivationKeysClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsesu.NewMultipleActivationKeysClient("<subscription-id>", cred, nil) + client, err := armwindowsesu.NewMultipleActivationKeysClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<multiple-activation-key-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.MultipleActivationKeysClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/CreateMultipleActivationKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/CreateMultipleActivationKey.json func ExampleMultipleActivationKeysClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsesu.NewMultipleActivationKeysClient("<subscription-id>", cred, nil) + client, err := armwindowsesu.NewMultipleActivationKeysClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } poller, err := client.BeginCreate(ctx, "<resource-group-name>", "<multiple-activation-key-name>", armwindowsesu.MultipleActivationKey{ - Location: to.StringPtr("<location>"), + Location: to.Ptr("<location>"), Properties: &armwindowsesu.MultipleActivationKeyProperties{ - AgreementNumber: to.StringPtr("<agreement-number>"), - InstalledServerNumber: to.Int32Ptr(100), - IsEligible: to.BoolPtr(true), - OSType: armwindowsesu.OsType("WindowsServer2008").ToPtr(), - SupportType: armwindowsesu.SupportType("SupplementalServicing").ToPtr(), + AgreementNumber: to.Ptr("<agreement-number>"), + InstalledServerNumber: to.Ptr[int32](100), + IsEligible: to.Ptr(true), + OSType: to.Ptr(armwindowsesu.OsTypeWindowsServer2008), + SupportType: to.Ptr(armwindowsesu.SupportTypeSupplementalServicing), }, }, - nil) + &armwindowsesu.MultipleActivationKeysClientBeginCreateOptions{ResumeToken: ""}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } res, err := poller.PollUntilDone(ctx, 30*time.Second) if err != nil { - log.Fatal(err) + log.Fatalf("failed to pull the result: %v", err) + return } - log.Printf("Response result: %#v\n", res.MultipleActivationKeysClientCreateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/UpdateMultipleActivationKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/UpdateMultipleActivationKey.json func ExampleMultipleActivationKeysClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsesu.NewMultipleActivationKeysClient("<subscription-id>", cred, nil) + client, err := armwindowsesu.NewMultipleActivationKeysClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "<resource-group-name>", "<multiple-activation-key-name>", armwindowsesu.MultipleActivationKeyUpdate{ Tags: map[string]*string{ - "tag1": to.StringPtr("value1"), - "tag2": to.StringPtr("value2"), + "tag1": to.Ptr("value1"), + "tag2": to.Ptr("value2"), }, }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.MultipleActivationKeysClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/DeleteMultipleActivationKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/DeleteMultipleActivationKey.json func ExampleMultipleActivationKeysClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsesu.NewMultipleActivationKeysClient("<subscription-id>", cred, nil) + client, err := armwindowsesu.NewMultipleActivationKeysClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } _, err = client.Delete(ctx, "<resource-group-name>", "<multiple-activation-key-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } } diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/windowsesu/armwindowsesu/ze_generated_example_operations_client_test.go index e9d108b932f4..1092eacb6176 100644 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/ze_generated_example_operations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,25 +16,29 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsesu/armwindowsesu" ) -// x-ms-original-file: specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/ListOperations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsesu/resource-manager/Microsoft.WindowsESU/preview/2019-09-16-preview/examples/ListOperations.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsesu.NewOperationsClient(cred, nil) + client, err := armwindowsesu.NewOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_constants.go b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_constants.go index 389a9ea1e0b0..d2714642bfad 100644 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_constants.go +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armwindowsesu const ( moduleName = "armwindowsesu" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // OsType - Type of OS for which the key is requested. @@ -31,11 +31,6 @@ func PossibleOsTypeValues() []OsType { } } -// ToPtr returns a *OsType pointing to the current value. -func (c OsType) ToPtr() *OsType { - return &c -} - type ProvisioningState string const ( @@ -57,11 +52,6 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// ToPtr returns a *ProvisioningState pointing to the current value. -func (c ProvisioningState) ToPtr() *ProvisioningState { - return &c -} - // SupportType - Type of support type SupportType string @@ -77,8 +67,3 @@ func PossibleSupportTypeValues() []SupportType { SupportTypeSupplementalServicing, } } - -// ToPtr returns a *SupportType pointing to the current value. -func (c SupportType) ToPtr() *SupportType { - return &c -} diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_models.go b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_models.go index ae1bd856941f..80e5635f23e9 100644 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_models.go +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armwindowsesu -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // ErrorDefinition - Error definition. type ErrorDefinition struct { @@ -27,15 +22,6 @@ type ErrorDefinition struct { Message *string `json:"message,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. -func (e ErrorDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - return json.Marshal(objectMap) -} - // ErrorResponse - Error response. type ErrorResponse struct { // The error details. @@ -63,18 +49,6 @@ type MultipleActivationKey struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type MultipleActivationKey. -func (m MultipleActivationKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - // MultipleActivationKeyList - List of MAK keys. type MultipleActivationKeyList struct { // List of MAK keys. @@ -84,14 +58,6 @@ type MultipleActivationKeyList struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type MultipleActivationKeyList. -func (m MultipleActivationKeyList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", m.NextLink) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - // MultipleActivationKeyProperties - MAK key specific properties. type MultipleActivationKeyProperties struct { // Agreement number under which the key is requested. @@ -120,78 +86,17 @@ type MultipleActivationKeyProperties struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type MultipleActivationKeyProperties. -func (m MultipleActivationKeyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "agreementNumber", m.AgreementNumber) - populateTimeRFC3339(objectMap, "expirationDate", m.ExpirationDate) - populate(objectMap, "installedServerNumber", m.InstalledServerNumber) - populate(objectMap, "isEligible", m.IsEligible) - populate(objectMap, "multipleActivationKey", m.MultipleActivationKey) - populate(objectMap, "osType", m.OSType) - populate(objectMap, "provisioningState", m.ProvisioningState) - populate(objectMap, "supportType", m.SupportType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MultipleActivationKeyProperties. -func (m *MultipleActivationKeyProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "agreementNumber": - err = unpopulate(val, &m.AgreementNumber) - delete(rawMsg, key) - case "expirationDate": - err = unpopulateTimeRFC3339(val, &m.ExpirationDate) - delete(rawMsg, key) - case "installedServerNumber": - err = unpopulate(val, &m.InstalledServerNumber) - delete(rawMsg, key) - case "isEligible": - err = unpopulate(val, &m.IsEligible) - delete(rawMsg, key) - case "multipleActivationKey": - err = unpopulate(val, &m.MultipleActivationKey) - delete(rawMsg, key) - case "osType": - err = unpopulate(val, &m.OSType) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &m.ProvisioningState) - delete(rawMsg, key) - case "supportType": - err = unpopulate(val, &m.SupportType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // MultipleActivationKeyUpdate - MAK key details. type MultipleActivationKeyUpdate struct { // Resource tags. Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type MultipleActivationKeyUpdate. -func (m MultipleActivationKeyUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", m.Tags) - return json.Marshal(objectMap) -} - // MultipleActivationKeysClientBeginCreateOptions contains the optional parameters for the MultipleActivationKeysClient.BeginCreate // method. type MultipleActivationKeysClientBeginCreateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // MultipleActivationKeysClientDeleteOptions contains the optional parameters for the MultipleActivationKeysClient.Delete @@ -248,14 +153,6 @@ type OperationList struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type OperationList. -func (o OperationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -291,31 +188,3 @@ type TrackedResource struct { // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_models_serde.go b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_models_serde.go new file mode 100644 index 000000000000..06e3866fdff4 --- /dev/null +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_models_serde.go @@ -0,0 +1,142 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armwindowsesu + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. +func (e ErrorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MultipleActivationKey. +func (m MultipleActivationKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MultipleActivationKeyList. +func (m MultipleActivationKeyList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MultipleActivationKeyProperties. +func (m MultipleActivationKeyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agreementNumber", m.AgreementNumber) + populateTimeRFC3339(objectMap, "expirationDate", m.ExpirationDate) + populate(objectMap, "installedServerNumber", m.InstalledServerNumber) + populate(objectMap, "isEligible", m.IsEligible) + populate(objectMap, "multipleActivationKey", m.MultipleActivationKey) + populate(objectMap, "osType", m.OSType) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "supportType", m.SupportType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MultipleActivationKeyProperties. +func (m *MultipleActivationKeyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "agreementNumber": + err = unpopulate(val, &m.AgreementNumber) + delete(rawMsg, key) + case "expirationDate": + err = unpopulateTimeRFC3339(val, &m.ExpirationDate) + delete(rawMsg, key) + case "installedServerNumber": + err = unpopulate(val, &m.InstalledServerNumber) + delete(rawMsg, key) + case "isEligible": + err = unpopulate(val, &m.IsEligible) + delete(rawMsg, key) + case "multipleActivationKey": + err = unpopulate(val, &m.MultipleActivationKey) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, &m.OSType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &m.ProvisioningState) + delete(rawMsg, key) + case "supportType": + err = unpopulate(val, &m.SupportType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MultipleActivationKeyUpdate. +func (m MultipleActivationKeyUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OperationList. +func (o OperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_multipleactivationkeys_client.go b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_multipleactivationkeys_client.go index 0fc9e905ca31..995764f23189 100644 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_multipleactivationkeys_client.go +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_multipleactivationkeys_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type MultipleActivationKeysClient struct { // subscriptionID - The ID of the target subscription. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewMultipleActivationKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MultipleActivationKeysClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewMultipleActivationKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MultipleActivationKeysClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &MultipleActivationKeysClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreate - Create a MAK key. @@ -56,22 +61,16 @@ func NewMultipleActivationKeysClient(subscriptionID string, credential azcore.To // multipleActivationKey - Details of the MAK key. // options - MultipleActivationKeysClientBeginCreateOptions contains the optional parameters for the MultipleActivationKeysClient.BeginCreate // method. -func (client *MultipleActivationKeysClient) BeginCreate(ctx context.Context, resourceGroupName string, multipleActivationKeyName string, multipleActivationKey MultipleActivationKey, options *MultipleActivationKeysClientBeginCreateOptions) (MultipleActivationKeysClientCreatePollerResponse, error) { - resp, err := client.create(ctx, resourceGroupName, multipleActivationKeyName, multipleActivationKey, options) - if err != nil { - return MultipleActivationKeysClientCreatePollerResponse{}, err - } - result := MultipleActivationKeysClientCreatePollerResponse{ - RawResponse: resp, +func (client *MultipleActivationKeysClient) BeginCreate(ctx context.Context, resourceGroupName string, multipleActivationKeyName string, multipleActivationKey MultipleActivationKey, options *MultipleActivationKeysClientBeginCreateOptions) (*armruntime.Poller[MultipleActivationKeysClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, multipleActivationKeyName, multipleActivationKey, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[MultipleActivationKeysClientCreateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[MultipleActivationKeysClientCreateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("MultipleActivationKeysClient.Create", "", resp, client.pl) - if err != nil { - return MultipleActivationKeysClientCreatePollerResponse{}, err - } - result.Poller = &MultipleActivationKeysClientCreatePoller{ - pt: pt, - } - return result, nil } // Create - Create a MAK key. @@ -135,7 +134,7 @@ func (client *MultipleActivationKeysClient) Delete(ctx context.Context, resource if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return MultipleActivationKeysClientDeleteResponse{}, runtime.NewResponseError(resp) } - return MultipleActivationKeysClientDeleteResponse{RawResponse: resp}, nil + return MultipleActivationKeysClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -213,7 +212,7 @@ func (client *MultipleActivationKeysClient) getCreateRequest(ctx context.Context // getHandleResponse handles the Get response. func (client *MultipleActivationKeysClient) getHandleResponse(resp *http.Response) (MultipleActivationKeysClientGetResponse, error) { - result := MultipleActivationKeysClientGetResponse{RawResponse: resp} + result := MultipleActivationKeysClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.MultipleActivationKey); err != nil { return MultipleActivationKeysClientGetResponse{}, err } @@ -224,16 +223,32 @@ func (client *MultipleActivationKeysClient) getHandleResponse(resp *http.Respons // If the operation fails it returns an *azcore.ResponseError type. // options - MultipleActivationKeysClientListOptions contains the optional parameters for the MultipleActivationKeysClient.List // method. -func (client *MultipleActivationKeysClient) List(options *MultipleActivationKeysClientListOptions) *MultipleActivationKeysClientListPager { - return &MultipleActivationKeysClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *MultipleActivationKeysClient) List(options *MultipleActivationKeysClientListOptions) *runtime.Pager[MultipleActivationKeysClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[MultipleActivationKeysClientListResponse]{ + More: func(page MultipleActivationKeysClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp MultipleActivationKeysClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.MultipleActivationKeyList.NextLink) + Fetcher: func(ctx context.Context, page *MultipleActivationKeysClientListResponse) (MultipleActivationKeysClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return MultipleActivationKeysClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MultipleActivationKeysClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MultipleActivationKeysClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -256,7 +271,7 @@ func (client *MultipleActivationKeysClient) listCreateRequest(ctx context.Contex // listHandleResponse handles the List response. func (client *MultipleActivationKeysClient) listHandleResponse(resp *http.Response) (MultipleActivationKeysClientListResponse, error) { - result := MultipleActivationKeysClientListResponse{RawResponse: resp} + result := MultipleActivationKeysClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.MultipleActivationKeyList); err != nil { return MultipleActivationKeysClientListResponse{}, err } @@ -268,16 +283,32 @@ func (client *MultipleActivationKeysClient) listHandleResponse(resp *http.Respon // resourceGroupName - The name of the resource group. The name is case insensitive. // options - MultipleActivationKeysClientListByResourceGroupOptions contains the optional parameters for the MultipleActivationKeysClient.ListByResourceGroup // method. -func (client *MultipleActivationKeysClient) ListByResourceGroup(resourceGroupName string, options *MultipleActivationKeysClientListByResourceGroupOptions) *MultipleActivationKeysClientListByResourceGroupPager { - return &MultipleActivationKeysClientListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) +func (client *MultipleActivationKeysClient) ListByResourceGroup(resourceGroupName string, options *MultipleActivationKeysClientListByResourceGroupOptions) *runtime.Pager[MultipleActivationKeysClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[MultipleActivationKeysClientListByResourceGroupResponse]{ + More: func(page MultipleActivationKeysClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp MultipleActivationKeysClientListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.MultipleActivationKeyList.NextLink) + Fetcher: func(ctx context.Context, page *MultipleActivationKeysClientListByResourceGroupResponse) (MultipleActivationKeysClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return MultipleActivationKeysClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MultipleActivationKeysClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MultipleActivationKeysClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) }, - } + }) } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. @@ -304,7 +335,7 @@ func (client *MultipleActivationKeysClient) listByResourceGroupCreateRequest(ctx // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *MultipleActivationKeysClient) listByResourceGroupHandleResponse(resp *http.Response) (MultipleActivationKeysClientListByResourceGroupResponse, error) { - result := MultipleActivationKeysClientListByResourceGroupResponse{RawResponse: resp} + result := MultipleActivationKeysClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.MultipleActivationKeyList); err != nil { return MultipleActivationKeysClientListByResourceGroupResponse{}, err } @@ -361,7 +392,7 @@ func (client *MultipleActivationKeysClient) updateCreateRequest(ctx context.Cont // updateHandleResponse handles the Update response. func (client *MultipleActivationKeysClient) updateHandleResponse(resp *http.Response) (MultipleActivationKeysClientUpdateResponse, error) { - result := MultipleActivationKeysClientUpdateResponse{RawResponse: resp} + result := MultipleActivationKeysClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.MultipleActivationKey); err != nil { return MultipleActivationKeysClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_operations_client.go b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_operations_client.go index 183c76b0da67..51567e621b2e 100644 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_operations_client.go +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,34 +29,54 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - List all available Windows.ESU provider operations. // If the operation fails it returns an *azcore.ResponseError type. // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(options *OperationsClientListOptions) *OperationsClientListPager { - return &OperationsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *OperationsClient) List(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp OperationsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationList.NextLink) + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -74,7 +95,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationList); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_pagers.go b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_pagers.go deleted file mode 100644 index 2e6f861a7712..000000000000 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_pagers.go +++ /dev/null @@ -1,179 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armwindowsesu - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// MultipleActivationKeysClientListByResourceGroupPager provides operations for iterating over paged responses. -type MultipleActivationKeysClientListByResourceGroupPager struct { - client *MultipleActivationKeysClient - current MultipleActivationKeysClientListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, MultipleActivationKeysClientListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *MultipleActivationKeysClientListByResourceGroupPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *MultipleActivationKeysClientListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.MultipleActivationKeyList.NextLink == nil || len(*p.current.MultipleActivationKeyList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByResourceGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current MultipleActivationKeysClientListByResourceGroupResponse page. -func (p *MultipleActivationKeysClientListByResourceGroupPager) PageResponse() MultipleActivationKeysClientListByResourceGroupResponse { - return p.current -} - -// MultipleActivationKeysClientListPager provides operations for iterating over paged responses. -type MultipleActivationKeysClientListPager struct { - client *MultipleActivationKeysClient - current MultipleActivationKeysClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, MultipleActivationKeysClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *MultipleActivationKeysClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *MultipleActivationKeysClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.MultipleActivationKeyList.NextLink == nil || len(*p.current.MultipleActivationKeyList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current MultipleActivationKeysClientListResponse page. -func (p *MultipleActivationKeysClientListPager) PageResponse() MultipleActivationKeysClientListResponse { - return p.current -} - -// OperationsClientListPager provides operations for iterating over paged responses. -type OperationsClientListPager struct { - client *OperationsClient - current OperationsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, OperationsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *OperationsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *OperationsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.OperationList.NextLink == nil || len(*p.current.OperationList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current OperationsClientListResponse page. -func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse { - return p.current -} diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_pollers.go b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_pollers.go deleted file mode 100644 index 8c17165d5257..000000000000 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_pollers.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armwindowsesu - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// MultipleActivationKeysClientCreatePoller provides polling facilities until the operation reaches a terminal state. -type MultipleActivationKeysClientCreatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *MultipleActivationKeysClientCreatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *MultipleActivationKeysClientCreatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final MultipleActivationKeysClientCreateResponse will be returned. -func (p *MultipleActivationKeysClientCreatePoller) FinalResponse(ctx context.Context) (MultipleActivationKeysClientCreateResponse, error) { - respType := MultipleActivationKeysClientCreateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.MultipleActivationKey) - if err != nil { - return MultipleActivationKeysClientCreateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *MultipleActivationKeysClientCreatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_response_types.go b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_response_types.go index 61171d2fb2f6..64e1d94cc384 100644 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_response_types.go +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,127 +8,37 @@ package armwindowsesu -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - -// MultipleActivationKeysClientCreatePollerResponse contains the response from method MultipleActivationKeysClient.Create. -type MultipleActivationKeysClientCreatePollerResponse struct { - // Poller contains an initialized poller. - Poller *MultipleActivationKeysClientCreatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l MultipleActivationKeysClientCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MultipleActivationKeysClientCreateResponse, error) { - respType := MultipleActivationKeysClientCreateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.MultipleActivationKey) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a MultipleActivationKeysClientCreatePollerResponse from the provided client and resume token. -func (l *MultipleActivationKeysClientCreatePollerResponse) Resume(ctx context.Context, client *MultipleActivationKeysClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("MultipleActivationKeysClient.Create", token, client.pl) - if err != nil { - return err - } - poller := &MultipleActivationKeysClientCreatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // MultipleActivationKeysClientCreateResponse contains the response from method MultipleActivationKeysClient.Create. type MultipleActivationKeysClientCreateResponse struct { - MultipleActivationKeysClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MultipleActivationKeysClientCreateResult contains the result from method MultipleActivationKeysClient.Create. -type MultipleActivationKeysClientCreateResult struct { MultipleActivationKey } // MultipleActivationKeysClientDeleteResponse contains the response from method MultipleActivationKeysClient.Delete. type MultipleActivationKeysClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // MultipleActivationKeysClientGetResponse contains the response from method MultipleActivationKeysClient.Get. type MultipleActivationKeysClientGetResponse struct { - MultipleActivationKeysClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MultipleActivationKeysClientGetResult contains the result from method MultipleActivationKeysClient.Get. -type MultipleActivationKeysClientGetResult struct { MultipleActivationKey } // MultipleActivationKeysClientListByResourceGroupResponse contains the response from method MultipleActivationKeysClient.ListByResourceGroup. type MultipleActivationKeysClientListByResourceGroupResponse struct { - MultipleActivationKeysClientListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MultipleActivationKeysClientListByResourceGroupResult contains the result from method MultipleActivationKeysClient.ListByResourceGroup. -type MultipleActivationKeysClientListByResourceGroupResult struct { MultipleActivationKeyList } // MultipleActivationKeysClientListResponse contains the response from method MultipleActivationKeysClient.List. type MultipleActivationKeysClientListResponse struct { - MultipleActivationKeysClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MultipleActivationKeysClientListResult contains the result from method MultipleActivationKeysClient.List. -type MultipleActivationKeysClientListResult struct { MultipleActivationKeyList } // MultipleActivationKeysClientUpdateResponse contains the response from method MultipleActivationKeysClient.Update. type MultipleActivationKeysClientUpdateResponse struct { - MultipleActivationKeysClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// MultipleActivationKeysClientUpdateResult contains the result from method MultipleActivationKeysClient.Update. -type MultipleActivationKeysClientUpdateResult struct { MultipleActivationKey } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationList } diff --git a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_time_rfc3339.go b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_time_rfc3339.go index 6586befc3255..d6dec3e45558 100644 --- a/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/windowsesu/armwindowsesu/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/CHANGELOG.md b/sdk/resourcemanager/windowsiot/armwindowsiot/CHANGELOG.md index acbe13099498..9ba1d6a9cf8a 100644 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/CHANGELOG.md +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/CHANGELOG.md @@ -1,5 +1,63 @@ # Release History +## 0.3.0 (2022-04-13) +### Breaking Changes + +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `*ServicesClient.ListByResourceGroup` return value(s) have been changed from `(*ServicesClientListByResourceGroupPager)` to `(*runtime.Pager[ServicesClientListByResourceGroupResponse])` +- Function `*ServicesClient.List` return value(s) have been changed from `(*ServicesClientListPager)` to `(*runtime.Pager[ServicesClientListResponse])` +- Function `*OperationsClient.List` return value(s) have been changed from `(*OperationsClientListPager)` to `(*runtime.Pager[OperationsClientListResponse])` +- Function `NewServicesClient` return value(s) have been changed from `(*ServicesClient)` to `(*ServicesClient, error)` +- Function `*OperationsClientListPager.NextPage` has been removed +- Function `*OperationsClientListPager.PageResponse` has been removed +- Function `*ServicesClientListByResourceGroupPager.NextPage` has been removed +- Function `ServiceNameUnavailabilityReason.ToPtr` has been removed +- Function `*OperationsClientListPager.Err` has been removed +- Function `*ServicesClientListPager.PageResponse` has been removed +- Function `*ServicesClientListByResourceGroupPager.Err` has been removed +- Function `*ServicesClientListPager.Err` has been removed +- Function `*ServicesClientListPager.NextPage` has been removed +- Function `*ServicesClientListByResourceGroupPager.PageResponse` has been removed +- Struct `OperationsClientListPager` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `ServicesClientCheckDeviceServiceNameAvailabilityResult` has been removed +- Struct `ServicesClientCreateOrUpdateResult` has been removed +- Struct `ServicesClientDeleteResult` has been removed +- Struct `ServicesClientGetResult` has been removed +- Struct `ServicesClientListByResourceGroupPager` has been removed +- Struct `ServicesClientListByResourceGroupResult` has been removed +- Struct `ServicesClientListPager` has been removed +- Struct `ServicesClientListResult` has been removed +- Struct `ServicesClientUpdateResult` has been removed +- Field `ServicesClientListResult` of struct `ServicesClientListResponse` has been removed +- Field `RawResponse` of struct `ServicesClientListResponse` has been removed +- Field `ServicesClientCheckDeviceServiceNameAvailabilityResult` of struct `ServicesClientCheckDeviceServiceNameAvailabilityResponse` has been removed +- Field `RawResponse` of struct `ServicesClientCheckDeviceServiceNameAvailabilityResponse` has been removed +- Field `ServicesClientCreateOrUpdateResult` of struct `ServicesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ServicesClientCreateOrUpdateResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `ServicesClientUpdateResult` of struct `ServicesClientUpdateResponse` has been removed +- Field `RawResponse` of struct `ServicesClientUpdateResponse` has been removed +- Field `ServicesClientGetResult` of struct `ServicesClientGetResponse` has been removed +- Field `RawResponse` of struct `ServicesClientGetResponse` has been removed +- Field `ServicesClientDeleteResult` of struct `ServicesClientDeleteResponse` has been removed +- Field `RawResponse` of struct `ServicesClientDeleteResponse` has been removed +- Field `ServicesClientListByResourceGroupResult` of struct `ServicesClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `ServicesClientListByResourceGroupResponse` has been removed + +### Features Added + +- New anonymous field `DeviceService` in struct `ServicesClientDeleteResponse` +- New anonymous field `DeviceServiceDescriptionListResult` in struct `ServicesClientListByResourceGroupResponse` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New anonymous field `DeviceServiceDescriptionListResult` in struct `ServicesClientListResponse` +- New anonymous field `DeviceService` in struct `ServicesClientCreateOrUpdateResponse` +- New anonymous field `DeviceService` in struct `ServicesClientGetResponse` +- New anonymous field `DeviceServiceNameAvailabilityInfo` in struct `ServicesClientCheckDeviceServiceNameAvailabilityResponse` +- New anonymous field `DeviceService` in struct `ServicesClientUpdateResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/README.md b/sdk/resourcemanager/windowsiot/armwindowsiot/README.md index b35c11378773..950a8d14d9f5 100644 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/README.md +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/README.md @@ -11,7 +11,7 @@ The `armwindowsiot` module provides operations for working with Azure Windows Io ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Windows IoT modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -client := armwindowsiot.NewServicesClient(<subscription ID>, cred, nil) +client, err := armwindowsiot.NewServicesClient(<subscription ID>, cred, nil) ``` You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armwindowsiot.NewServicesClient(<subscription ID>, cred, &options) +client, err := armwindowsiot.NewServicesClient(<subscription ID>, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/autorest.md b/sdk/resourcemanager/windowsiot/armwindowsiot/autorest.md index 2e9904d53100..1d8390de8fcc 100644 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/autorest.md +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/windowsiot/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/windowsiot/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/windowsiot/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/windowsiot/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/go.mod b/sdk/resourcemanager/windowsiot/armwindowsiot/go.mod index d66612b2f2c1..70b0eedc1cba 100644 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/go.mod +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsiot/armwindowsiot -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/go.sum b/sdk/resourcemanager/windowsiot/armwindowsiot/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/go.sum +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/windowsiot/armwindowsiot/ze_generated_example_operations_client_test.go index b91071aef3a6..a01dc395b8e0 100644 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/ze_generated_example_operations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,25 +16,29 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsiot/armwindowsiot" ) -// x-ms-original-file: specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/OperationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/OperationsList.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsiot.NewOperationsClient(cred, nil) + client, err := armwindowsiot.NewOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/ze_generated_example_services_client_test.go b/sdk/resourcemanager/windowsiot/armwindowsiot/ze_generated_example_services_client_test.go index 2e7c3dd11fe2..4ba9fbf00ca9 100644 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/ze_generated_example_services_client_test.go +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/ze_generated_example_services_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -17,158 +17,201 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/windowsiot/armwindowsiot" ) -// x-ms-original-file: specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_GetProperties.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_GetProperties.json func ExampleServicesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + client, err := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<resource-group-name>", "<device-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ServicesClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_Create.json func ExampleServicesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + client, err := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CreateOrUpdate(ctx, "<resource-group-name>", "<device-name>", armwindowsiot.DeviceService{ - Location: to.StringPtr("<location>"), + Location: to.Ptr("<location>"), Properties: &armwindowsiot.DeviceServiceProperties{ - AdminDomainName: to.StringPtr("<admin-domain-name>"), - BillingDomainName: to.StringPtr("<billing-domain-name>"), - Notes: to.StringPtr("<notes>"), - Quantity: to.Int64Ptr(1000000), + AdminDomainName: to.Ptr("<admin-domain-name>"), + BillingDomainName: to.Ptr("<billing-domain-name>"), + Notes: to.Ptr("<notes>"), + Quantity: to.Ptr[int64](1000000), }, }, &armwindowsiot.ServicesClientCreateOrUpdateOptions{IfMatch: nil}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ServicesClientCreateOrUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_Update.json func ExampleServicesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + client, err := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Update(ctx, "<resource-group-name>", "<device-name>", armwindowsiot.DeviceService{ - Location: to.StringPtr("<location>"), + Location: to.Ptr("<location>"), Properties: &armwindowsiot.DeviceServiceProperties{ - AdminDomainName: to.StringPtr("<admin-domain-name>"), - BillingDomainName: to.StringPtr("<billing-domain-name>"), - Notes: to.StringPtr("<notes>"), - Quantity: to.Int64Ptr(1000000), + AdminDomainName: to.Ptr("<admin-domain-name>"), + BillingDomainName: to.Ptr("<billing-domain-name>"), + Notes: to.Ptr("<notes>"), + Quantity: to.Ptr[int64](1000000), }, }, &armwindowsiot.ServicesClientUpdateOptions{IfMatch: nil}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ServicesClientUpdateResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_Delete.json func ExampleServicesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + client, err := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Delete(ctx, "<resource-group-name>", "<device-name>", nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ServicesClientDeleteResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_ListByResourceGroup.json func ExampleServicesClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + client, err := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListByResourceGroup("<resource-group-name>", nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_List.json func ExampleServicesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + client, err := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_CheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/windowsiot/resource-manager/Microsoft.WindowsIoT/stable/2019-06-01/examples/Service_CheckNameAvailability.json func ExampleServicesClient_CheckDeviceServiceNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + client, err := armwindowsiot.NewServicesClient("<subscription-id>", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.CheckDeviceServiceNameAvailability(ctx, armwindowsiot.DeviceServiceCheckNameAvailabilityParameters{ - Name: to.StringPtr("<name>"), + Name: to.Ptr("<name>"), }, nil) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.ServicesClientCheckDeviceServiceNameAvailabilityResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_constants.go b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_constants.go index 3339d01e9074..fa179995d87a 100644 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_constants.go +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armwindowsiot const ( moduleName = "armwindowsiot" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // ServiceNameUnavailabilityReason - The reason for unavailability. @@ -28,8 +28,3 @@ func PossibleServiceNameUnavailabilityReasonValues() []ServiceNameUnavailability ServiceNameUnavailabilityReasonAlreadyExists, } } - -// ToPtr returns a *ServiceNameUnavailabilityReason pointing to the current value. -func (c ServiceNameUnavailabilityReason) ToPtr() *ServiceNameUnavailabilityReason { - return &c -} diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_models.go b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_models.go index 0ed82ac470d3..31d6f36e16fb 100644 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_models.go +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armwindowsiot -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // DeviceService - The description of the Windows IoT Device Service. type DeviceService struct { @@ -40,19 +35,6 @@ type DeviceService struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type DeviceService. -func (d DeviceService) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", d.Etag) - populate(objectMap, "id", d.ID) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - // DeviceServiceCheckNameAvailabilityParameters - Input values. type DeviceServiceCheckNameAvailabilityParameters struct { // REQUIRED; The name of the Windows IoT Device Service to check. @@ -68,14 +50,6 @@ type DeviceServiceDescriptionListResult struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type DeviceServiceDescriptionListResult. -func (d DeviceServiceDescriptionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - // DeviceServiceNameAvailabilityInfo - The properties indicating whether a given Windows IoT Device Service name is available. type DeviceServiceNameAvailabilityInfo struct { // The detailed reason message. @@ -106,49 +80,6 @@ type DeviceServiceProperties struct { StartDate *time.Time `json:"startDate,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type DeviceServiceProperties. -func (d DeviceServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "adminDomainName", d.AdminDomainName) - populate(objectMap, "billingDomainName", d.BillingDomainName) - populate(objectMap, "notes", d.Notes) - populate(objectMap, "quantity", d.Quantity) - populateTimeRFC3339(objectMap, "startDate", d.StartDate) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceServiceProperties. -func (d *DeviceServiceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "adminDomainName": - err = unpopulate(val, &d.AdminDomainName) - delete(rawMsg, key) - case "billingDomainName": - err = unpopulate(val, &d.BillingDomainName) - delete(rawMsg, key) - case "notes": - err = unpopulate(val, &d.Notes) - delete(rawMsg, key) - case "quantity": - err = unpopulate(val, &d.Quantity) - delete(rawMsg, key) - case "startDate": - err = unpopulateTimeRFC3339(val, &d.StartDate) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ErrorDetails - The details of the error. type ErrorDetails struct { // The error object. @@ -210,14 +141,6 @@ type OperationListResult struct { Value []*OperationEntity `json:"value,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -305,31 +228,3 @@ type TrackedResource struct { // READ-ONLY; The type of the resource. Type *string `json:"type,omitempty" azure:"ro"` } - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_models_serde.go b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_models_serde.go new file mode 100644 index 000000000000..3926e40afc50 --- /dev/null +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_models_serde.go @@ -0,0 +1,115 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armwindowsiot + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type DeviceService. +func (d DeviceService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DeviceServiceDescriptionListResult. +func (d DeviceServiceDescriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DeviceServiceProperties. +func (d DeviceServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "adminDomainName", d.AdminDomainName) + populate(objectMap, "billingDomainName", d.BillingDomainName) + populate(objectMap, "notes", d.Notes) + populate(objectMap, "quantity", d.Quantity) + populateTimeRFC3339(objectMap, "startDate", d.StartDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceServiceProperties. +func (d *DeviceServiceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "adminDomainName": + err = unpopulate(val, &d.AdminDomainName) + delete(rawMsg, key) + case "billingDomainName": + err = unpopulate(val, &d.BillingDomainName) + delete(rawMsg, key) + case "notes": + err = unpopulate(val, &d.Notes) + delete(rawMsg, key) + case "quantity": + err = unpopulate(val, &d.Quantity) + delete(rawMsg, key) + case "startDate": + err = unpopulateTimeRFC3339(val, &d.StartDate) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_operations_client.go b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_operations_client.go index 4c5414b92d75..5a01294efdfd 100644 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_operations_client.go +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,34 +29,54 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Lists all of the available Windows IoT Services REST API operations. // If the operation fails it returns an *azcore.ResponseError type. // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(options *OperationsClientListOptions) *OperationsClientListPager { - return &OperationsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *OperationsClient) List(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp OperationsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationListResult.NextLink) + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -74,7 +95,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_pagers.go b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_pagers.go deleted file mode 100644 index 3e5e8a6cca4d..000000000000 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_pagers.go +++ /dev/null @@ -1,179 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armwindowsiot - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// OperationsClientListPager provides operations for iterating over paged responses. -type OperationsClientListPager struct { - client *OperationsClient - current OperationsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, OperationsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *OperationsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *OperationsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.OperationListResult.NextLink == nil || len(*p.current.OperationListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current OperationsClientListResponse page. -func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse { - return p.current -} - -// ServicesClientListByResourceGroupPager provides operations for iterating over paged responses. -type ServicesClientListByResourceGroupPager struct { - client *ServicesClient - current ServicesClientListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ServicesClientListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ServicesClientListByResourceGroupPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ServicesClientListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DeviceServiceDescriptionListResult.NextLink == nil || len(*p.current.DeviceServiceDescriptionListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByResourceGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ServicesClientListByResourceGroupResponse page. -func (p *ServicesClientListByResourceGroupPager) PageResponse() ServicesClientListByResourceGroupResponse { - return p.current -} - -// ServicesClientListPager provides operations for iterating over paged responses. -type ServicesClientListPager struct { - client *ServicesClient - current ServicesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ServicesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ServicesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ServicesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DeviceServiceDescriptionListResult.NextLink == nil || len(*p.current.DeviceServiceDescriptionListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ServicesClientListResponse page. -func (p *ServicesClientListPager) PageResponse() ServicesClientListResponse { - return p.current -} diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_response_types.go b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_response_types.go index c2ea8fd1d306..eaf0e725a0ce 100644 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_response_types.go +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,100 +8,42 @@ package armwindowsiot -import "net/http" - // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationListResult } // ServicesClientCheckDeviceServiceNameAvailabilityResponse contains the response from method ServicesClient.CheckDeviceServiceNameAvailability. type ServicesClientCheckDeviceServiceNameAvailabilityResponse struct { - ServicesClientCheckDeviceServiceNameAvailabilityResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServicesClientCheckDeviceServiceNameAvailabilityResult contains the result from method ServicesClient.CheckDeviceServiceNameAvailability. -type ServicesClientCheckDeviceServiceNameAvailabilityResult struct { DeviceServiceNameAvailabilityInfo } // ServicesClientCreateOrUpdateResponse contains the response from method ServicesClient.CreateOrUpdate. type ServicesClientCreateOrUpdateResponse struct { - ServicesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServicesClientCreateOrUpdateResult contains the result from method ServicesClient.CreateOrUpdate. -type ServicesClientCreateOrUpdateResult struct { DeviceService } // ServicesClientDeleteResponse contains the response from method ServicesClient.Delete. type ServicesClientDeleteResponse struct { - ServicesClientDeleteResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServicesClientDeleteResult contains the result from method ServicesClient.Delete. -type ServicesClientDeleteResult struct { DeviceService } // ServicesClientGetResponse contains the response from method ServicesClient.Get. type ServicesClientGetResponse struct { - ServicesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServicesClientGetResult contains the result from method ServicesClient.Get. -type ServicesClientGetResult struct { DeviceService } // ServicesClientListByResourceGroupResponse contains the response from method ServicesClient.ListByResourceGroup. type ServicesClientListByResourceGroupResponse struct { - ServicesClientListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServicesClientListByResourceGroupResult contains the result from method ServicesClient.ListByResourceGroup. -type ServicesClientListByResourceGroupResult struct { DeviceServiceDescriptionListResult } // ServicesClientListResponse contains the response from method ServicesClient.List. type ServicesClientListResponse struct { - ServicesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServicesClientListResult contains the result from method ServicesClient.List. -type ServicesClientListResult struct { DeviceServiceDescriptionListResult } // ServicesClientUpdateResponse contains the response from method ServicesClient.Update. type ServicesClientUpdateResponse struct { - ServicesClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServicesClientUpdateResult contains the result from method ServicesClient.Update. -type ServicesClientUpdateResult struct { DeviceService } diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_services_client.go b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_services_client.go index 83ad797a6488..36ef031315d3 100644 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_services_client.go +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_services_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ServicesClient struct { // subscriptionID - The subscription identifier. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServicesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServicesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ServicesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CheckDeviceServiceNameAvailability - Check if a Windows IoT Device Service name is available. @@ -90,7 +95,7 @@ func (client *ServicesClient) checkDeviceServiceNameAvailabilityCreateRequest(ct // checkDeviceServiceNameAvailabilityHandleResponse handles the CheckDeviceServiceNameAvailability response. func (client *ServicesClient) checkDeviceServiceNameAvailabilityHandleResponse(resp *http.Response) (ServicesClientCheckDeviceServiceNameAvailabilityResponse, error) { - result := ServicesClientCheckDeviceServiceNameAvailabilityResponse{RawResponse: resp} + result := ServicesClientCheckDeviceServiceNameAvailabilityResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeviceServiceNameAvailabilityInfo); err != nil { return ServicesClientCheckDeviceServiceNameAvailabilityResponse{}, err } @@ -151,7 +156,7 @@ func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, r // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *ServicesClient) createOrUpdateHandleResponse(resp *http.Response) (ServicesClientCreateOrUpdateResponse, error) { - result := ServicesClientCreateOrUpdateResponse{RawResponse: resp} + result := ServicesClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeviceService); err != nil { return ServicesClientCreateOrUpdateResponse{}, err } @@ -206,7 +211,7 @@ func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceG // deleteHandleResponse handles the Delete response. func (client *ServicesClient) deleteHandleResponse(resp *http.Response) (ServicesClientDeleteResponse, error) { - result := ServicesClientDeleteResponse{RawResponse: resp} + result := ServicesClientDeleteResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeviceService); err != nil { return ServicesClientDeleteResponse{}, err } @@ -261,7 +266,7 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGrou // getHandleResponse handles the Get response. func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesClientGetResponse, error) { - result := ServicesClientGetResponse{RawResponse: resp} + result := ServicesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeviceService); err != nil { return ServicesClientGetResponse{}, err } @@ -271,16 +276,32 @@ func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesCl // List - Get all the IoT hubs in a subscription. // If the operation fails it returns an *azcore.ResponseError type. // options - ServicesClientListOptions contains the optional parameters for the ServicesClient.List method. -func (client *ServicesClient) List(options *ServicesClientListOptions) *ServicesClientListPager { - return &ServicesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *ServicesClient) List(options *ServicesClientListOptions) *runtime.Pager[ServicesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ServicesClientListResponse]{ + More: func(page ServicesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ServicesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DeviceServiceDescriptionListResult.NextLink) + Fetcher: func(ctx context.Context, page *ServicesClientListResponse) (ServicesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ServicesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServicesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServicesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -303,7 +324,7 @@ func (client *ServicesClient) listCreateRequest(ctx context.Context, options *Se // listHandleResponse handles the List response. func (client *ServicesClient) listHandleResponse(resp *http.Response) (ServicesClientListResponse, error) { - result := ServicesClientListResponse{RawResponse: resp} + result := ServicesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeviceServiceDescriptionListResult); err != nil { return ServicesClientListResponse{}, err } @@ -315,16 +336,32 @@ func (client *ServicesClient) listHandleResponse(resp *http.Response) (ServicesC // resourceGroupName - The name of the resource group that contains the Windows IoT Device Service. // options - ServicesClientListByResourceGroupOptions contains the optional parameters for the ServicesClient.ListByResourceGroup // method. -func (client *ServicesClient) ListByResourceGroup(resourceGroupName string, options *ServicesClientListByResourceGroupOptions) *ServicesClientListByResourceGroupPager { - return &ServicesClientListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) +func (client *ServicesClient) ListByResourceGroup(resourceGroupName string, options *ServicesClientListByResourceGroupOptions) *runtime.Pager[ServicesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[ServicesClientListByResourceGroupResponse]{ + More: func(page ServicesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ServicesClientListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DeviceServiceDescriptionListResult.NextLink) + Fetcher: func(ctx context.Context, page *ServicesClientListByResourceGroupResponse) (ServicesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ServicesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServicesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServicesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) }, - } + }) } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. @@ -351,7 +388,7 @@ func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Conte // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *ServicesClient) listByResourceGroupHandleResponse(resp *http.Response) (ServicesClientListByResourceGroupResponse, error) { - result := ServicesClientListByResourceGroupResponse{RawResponse: resp} + result := ServicesClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeviceServiceDescriptionListResult); err != nil { return ServicesClientListByResourceGroupResponse{}, err } @@ -412,7 +449,7 @@ func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceG // updateHandleResponse handles the Update response. func (client *ServicesClient) updateHandleResponse(resp *http.Response) (ServicesClientUpdateResponse, error) { - result := ServicesClientUpdateResponse{RawResponse: resp} + result := ServicesClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeviceService); err != nil { return ServicesClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_time_rfc3339.go b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_time_rfc3339.go index fdf762a3248e..87cba088d7cc 100644 --- a/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/windowsiot/armwindowsiot/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/CHANGELOG.md b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/CHANGELOG.md index 32c30a6f482e..0563f18790eb 100644 --- a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/CHANGELOG.md +++ b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/CHANGELOG.md @@ -1,5 +1,55 @@ # Release History +## 0.3.0 (2022-04-13) +### Breaking Changes + +- Function `NewHealthMonitorsClient` return value(s) have been changed from `(*HealthMonitorsClient)` to `(*HealthMonitorsClient, error)` +- Function `*HealthMonitorsClient.List` return value(s) have been changed from `(*HealthMonitorsClientListPager)` to `(*runtime.Pager[HealthMonitorsClientListResponse])` +- Function `*HealthMonitorsClient.ListStateChanges` return value(s) have been changed from `(*HealthMonitorsClientListStateChangesPager)` to `(*runtime.Pager[HealthMonitorsClientListStateChangesResponse])` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `*OperationsClient.List` return value(s) have been changed from `(*OperationsClientListPager)` to `(*runtime.Pager[OperationsClientListResponse])` +- Type of `HealthMonitorProperties.MonitorConfiguration` has been changed from `map[string]interface{}` to `interface{}` +- Type of `HealthMonitorProperties.Evidence` has been changed from `map[string]interface{}` to `interface{}` +- Type of `HealthMonitorStateChangeProperties.Evidence` has been changed from `map[string]interface{}` to `interface{}` +- Type of `HealthMonitorStateChangeProperties.MonitorConfiguration` has been changed from `map[string]interface{}` to `interface{}` +- Function `*OperationsClientListPager.Err` has been removed +- Function `HealthState.ToPtr` has been removed +- Function `*HealthMonitorsClientListStateChangesPager.PageResponse` has been removed +- Function `*HealthMonitorsClientListPager.Err` has been removed +- Function `*HealthMonitorsClientListPager.NextPage` has been removed +- Function `*OperationsClientListPager.PageResponse` has been removed +- Function `*HealthMonitorsClientListPager.PageResponse` has been removed +- Function `*OperationsClientListPager.NextPage` has been removed +- Function `*HealthMonitorsClientListStateChangesPager.NextPage` has been removed +- Function `*HealthMonitorsClientListStateChangesPager.Err` has been removed +- Struct `HealthMonitorsClientGetResult` has been removed +- Struct `HealthMonitorsClientGetStateChangeResult` has been removed +- Struct `HealthMonitorsClientListPager` has been removed +- Struct `HealthMonitorsClientListResult` has been removed +- Struct `HealthMonitorsClientListStateChangesPager` has been removed +- Struct `HealthMonitorsClientListStateChangesResult` has been removed +- Struct `OperationsClientListPager` has been removed +- Struct `OperationsClientListResult` has been removed +- Field `HealthMonitorsClientListStateChangesResult` of struct `HealthMonitorsClientListStateChangesResponse` has been removed +- Field `RawResponse` of struct `HealthMonitorsClientListStateChangesResponse` has been removed +- Field `HealthMonitorsClientListResult` of struct `HealthMonitorsClientListResponse` has been removed +- Field `RawResponse` of struct `HealthMonitorsClientListResponse` has been removed +- Field `HealthMonitorsClientGetStateChangeResult` of struct `HealthMonitorsClientGetStateChangeResponse` has been removed +- Field `RawResponse` of struct `HealthMonitorsClientGetStateChangeResponse` has been removed +- Field `HealthMonitorsClientGetResult` of struct `HealthMonitorsClientGetResponse` has been removed +- Field `RawResponse` of struct `HealthMonitorsClientGetResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed + +### Features Added + +- New anonymous field `OperationList` in struct `OperationsClientListResponse` +- New anonymous field `HealthMonitor` in struct `HealthMonitorsClientGetResponse` +- New anonymous field `HealthMonitorStateChange` in struct `HealthMonitorsClientGetStateChangeResponse` +- New anonymous field `HealthMonitorList` in struct `HealthMonitorsClientListResponse` +- New anonymous field `HealthMonitorStateChangeList` in struct `HealthMonitorsClientListStateChangesResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/README.md b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/README.md index 4179e2220e94..ea625a6bb503 100644 --- a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/README.md +++ b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/README.md @@ -11,7 +11,7 @@ The `armworkloadmonitor` module provides operations for working with Azure Workl ## Prerequisites - an [Azure subscription](https://azure.microsoft.com/free/) -- Go 1.16 or above +- Go 1.18 or above ## Install the package @@ -38,16 +38,18 @@ For more information on authentication, please see the documentation for `aziden Azure Workload Monitor modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -client := armworkloadmonitor.(<subscription ID>, cred, nil) +client, err := armworkloadmonitor.(<subscription ID>, cred, nil) ``` You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -options = arm.ClientOptions{ - Host: arm.AzureChina, +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, } -client := armworkloadmonitor.(<subscription ID>, cred, &options) +client, err := armworkloadmonitor.(<subscription ID>, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/autorest.md b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/autorest.md index 09b8d7ce2713..046a7ed6cad3 100644 --- a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/autorest.md +++ b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/workloadmonitor/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/workloadmonitor/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/workloadmonitor/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/b9d36b704e582a2bd5677fedc813607e73963469/specification/workloadmonitor/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/go.mod b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/go.mod index 1efdb03f4912..8e9346367b72 100644 --- a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/go.mod +++ b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/go.mod @@ -1,8 +1,21 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloadmonitor/armworkloadmonitor -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/go.sum b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/go.sum index 2ce51d3b8174..56d1c32628ae 100644 --- a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/go.sum +++ b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/go.sum @@ -1,18 +1,18 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -32,21 +32,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -56,4 +51,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/ze_generated_example_healthmonitors_client_test.go b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/ze_generated_example_healthmonitors_client_test.go index 32bd582d95ce..fd7f4bfa085f 100644 --- a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/ze_generated_example_healthmonitors_client_test.go +++ b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/ze_generated_example_healthmonitors_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -19,14 +19,19 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloadmonitor/armworkloadmonitor" ) -// x-ms-original-file: specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/MonitorList_GetDefault.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/MonitorList_GetDefault.json func ExampleHealthMonitorsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armworkloadmonitor.NewHealthMonitorsClient(cred, nil) + client, err := armworkloadmonitor.NewHealthMonitorsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List("<subscription-id>", "<resource-group-name>", "<provider-name>", @@ -35,28 +40,32 @@ func ExampleHealthMonitorsClient_List() { &armworkloadmonitor.HealthMonitorsClientListOptions{Filter: nil, Expand: nil, }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/Monitor_GetDefault.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/Monitor_GetDefault.json func ExampleHealthMonitorsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armworkloadmonitor.NewHealthMonitorsClient(cred, nil) + client, err := armworkloadmonitor.NewHealthMonitorsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.Get(ctx, "<subscription-id>", "<resource-group-name>", @@ -66,19 +75,26 @@ func ExampleHealthMonitorsClient_Get() { "<monitor-id>", &armworkloadmonitor.HealthMonitorsClientGetOptions{Expand: nil}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.HealthMonitorsClientGetResult) + // TODO: use response item + _ = res } -// x-ms-original-file: specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/MonitorHistory_GetDefault.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/MonitorHistory_GetDefault.json func ExampleHealthMonitorsClient_ListStateChanges() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armworkloadmonitor.NewHealthMonitorsClient(cred, nil) + client, err := armworkloadmonitor.NewHealthMonitorsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.ListStateChanges("<subscription-id>", "<resource-group-name>", "<provider-name>", @@ -87,31 +103,35 @@ func ExampleHealthMonitorsClient_ListStateChanges() { "<monitor-id>", &armworkloadmonitor.HealthMonitorsClientListStateChangesOptions{Filter: nil, Expand: nil, - StartTimestampUTC: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-19T19:24:14Z"); return t }()), - EndTimestampUTC: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-20T01:24:14Z"); return t }()), + StartTimestampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-19T19:24:14Z"); return t }()), + EndTimestampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-20T01:24:14Z"); return t }()), }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } -// x-ms-original-file: specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/MonitorStateChange_GetDefault.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/MonitorStateChange_GetDefault.json func ExampleHealthMonitorsClient_GetStateChange() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armworkloadmonitor.NewHealthMonitorsClient(cred, nil) + client, err := armworkloadmonitor.NewHealthMonitorsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } res, err := client.GetStateChange(ctx, "<subscription-id>", "<resource-group-name>", @@ -122,7 +142,9 @@ func ExampleHealthMonitorsClient_GetStateChange() { "<timestamp-unix>", &armworkloadmonitor.HealthMonitorsClientGetStateChangeOptions{Expand: nil}) if err != nil { - log.Fatal(err) + log.Fatalf("failed to finish the request: %v", err) + return } - log.Printf("Response result: %#v\n", res.HealthMonitorsClientGetStateChangeResult) + // TODO: use response item + _ = res } diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/ze_generated_example_operations_client_test.go index 2c27e2e01c2e..a114dee65248 100644 --- a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/ze_generated_example_operations_client_test.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,25 +16,29 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloadmonitor/armworkloadmonitor" ) -// x-ms-original-file: specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/OperationList_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/OperationList_Get.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) + return } ctx := context.Background() - client := armworkloadmonitor.NewOperationsClient(cred, nil) + client, err := armworkloadmonitor.NewOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + return + } pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { log.Fatalf("failed to advance page: %v", err) + return } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) + for _, v := range nextResult.Value { + // TODO: use page item + _ = v } } } diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_constants.go b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_constants.go index 12f11c6387e0..30d958c4fbae 100644 --- a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_constants.go +++ b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armworkloadmonitor const ( moduleName = "armworkloadmonitor" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // HealthState - One of health states - healthy, critical, warning, unknown, none, disabled. @@ -36,8 +36,3 @@ func PossibleHealthStateValues() []HealthState { HealthStateWarning, } } - -// ToPtr returns a *HealthState pointing to the current value. -func (c HealthState) ToPtr() *HealthState { - return &c -} diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_healthmonitors_client.go b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_healthmonitors_client.go index 49368fcdc3e3..aa16622271e3 100644 --- a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_healthmonitors_client.go +++ b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_healthmonitors_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -32,19 +33,23 @@ type HealthMonitorsClient struct { // NewHealthMonitorsClient creates a new instance of HealthMonitorsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewHealthMonitorsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *HealthMonitorsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewHealthMonitorsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*HealthMonitorsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &HealthMonitorsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the monitor's @@ -115,7 +120,7 @@ func (client *HealthMonitorsClient) getCreateRequest(ctx context.Context, subscr // getHandleResponse handles the Get response. func (client *HealthMonitorsClient) getHandleResponse(resp *http.Response) (HealthMonitorsClientGetResponse, error) { - result := HealthMonitorsClientGetResponse{RawResponse: resp} + result := HealthMonitorsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.HealthMonitor); err != nil { return HealthMonitorsClientGetResponse{}, err } @@ -196,7 +201,7 @@ func (client *HealthMonitorsClient) getStateChangeCreateRequest(ctx context.Cont // getStateChangeHandleResponse handles the GetStateChange response. func (client *HealthMonitorsClient) getStateChangeHandleResponse(resp *http.Response) (HealthMonitorsClientGetStateChangeResponse, error) { - result := HealthMonitorsClientGetStateChangeResponse{RawResponse: resp} + result := HealthMonitorsClientGetStateChangeResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.HealthMonitorStateChange); err != nil { return HealthMonitorsClientGetStateChangeResponse{}, err } @@ -212,16 +217,32 @@ func (client *HealthMonitorsClient) getStateChangeHandleResponse(resp *http.Resp // resourceCollectionName - The resource collection name (ex: virtualMachines for virtual machines). // resourceName - The name of the virtual machine. // options - HealthMonitorsClientListOptions contains the optional parameters for the HealthMonitorsClient.List method. -func (client *HealthMonitorsClient) List(subscriptionID string, resourceGroupName string, providerName string, resourceCollectionName string, resourceName string, options *HealthMonitorsClientListOptions) *HealthMonitorsClientListPager { - return &HealthMonitorsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, subscriptionID, resourceGroupName, providerName, resourceCollectionName, resourceName, options) +func (client *HealthMonitorsClient) List(subscriptionID string, resourceGroupName string, providerName string, resourceCollectionName string, resourceName string, options *HealthMonitorsClientListOptions) *runtime.Pager[HealthMonitorsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[HealthMonitorsClientListResponse]{ + More: func(page HealthMonitorsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp HealthMonitorsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.HealthMonitorList.NextLink) + Fetcher: func(ctx context.Context, page *HealthMonitorsClientListResponse) (HealthMonitorsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, subscriptionID, resourceGroupName, providerName, resourceCollectionName, resourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return HealthMonitorsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HealthMonitorsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HealthMonitorsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -266,7 +287,7 @@ func (client *HealthMonitorsClient) listCreateRequest(ctx context.Context, subsc // listHandleResponse handles the List response. func (client *HealthMonitorsClient) listHandleResponse(resp *http.Response) (HealthMonitorsClientListResponse, error) { - result := HealthMonitorsClientListResponse{RawResponse: resp} + result := HealthMonitorsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.HealthMonitorList); err != nil { return HealthMonitorsClientListResponse{}, err } @@ -285,16 +306,32 @@ func (client *HealthMonitorsClient) listHandleResponse(resp *http.Response) (Hea // monitorID - The monitor Id of the virtual machine. // options - HealthMonitorsClientListStateChangesOptions contains the optional parameters for the HealthMonitorsClient.ListStateChanges // method. -func (client *HealthMonitorsClient) ListStateChanges(subscriptionID string, resourceGroupName string, providerName string, resourceCollectionName string, resourceName string, monitorID string, options *HealthMonitorsClientListStateChangesOptions) *HealthMonitorsClientListStateChangesPager { - return &HealthMonitorsClientListStateChangesPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listStateChangesCreateRequest(ctx, subscriptionID, resourceGroupName, providerName, resourceCollectionName, resourceName, monitorID, options) +func (client *HealthMonitorsClient) ListStateChanges(subscriptionID string, resourceGroupName string, providerName string, resourceCollectionName string, resourceName string, monitorID string, options *HealthMonitorsClientListStateChangesOptions) *runtime.Pager[HealthMonitorsClientListStateChangesResponse] { + return runtime.NewPager(runtime.PageProcessor[HealthMonitorsClientListStateChangesResponse]{ + More: func(page HealthMonitorsClientListStateChangesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp HealthMonitorsClientListStateChangesResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.HealthMonitorStateChangeList.NextLink) + Fetcher: func(ctx context.Context, page *HealthMonitorsClientListStateChangesResponse) (HealthMonitorsClientListStateChangesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listStateChangesCreateRequest(ctx, subscriptionID, resourceGroupName, providerName, resourceCollectionName, resourceName, monitorID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return HealthMonitorsClientListStateChangesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HealthMonitorsClientListStateChangesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HealthMonitorsClientListStateChangesResponse{}, runtime.NewResponseError(resp) + } + return client.listStateChangesHandleResponse(resp) }, - } + }) } // listStateChangesCreateRequest creates the ListStateChanges request. @@ -349,7 +386,7 @@ func (client *HealthMonitorsClient) listStateChangesCreateRequest(ctx context.Co // listStateChangesHandleResponse handles the ListStateChanges response. func (client *HealthMonitorsClient) listStateChangesHandleResponse(resp *http.Response) (HealthMonitorsClientListStateChangesResponse, error) { - result := HealthMonitorsClientListStateChangesResponse{RawResponse: resp} + result := HealthMonitorsClientListStateChangesResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.HealthMonitorStateChangeList); err != nil { return HealthMonitorsClientListStateChangesResponse{}, err } diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_models.go b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_models.go index aed3c31f1304..3581cfd737c1 100644 --- a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_models.go +++ b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armworkloadmonitor -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // ErrorDetails - Error details type ErrorDetails struct { @@ -42,15 +37,6 @@ type ErrorResponseError struct { Message *string `json:"message,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseError. -func (e ErrorResponseError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - return json.Marshal(objectMap) -} - // HealthMonitor - Information about the monitor’s current health status. type HealthMonitor struct { // Properties of the monitor's health status. @@ -75,14 +61,6 @@ type HealthMonitorList struct { Value []*HealthMonitor `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type HealthMonitorList. -func (h HealthMonitorList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", h.NextLink) - populate(objectMap, "value", h.Value) - return json.Marshal(objectMap) -} - // HealthMonitorProperties - Properties of the monitor. type HealthMonitorProperties struct { // Timestamp of the monitor's last health state change. @@ -92,13 +70,13 @@ type HealthMonitorProperties struct { EvaluationTimestamp *string `json:"evaluationTimestamp,omitempty"` // Evidence validating the monitor's current health state. - Evidence map[string]interface{} `json:"evidence,omitempty"` + Evidence interface{} `json:"evidence,omitempty"` // Timestamp of the monitor's last reported health state. LastReportedTimestamp *string `json:"lastReportedTimestamp,omitempty"` // The configuration settings at the time of the monitor's health evaluation. - MonitorConfiguration map[string]interface{} `json:"monitorConfiguration,omitempty"` + MonitorConfiguration interface{} `json:"monitorConfiguration,omitempty"` // Human-readable name of the monitor. MonitorName *string `json:"monitorName,omitempty"` @@ -143,14 +121,6 @@ type HealthMonitorStateChangeList struct { Value []*HealthMonitorStateChange `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type HealthMonitorStateChangeList. -func (h HealthMonitorStateChangeList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", h.NextLink) - populate(objectMap, "value", h.Value) - return json.Marshal(objectMap) -} - // HealthMonitorStateChangeProperties - Properties of the monitor. type HealthMonitorStateChangeProperties struct { // Timestamp of the monitor's last health state change. @@ -160,10 +130,10 @@ type HealthMonitorStateChangeProperties struct { EvaluationTimestamp *string `json:"evaluationTimestamp,omitempty"` // Evidence validating the monitor's current health state. - Evidence map[string]interface{} `json:"evidence,omitempty"` + Evidence interface{} `json:"evidence,omitempty"` // The configuration settings at the time of the monitor's health evaluation. - MonitorConfiguration map[string]interface{} `json:"monitorConfiguration,omitempty"` + MonitorConfiguration interface{} `json:"monitorConfiguration,omitempty"` // Human-readable name of the monitor. MonitorName *string `json:"monitorName,omitempty"` @@ -251,14 +221,6 @@ type OperationList struct { Value []*Operation `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OperationList. -func (o OperationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -275,13 +237,3 @@ type Resource struct { // READ-ONLY; The resource type. Type *string `json:"type,omitempty" azure:"ro"` } - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_models_serde.go b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_models_serde.go new file mode 100644 index 000000000000..b8555dc2cb49 --- /dev/null +++ b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_models_serde.go @@ -0,0 +1,58 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armworkloadmonitor + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseError. +func (e ErrorResponseError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type HealthMonitorList. +func (h HealthMonitorList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type HealthMonitorStateChangeList. +func (h HealthMonitorStateChangeList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OperationList. +func (o OperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_operations_client.go b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_operations_client.go index 0492bc46e68a..e9927aff17c9 100644 --- a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_operations_client.go +++ b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,34 +29,54 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Get a list of all available REST API operations. // If the operation fails it returns an *azcore.ResponseError type. // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(options *OperationsClientListOptions) *OperationsClientListPager { - return &OperationsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *OperationsClient) List(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp OperationsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationList.NextLink) + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -74,7 +95,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationList); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_pagers.go b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_pagers.go deleted file mode 100644 index d6070cf699b4..000000000000 --- a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_pagers.go +++ /dev/null @@ -1,179 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armworkloadmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// HealthMonitorsClientListPager provides operations for iterating over paged responses. -type HealthMonitorsClientListPager struct { - client *HealthMonitorsClient - current HealthMonitorsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, HealthMonitorsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *HealthMonitorsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *HealthMonitorsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.HealthMonitorList.NextLink == nil || len(*p.current.HealthMonitorList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current HealthMonitorsClientListResponse page. -func (p *HealthMonitorsClientListPager) PageResponse() HealthMonitorsClientListResponse { - return p.current -} - -// HealthMonitorsClientListStateChangesPager provides operations for iterating over paged responses. -type HealthMonitorsClientListStateChangesPager struct { - client *HealthMonitorsClient - current HealthMonitorsClientListStateChangesResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, HealthMonitorsClientListStateChangesResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *HealthMonitorsClientListStateChangesPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *HealthMonitorsClientListStateChangesPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.HealthMonitorStateChangeList.NextLink == nil || len(*p.current.HealthMonitorStateChangeList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listStateChangesHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current HealthMonitorsClientListStateChangesResponse page. -func (p *HealthMonitorsClientListStateChangesPager) PageResponse() HealthMonitorsClientListStateChangesResponse { - return p.current -} - -// OperationsClientListPager provides operations for iterating over paged responses. -type OperationsClientListPager struct { - client *OperationsClient - current OperationsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, OperationsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *OperationsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *OperationsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.OperationList.NextLink == nil || len(*p.current.OperationList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current OperationsClientListResponse page. -func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse { - return p.current -} diff --git a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_response_types.go b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_response_types.go index e90658991801..9368a2259ee7 100644 --- a/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_response_types.go +++ b/sdk/resourcemanager/workloadmonitor/armworkloadmonitor/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,64 +8,27 @@ package armworkloadmonitor -import "net/http" - // HealthMonitorsClientGetResponse contains the response from method HealthMonitorsClient.Get. type HealthMonitorsClientGetResponse struct { - HealthMonitorsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// HealthMonitorsClientGetResult contains the result from method HealthMonitorsClient.Get. -type HealthMonitorsClientGetResult struct { HealthMonitor } // HealthMonitorsClientGetStateChangeResponse contains the response from method HealthMonitorsClient.GetStateChange. type HealthMonitorsClientGetStateChangeResponse struct { - HealthMonitorsClientGetStateChangeResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// HealthMonitorsClientGetStateChangeResult contains the result from method HealthMonitorsClient.GetStateChange. -type HealthMonitorsClientGetStateChangeResult struct { HealthMonitorStateChange } // HealthMonitorsClientListResponse contains the response from method HealthMonitorsClient.List. type HealthMonitorsClientListResponse struct { - HealthMonitorsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// HealthMonitorsClientListResult contains the result from method HealthMonitorsClient.List. -type HealthMonitorsClientListResult struct { HealthMonitorList } // HealthMonitorsClientListStateChangesResponse contains the response from method HealthMonitorsClient.ListStateChanges. type HealthMonitorsClientListStateChangesResponse struct { - HealthMonitorsClientListStateChangesResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// HealthMonitorsClientListStateChangesResult contains the result from method HealthMonitorsClient.ListStateChanges. -type HealthMonitorsClientListStateChangesResult struct { HealthMonitorStateChangeList } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { OperationList }