diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/CHANGELOG.md b/sdk/resourcemanager/deviceupdate/armdeviceupdate/CHANGELOG.md index c46a2db7107c..023e1e3b40c6 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/CHANGELOG.md +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/CHANGELOG.md @@ -1,5 +1,262 @@ # Release History +## 0.3.0 (2022-04-11) +### Breaking Changes + +- Function `*InstancesClient.BeginCreate` return value(s) have been changed from `(InstancesClientCreatePollerResponse, error)` to `(*armruntime.Poller[InstancesClientCreateResponse], error)` +- Function `*PrivateEndpointConnectionProxiesClient.ListByAccount` parameter(s) have been changed from `(context.Context, string, string, *PrivateEndpointConnectionProxiesClientListByAccountOptions)` to `(string, string, *PrivateEndpointConnectionProxiesClientListByAccountOptions)` +- Function `*PrivateEndpointConnectionProxiesClient.ListByAccount` return value(s) have been changed from `(PrivateEndpointConnectionProxiesClientListByAccountResponse, error)` to `(*runtime.Pager[PrivateEndpointConnectionProxiesClientListByAccountResponse])` +- Function `NewPrivateEndpointConnectionsClient` return value(s) have been changed from `(*PrivateEndpointConnectionsClient)` to `(*PrivateEndpointConnectionsClient, error)` +- Function `*OperationsClient.List` return value(s) have been changed from `(*OperationsClientListPager)` to `(*runtime.Pager[OperationsClientListResponse])` +- Function `*InstancesClient.BeginDelete` return value(s) have been changed from `(InstancesClientDeletePollerResponse, error)` to `(*armruntime.Poller[InstancesClientDeleteResponse], error)` +- Function `*AccountsClient.BeginUpdate` return value(s) have been changed from `(AccountsClientUpdatePollerResponse, error)` to `(*armruntime.Poller[AccountsClientUpdateResponse], error)` +- Function `NewInstancesClient` return value(s) have been changed from `(*InstancesClient)` to `(*InstancesClient, error)` +- Function `NewClient` return value(s) have been changed from `(*Client)` to `(*Client, error)` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `*PrivateEndpointConnectionProxiesClient.BeginCreateOrUpdate` return value(s) have been changed from `(PrivateEndpointConnectionProxiesClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse], error)` +- Function `*AccountsClient.BeginCreate` return value(s) have been changed from `(AccountsClientCreatePollerResponse, error)` to `(*armruntime.Poller[AccountsClientCreateResponse], error)` +- Function `*AccountsClient.BeginDelete` return value(s) have been changed from `(AccountsClientDeletePollerResponse, error)` to `(*armruntime.Poller[AccountsClientDeleteResponse], error)` +- Function `*PrivateLinkResourcesClient.ListByAccount` parameter(s) have been changed from `(context.Context, string, string, *PrivateLinkResourcesClientListByAccountOptions)` to `(string, string, *PrivateLinkResourcesClientListByAccountOptions)` +- Function `*PrivateLinkResourcesClient.ListByAccount` return value(s) have been changed from `(PrivateLinkResourcesClientListByAccountResponse, error)` to `(*runtime.Pager[PrivateLinkResourcesClientListByAccountResponse])` +- Function `NewAccountsClient` return value(s) have been changed from `(*AccountsClient)` to `(*AccountsClient, error)` +- Function `*AccountsClient.ListBySubscription` return value(s) have been changed from `(*AccountsClientListBySubscriptionPager)` to `(*runtime.Pager[AccountsClientListBySubscriptionResponse])` +- Function `*PrivateEndpointConnectionsClient.BeginDelete` return value(s) have been changed from `(PrivateEndpointConnectionsClientDeletePollerResponse, error)` to `(*armruntime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error)` +- Function `NewPrivateLinkResourcesClient` return value(s) have been changed from `(*PrivateLinkResourcesClient)` to `(*PrivateLinkResourcesClient, error)` +- Function `*InstancesClient.ListByAccount` return value(s) have been changed from `(*InstancesClientListByAccountPager)` to `(*runtime.Pager[InstancesClientListByAccountResponse])` +- Function `*PrivateEndpointConnectionsClient.ListByAccount` parameter(s) have been changed from `(context.Context, string, string, *PrivateEndpointConnectionsClientListByAccountOptions)` to `(string, string, *PrivateEndpointConnectionsClientListByAccountOptions)` +- Function `*PrivateEndpointConnectionsClient.ListByAccount` return value(s) have been changed from `(PrivateEndpointConnectionsClientListByAccountResponse, error)` to `(*runtime.Pager[PrivateEndpointConnectionsClientListByAccountResponse])` +- Function `NewPrivateEndpointConnectionProxiesClient` return value(s) have been changed from `(*PrivateEndpointConnectionProxiesClient)` to `(*PrivateEndpointConnectionProxiesClient, error)` +- Function `*AccountsClient.ListByResourceGroup` return value(s) have been changed from `(*AccountsClientListByResourceGroupPager)` to `(*runtime.Pager[AccountsClientListByResourceGroupResponse])` +- Function `*PrivateEndpointConnectionsClient.BeginCreateOrUpdate` return value(s) have been changed from `(PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error)` +- Function `*PrivateEndpointConnectionProxiesClient.BeginDelete` return value(s) have been changed from `(PrivateEndpointConnectionProxiesClientDeletePollerResponse, error)` to `(*armruntime.Poller[PrivateEndpointConnectionProxiesClientDeleteResponse], error)` +- Type of `ErrorAdditionalInfo.Info` has been changed from `map[string]interface{}` to `interface{}` +- Function `*InstancesClientListByAccountPager.Err` has been removed +- Function `*InstancesClientListByAccountPager.PageResponse` has been removed +- Function `*AccountsClientUpdatePoller.Done` has been removed +- Function `*PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `InstancesClientCreatePollerResponse.PollUntilDone` has been removed +- Function `PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*PrivateEndpointConnectionProxiesClientDeletePoller.ResumeToken` has been removed +- Function `ProvisioningState.ToPtr` has been removed +- Function `*AccountsClientUpdatePoller.Poll` has been removed +- Function `*InstancesClientDeletePoller.ResumeToken` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePoller.Poll` has been removed +- Function `*OperationsClientListPager.Err` has been removed +- Function `*InstancesClientDeletePoller.FinalResponse` has been removed +- Function `*InstancesClientDeletePoller.Poll` has been removed +- Function `PrivateEndpointConnectionProvisioningState.ToPtr` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePoller.Done` has been removed +- Function `AuthenticationType.ToPtr` has been removed +- Function `*AccountsClientCreatePoller.FinalResponse` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePoller.FinalResponse` has been removed +- Function `*AccountsClientDeletePoller.Done` has been removed +- Function `*AccountsClientCreatePoller.Poll` has been removed +- Function `*InstancesClientCreatePoller.ResumeToken` has been removed +- Function `*PrivateEndpointConnectionProxiesClientDeletePollerResponse.Resume` has been removed +- Function `*AccountsClientDeletePoller.Poll` has been removed +- Function `*PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller.Done` has been removed +- Function `PrivateEndpointConnectionsClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*AccountsClientUpdatePoller.ResumeToken` has been removed +- Function `*AccountsClientDeletePoller.ResumeToken` has been removed +- Function `*AccountsClientListByResourceGroupPager.PageResponse` has been removed +- Function `PrivateEndpointConnectionProxyProvisioningState.ToPtr` has been removed +- Function `*AccountsClientCreatePollerResponse.Resume` has been removed +- Function `*PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller.Poll` has been removed +- Function `*PrivateEndpointConnectionsClientCreateOrUpdatePoller.Poll` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePoller.ResumeToken` has been removed +- Function `*InstancesClientCreatePollerResponse.Resume` has been removed +- Function `*InstancesClientListByAccountPager.NextPage` has been removed +- Function `AccountsClientUpdatePollerResponse.PollUntilDone` has been removed +- Function `PublicNetworkAccess.ToPtr` has been removed +- Function `ManagedServiceIdentityType.ToPtr` has been removed +- Function `*AccountsClientCreatePoller.Done` has been removed +- Function `*PrivateEndpointConnectionProxiesClientDeletePoller.FinalResponse` has been removed +- Function `*PrivateEndpointConnectionProxiesClientDeletePoller.Done` has been removed +- Function `PrivateEndpointConnectionProxiesClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*InstancesClientCreatePoller.Poll` has been removed +- Function `*AccountsClientCreatePoller.ResumeToken` has been removed +- Function `*PrivateEndpointConnectionProxiesClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `AccountsClientCreatePollerResponse.PollUntilDone` has been removed +- Function `CreatedByType.ToPtr` has been removed +- Function `*PrivateEndpointConnectionsClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `ActionType.ToPtr` has been removed +- Function `*PrivateEndpointConnectionProxiesClientDeletePoller.Poll` has been removed +- Function `*AccountsClientListBySubscriptionPager.Err` has been removed +- Function `GroupIDProvisioningState.ToPtr` has been removed +- Function `*InstancesClientDeletePollerResponse.Resume` has been removed +- Function `*PrivateEndpointConnectionsClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*AccountsClientListByResourceGroupPager.NextPage` has been removed +- Function `PrivateEndpointServiceConnectionStatus.ToPtr` has been removed +- Function `*AccountsClientListByResourceGroupPager.Err` has been removed +- Function `*AccountsClientDeletePollerResponse.Resume` has been removed +- Function `*InstancesClientDeletePoller.Done` has been removed +- Function `*PrivateEndpointConnectionsClientDeletePollerResponse.Resume` has been removed +- Function `*InstancesClientCreatePoller.Done` has been removed +- Function `*AccountsClientListBySubscriptionPager.NextPage` has been removed +- Function `AccountsClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*AccountsClientUpdatePoller.FinalResponse` has been removed +- Function `InstancesClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*OperationsClientListPager.PageResponse` has been removed +- Function `*AccountsClientListBySubscriptionPager.PageResponse` has been removed +- Function `*AccountsClientDeletePoller.FinalResponse` has been removed +- Function `*AccountsClientUpdatePollerResponse.Resume` has been removed +- Function `CheckNameAvailabilityReason.ToPtr` has been removed +- Function `*InstancesClientCreatePoller.FinalResponse` has been removed +- Function `PrivateEndpointConnectionProxiesClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*OperationsClientListPager.NextPage` has been removed +- Function `Origin.ToPtr` has been removed +- Function `*PrivateEndpointConnectionsClientCreateOrUpdatePoller.Done` has been removed +- Struct `AccountsClientCreatePoller` has been removed +- Struct `AccountsClientCreatePollerResponse` has been removed +- Struct `AccountsClientCreateResult` has been removed +- Struct `AccountsClientDeletePoller` has been removed +- Struct `AccountsClientDeletePollerResponse` has been removed +- Struct `AccountsClientGetResult` has been removed +- Struct `AccountsClientHeadResult` has been removed +- Struct `AccountsClientListByResourceGroupPager` has been removed +- Struct `AccountsClientListByResourceGroupResult` has been removed +- Struct `AccountsClientListBySubscriptionPager` has been removed +- Struct `AccountsClientListBySubscriptionResult` has been removed +- Struct `AccountsClientUpdatePoller` has been removed +- Struct `AccountsClientUpdatePollerResponse` has been removed +- Struct `AccountsClientUpdateResult` has been removed +- Struct `ClientCheckNameAvailabilityResult` has been removed +- Struct `InstancesClientCreatePoller` has been removed +- Struct `InstancesClientCreatePollerResponse` has been removed +- Struct `InstancesClientCreateResult` has been removed +- Struct `InstancesClientDeletePoller` has been removed +- Struct `InstancesClientDeletePollerResponse` has been removed +- Struct `InstancesClientGetResult` has been removed +- Struct `InstancesClientHeadResult` has been removed +- Struct `InstancesClientListByAccountPager` has been removed +- Struct `InstancesClientListByAccountResult` has been removed +- Struct `InstancesClientUpdateResult` has been removed +- Struct `OperationsClientListPager` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller` has been removed +- Struct `PrivateEndpointConnectionProxiesClientCreateOrUpdatePollerResponse` has been removed +- Struct `PrivateEndpointConnectionProxiesClientCreateOrUpdateResult` has been removed +- Struct `PrivateEndpointConnectionProxiesClientDeletePoller` has been removed +- Struct `PrivateEndpointConnectionProxiesClientDeletePollerResponse` has been removed +- Struct `PrivateEndpointConnectionProxiesClientGetResult` has been removed +- Struct `PrivateEndpointConnectionProxiesClientListByAccountResult` has been removed +- Struct `PrivateEndpointConnectionsClientCreateOrUpdatePoller` has been removed +- Struct `PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse` has been removed +- Struct `PrivateEndpointConnectionsClientCreateOrUpdateResult` has been removed +- Struct `PrivateEndpointConnectionsClientDeletePoller` has been removed +- Struct `PrivateEndpointConnectionsClientDeletePollerResponse` has been removed +- Struct `PrivateEndpointConnectionsClientGetResult` has been removed +- Struct `PrivateEndpointConnectionsClientListByAccountResult` has been removed +- Struct `PrivateLinkResourcesClientGetResult` has been removed +- Struct `PrivateLinkResourcesClientListByAccountResult` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionProxiesClientValidateResponse` has been removed +- Field `EventHubConnectionString` of struct `IotHubSettings` has been removed +- Field `IoTHubConnectionString` of struct `IotHubSettings` has been removed +- Field `RawResponse` of struct `InstancesClientDeleteResponse` has been removed +- Field `PrivateEndpointConnectionProxiesClientCreateOrUpdateResult` of struct `PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `AccountsClientDeleteResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientDeleteResponse` has been removed +- Field `PrivateEndpointConnectionsClientGetResult` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientGetResponse` has been removed +- Field `InstancesClientListByAccountResult` of struct `InstancesClientListByAccountResponse` has been removed +- Field `RawResponse` of struct `InstancesClientListByAccountResponse` has been removed +- Field `InstancesClientUpdateResult` of struct `InstancesClientUpdateResponse` has been removed +- Field `RawResponse` of struct `InstancesClientUpdateResponse` has been removed +- Field `AccountsClientGetResult` of struct `AccountsClientGetResponse` has been removed +- Field `RawResponse` of struct `AccountsClientGetResponse` has been removed +- Field `InstancesClientCreateResult` of struct `InstancesClientCreateResponse` has been removed +- Field `RawResponse` of struct `InstancesClientCreateResponse` has been removed +- Field `ProvisioningState` of struct `PrivateEndpointConnectionProxy` has been removed +- Field `RemotePrivateEndpoint` of struct `PrivateEndpointConnectionProxyProperties` has been removed +- Field `Status` of struct `PrivateEndpointConnectionProxyProperties` has been removed +- Field `ETag` of struct `PrivateEndpointConnectionProxyProperties` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `PrivateEndpointConnectionProxiesClientListByAccountResult` of struct `PrivateEndpointConnectionProxiesClientListByAccountResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionProxiesClientListByAccountResponse` has been removed +- Field `AccountsClientCreateResult` of struct `AccountsClientCreateResponse` has been removed +- Field `RawResponse` of struct `AccountsClientCreateResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionProxiesClientDeleteResponse` has been removed +- Field `PrivateEndpointConnectionProxiesClientGetResult` of struct `PrivateEndpointConnectionProxiesClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionProxiesClientGetResponse` has been removed +- Field `InstancesClientHeadResult` of struct `InstancesClientHeadResponse` has been removed +- Field `RawResponse` of struct `InstancesClientHeadResponse` has been removed +- Field `AccountsClientListBySubscriptionResult` of struct `AccountsClientListBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `AccountsClientListBySubscriptionResponse` has been removed +- Field `AccountsClientUpdateResult` of struct `AccountsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `AccountsClientUpdateResponse` has been removed +- Field `PrivateLinkResourcesClientGetResult` of struct `PrivateLinkResourcesClientGetResponse` has been removed +- Field `RawResponse` of struct `PrivateLinkResourcesClientGetResponse` has been removed +- Field `AccountsClientHeadResult` of struct `AccountsClientHeadResponse` has been removed +- Field `RawResponse` of struct `AccountsClientHeadResponse` has been removed +- Field `PrivateEndpointConnectionsClientListByAccountResult` of struct `PrivateEndpointConnectionsClientListByAccountResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientListByAccountResponse` has been removed +- Field `PrivateEndpointConnectionsClientCreateOrUpdateResult` of struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` has been removed +- Field `ClientCheckNameAvailabilityResult` of struct `ClientCheckNameAvailabilityResponse` has been removed +- Field `RawResponse` of struct `ClientCheckNameAvailabilityResponse` has been removed +- Field `PrivateLinkResourcesClientListByAccountResult` of struct `PrivateLinkResourcesClientListByAccountResponse` has been removed +- Field `RawResponse` of struct `PrivateLinkResourcesClientListByAccountResponse` has been removed +- Field `InstancesClientGetResult` of struct `InstancesClientGetResponse` has been removed +- Field `RawResponse` of struct `InstancesClientGetResponse` has been removed +- Field `AccountsClientListByResourceGroupResult` of struct `AccountsClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `AccountsClientListByResourceGroupResponse` has been removed + +### Features Added + +- New const `RoleFailover` +- New const `RolePrimary` +- New const `SKUStandard` +- New const `SKUFree` +- New function `PossibleSKUValues() []SKU` +- New function `*PrivateEndpointConnectionProxiesClient.UpdatePrivateEndpointProperties(context.Context, string, string, string, PrivateEndpointUpdate, *PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesOptions) (PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesResponse, error)` +- New function `PossibleRoleValues() []Role` +- New struct `Location` +- New struct `PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesOptions` +- New struct `PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesResponse` +- New struct `PrivateEndpointConnectionProxyPropertiesAutoGenerated` +- New struct `PrivateEndpointUpdate` +- New anonymous field `Account` in struct `AccountsClientCreateResponse` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New field `ResumeToken` in struct `PrivateEndpointConnectionProxiesClientBeginCreateOrUpdateOptions` +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsClientCreateOrUpdateResponse` +- New field `ResumeToken` in struct `InstancesClientBeginCreateOptions` +- New anonymous field `PrivateLinkResourceListResult` in struct `PrivateLinkResourcesClientListByAccountResponse` +- New anonymous field `CheckNameAvailabilityResponse` in struct `ClientCheckNameAvailabilityResponse` +- New field `ResumeToken` in struct `InstancesClientBeginDeleteOptions` +- New anonymous field `Account` in struct `AccountsClientUpdateResponse` +- New anonymous field `Account` in struct `AccountsClientGetResponse` +- New anonymous field `AccountList` in struct `AccountsClientListBySubscriptionResponse` +- New field `ResumeToken` in struct `PrivateEndpointConnectionsClientBeginDeleteOptions` +- New anonymous field `AccountList` in struct `AccountsClientListByResourceGroupResponse` +- New field `Success` in struct `InstancesClientHeadResponse` +- New anonymous field `Instance` in struct `InstancesClientUpdateResponse` +- New anonymous field `GroupInformation` in struct `PrivateLinkResourcesClientGetResponse` +- New field `ResumeToken` in struct `AccountsClientBeginUpdateOptions` +- New field `ImmutableResourceID` in struct `RemotePrivateEndpoint` +- New field `ImmutableSubscriptionID` in struct `RemotePrivateEndpoint` +- New field `Location` in struct `RemotePrivateEndpoint` +- New anonymous field `Instance` in struct `InstancesClientCreateResponse` +- New anonymous field `PrivateEndpointConnection` in struct `PrivateEndpointConnectionsClientGetResponse` +- New anonymous field `PrivateEndpointConnectionProxy` in struct `PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse` +- New anonymous field `PrivateEndpointConnectionProxyListResult` in struct `PrivateEndpointConnectionProxiesClientListByAccountResponse` +- New field `ResumeToken` in struct `PrivateEndpointConnectionProxiesClientBeginDeleteOptions` +- New field `ResumeToken` in struct `PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions` +- New field `ResumeToken` in struct `AccountsClientBeginCreateOptions` +- New anonymous field `PrivateEndpointConnectionListResult` in struct `PrivateEndpointConnectionsClientListByAccountResponse` +- New field `Locations` in struct `AccountProperties` +- New field `SKU` in struct `AccountProperties` +- New field `Success` in struct `AccountsClientHeadResponse` +- New field `ResumeToken` in struct `AccountsClientBeginDeleteOptions` +- New anonymous field `PrivateEndpointConnectionProxy` in struct `PrivateEndpointConnectionProxiesClientGetResponse` +- New field `Properties` in struct `PrivateEndpointConnectionProxy` +- New anonymous field `InstanceList` in struct `InstancesClientListByAccountResponse` +- New anonymous field `Instance` in struct `InstancesClientGetResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/autorest.md b/sdk/resourcemanager/deviceupdate/armdeviceupdate/autorest.md index c0874e1b0058..f0f1fbd396dc 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/autorest.md +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/deviceupdate/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/deviceupdate/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/deviceupdate/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/deviceupdate/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/deviceupdate/armdeviceupdate/go.mod b/sdk/resourcemanager/deviceupdate/armdeviceupdate/go.mod index 2bdf39bb99c2..fc2c9d1e528c 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/go.mod +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/go.mod @@ -1,8 +1,11 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceupdate/armdeviceupdate -go 1.16 +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 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/internal v0.9.1 // indirect + golang.org/x/net v0.0.0-20210610132358-84b48f89b13b // indirect + golang.org/x/text v0.3.6 // indirect ) diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/go.sum b/sdk/resourcemanager/deviceupdate/armdeviceupdate/go.sum index 2ce51d3b8174..a7eaa30576c1 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/go.sum +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/go.sum @@ -1,26 +1,11 @@ -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/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/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/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/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= 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/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= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -28,32 +13,20 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= -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 h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= 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 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= 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= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -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 h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= 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/deviceupdate/armdeviceupdate/ze_generated_example_accounts_client_test.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_accounts_client_test.go deleted file mode 100644 index 6594c5dcb3ac..000000000000 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_accounts_client_test.go +++ /dev/null @@ -1,175 +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 armdeviceupdate_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceupdate/armdeviceupdate" -) - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Accounts/Accounts_List.json -func ExampleAccountsClient_ListBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewAccountsClient("", cred, nil) - pager := client.ListBySubscription(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Accounts/Accounts_List.json -func ExampleAccountsClient_ListByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewAccountsClient("", cred, nil) - pager := client.ListByResourceGroup("", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Accounts/Accounts_Get.json -func ExampleAccountsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewAccountsClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.AccountsClientGetResult) -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Accounts/Accounts_Head.json -func ExampleAccountsClient_Head() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewAccountsClient("", cred, nil) - _, err = client.Head(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Accounts/Accounts_Create.json -func ExampleAccountsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewAccountsClient("", cred, nil) - poller, err := client.BeginCreate(ctx, - "", - "", - armdeviceupdate.Account{ - Location: to.StringPtr(""), - Properties: &armdeviceupdate.AccountProperties{}, - }, - nil) - if err != nil { - log.Fatal(err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Accounts/Accounts_Delete.json -func ExampleAccountsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewAccountsClient("", cred, nil) - poller, err := client.BeginDelete(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Accounts/Accounts_Update.json -func ExampleAccountsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewAccountsClient("", cred, nil) - poller, err := client.BeginUpdate(ctx, - "", - "", - armdeviceupdate.AccountUpdate{ - Tags: map[string]*string{ - "tagKey": to.StringPtr("tagValue"), - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.AccountsClientUpdateResult) -} diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_deviceupdate_client_test.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_deviceupdate_client_test.go deleted file mode 100644 index 7a173e020c5f..000000000000 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_deviceupdate_client_test.go +++ /dev/null @@ -1,38 +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 armdeviceupdate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceupdate/armdeviceupdate" -) - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/CheckNameAvailability_AlreadyExists.json -func ExampleClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewClient("", cred, nil) - res, err := client.CheckNameAvailability(ctx, - armdeviceupdate.CheckNameAvailabilityRequest{ - Name: to.StringPtr(""), - Type: to.StringPtr(""), - }, - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ClientCheckNameAvailabilityResult) -} diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_instances_client_test.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_instances_client_test.go deleted file mode 100644 index 04a6e084c378..000000000000 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_instances_client_test.go +++ /dev/null @@ -1,167 +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 armdeviceupdate_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceupdate/armdeviceupdate" -) - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Instances/Instances_ListByAccount.json -func ExampleInstancesClient_ListByAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewInstancesClient("", cred, nil) - pager := client.ListByAccount("", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Instances/Instances_Get.json -func ExampleInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewInstancesClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.InstancesClientGetResult) -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Instances/Instances_Head.json -func ExampleInstancesClient_Head() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewInstancesClient("", cred, nil) - _, err = client.Head(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Instances/Instances_Create.json -func ExampleInstancesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewInstancesClient("", cred, nil) - poller, err := client.BeginCreate(ctx, - "", - "", - "", - armdeviceupdate.Instance{ - Location: to.StringPtr(""), - Properties: &armdeviceupdate.InstanceProperties{ - DiagnosticStorageProperties: &armdeviceupdate.DiagnosticStorageProperties{ - AuthenticationType: armdeviceupdate.AuthenticationType("KeyBased").ToPtr(), - ConnectionString: to.StringPtr(""), - ResourceID: to.StringPtr(""), - }, - EnableDiagnostics: to.BoolPtr(false), - IotHubs: []*armdeviceupdate.IotHubSettings{ - { - EventHubConnectionString: to.StringPtr(""), - IoTHubConnectionString: to.StringPtr(""), - ResourceID: to.StringPtr(""), - }}, - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Instances/Instances_Delete.json -func ExampleInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewInstancesClient("", cred, nil) - poller, err := client.BeginDelete(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Instances/Instances_Update.json -func ExampleInstancesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewInstancesClient("", cred, nil) - res, err := client.Update(ctx, - "", - "", - "", - armdeviceupdate.TagUpdate{ - Tags: map[string]*string{ - "tagKey": to.StringPtr("tagValue"), - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.InstancesClientUpdateResult) -} diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_operations_client_test.go deleted file mode 100644 index 9d5561869cfa..000000000000 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,40 +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 armdeviceupdate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceupdate/armdeviceupdate" -) - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/Operations_List.json -func ExampleOperationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewOperationsClient(cred, nil) - pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_privateendpointconnectionproxies_client_test.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_privateendpointconnectionproxies_client_test.go deleted file mode 100644 index 7c12816e885c..000000000000 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_privateendpointconnectionproxies_client_test.go +++ /dev/null @@ -1,153 +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 armdeviceupdate_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceupdate/armdeviceupdate" -) - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/PrivateEndpointConnectionProxies/PrivateEndpointConnectionProxy_ListByAccount.json -func ExamplePrivateEndpointConnectionProxiesClient_ListByAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewPrivateEndpointConnectionProxiesClient("", cred, nil) - res, err := client.ListByAccount(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionProxiesClientListByAccountResult) -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/PrivateEndpointConnectionProxies/PrivateEndpointConnectionProxy_Validate.json -func ExamplePrivateEndpointConnectionProxiesClient_Validate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewPrivateEndpointConnectionProxiesClient("", cred, nil) - _, err = client.Validate(ctx, - "", - "", - "", - armdeviceupdate.PrivateEndpointConnectionProxy{ - RemotePrivateEndpoint: &armdeviceupdate.RemotePrivateEndpoint{ - ID: to.StringPtr(""), - ManualPrivateLinkServiceConnections: []*armdeviceupdate.PrivateLinkServiceConnection{ - { - Name: to.StringPtr(""), - GroupIDs: []*string{ - to.StringPtr("DeviceUpdate")}, - RequestMessage: to.StringPtr(""), - }}, - PrivateLinkServiceProxies: []*armdeviceupdate.PrivateLinkServiceProxy{ - { - GroupConnectivityInformation: []*armdeviceupdate.GroupConnectivityInformation{}, - ID: to.StringPtr(""), - }}, - }, - }, - nil) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/PrivateEndpointConnectionProxies/PrivateEndpointConnectionProxy_Get.json -func ExamplePrivateEndpointConnectionProxiesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewPrivateEndpointConnectionProxiesClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionProxiesClientGetResult) -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/PrivateEndpointConnectionProxies/PrivateEndpointConnectionProxy_CreateOrUpdate.json -func ExamplePrivateEndpointConnectionProxiesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewPrivateEndpointConnectionProxiesClient("", cred, nil) - poller, err := client.BeginCreateOrUpdate(ctx, - "", - "", - "", - armdeviceupdate.PrivateEndpointConnectionProxy{ - RemotePrivateEndpoint: &armdeviceupdate.RemotePrivateEndpoint{ - ID: to.StringPtr(""), - ManualPrivateLinkServiceConnections: []*armdeviceupdate.PrivateLinkServiceConnection{ - { - Name: to.StringPtr(""), - GroupIDs: []*string{ - to.StringPtr("DeviceUpdate")}, - RequestMessage: to.StringPtr(""), - }}, - PrivateLinkServiceProxies: []*armdeviceupdate.PrivateLinkServiceProxy{ - { - GroupConnectivityInformation: []*armdeviceupdate.GroupConnectivityInformation{}, - ID: to.StringPtr(""), - }}, - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/PrivateEndpointConnectionProxies/PrivateEndpointConnectionProxy_Delete.json -func ExamplePrivateEndpointConnectionProxiesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewPrivateEndpointConnectionProxiesClient("", cred, nil) - poller, err := client.BeginDelete(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } -} diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_privateendpointconnections_client_test.go deleted file mode 100644 index 93b7e50cbd8b..000000000000 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_privateendpointconnections_client_test.go +++ /dev/null @@ -1,109 +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 armdeviceupdate_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceupdate/armdeviceupdate" -) - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/PrivateEndpointConnections/PrivateEndpointConnection_ListByAccount.json -func ExamplePrivateEndpointConnectionsClient_ListByAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewPrivateEndpointConnectionsClient("", cred, nil) - res, err := client.ListByAccount(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientListByAccountResult) -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/PrivateEndpointConnections/PrivateEndpointConnection_Get.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewPrivateEndpointConnectionsClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.PrivateEndpointConnectionsClientGetResult) -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/PrivateEndpointConnections/PrivateEndpointConnection_CreateOrUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewPrivateEndpointConnectionsClient("", cred, nil) - poller, err := client.BeginCreateOrUpdate(ctx, - "", - "", - "", - armdeviceupdate.PrivateEndpointConnection{ - Properties: &armdeviceupdate.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armdeviceupdate.PrivateLinkServiceConnectionState{ - Description: to.StringPtr(""), - Status: armdeviceupdate.PrivateEndpointServiceConnectionStatus("Approved").ToPtr(), - }, - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/PrivateEndpointConnections/PrivateEndpointConnection_Delete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewPrivateEndpointConnectionsClient("", cred, nil) - poller, err := client.BeginDelete(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } -} diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_privatelinkresources_client_test.go deleted file mode 100644 index 0c547c10c6a8..000000000000 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/ze_generated_example_privatelinkresources_client_test.go +++ /dev/null @@ -1,54 +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 armdeviceupdate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceupdate/armdeviceupdate" -) - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/PrivateLinkResources/PrivateLinkResources_ListByAccount.json -func ExamplePrivateLinkResourcesClient_ListByAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewPrivateLinkResourcesClient("", cred, nil) - res, err := client.ListByAccount(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.PrivateLinkResourcesClientListByAccountResult) -} - -// x-ms-original-file: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/preview/2020-03-01-preview/examples/PrivateLinkResources/PrivateLinkResources_Get.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeviceupdate.NewPrivateLinkResourcesClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.PrivateLinkResourcesClientGetResult) -} diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_accounts_client.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_accounts_client.go index 9f903c4fb921..b8bd167f4ad9 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_accounts_client.go +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/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 ID. // 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 } // BeginCreate - Creates or updates Account. @@ -55,22 +60,18 @@ func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, // accountName - Account name. // account - Account details. // options - AccountsClientBeginCreateOptions contains the optional parameters for the AccountsClient.BeginCreate method. -func (client *AccountsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, account Account, options *AccountsClientBeginCreateOptions) (AccountsClientCreatePollerResponse, error) { - resp, err := client.create(ctx, resourceGroupName, accountName, account, options) - if err != nil { - return AccountsClientCreatePollerResponse{}, err - } - result := AccountsClientCreatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("AccountsClient.Create", "azure-async-operation", resp, client.pl) - if err != nil { - return AccountsClientCreatePollerResponse{}, err - } - result.Poller = &AccountsClientCreatePoller{ - pt: pt, +func (client *AccountsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, account Account, options *AccountsClientBeginCreateOptions) (*armruntime.Poller[AccountsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, accountName, account, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[AccountsClientCreateResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[AccountsClientCreateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Create - Creates or updates Account. @@ -110,7 +111,7 @@ func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, account) @@ -121,22 +122,18 @@ func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceG // resourceGroupName - The resource group name. // accountName - Account name. // options - AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. -func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginDeleteOptions) (AccountsClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, options) - if err != nil { - return AccountsClientDeletePollerResponse{}, err - } - result := AccountsClientDeletePollerResponse{ - RawResponse: resp, +func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginDeleteOptions) (*armruntime.Poller[AccountsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[AccountsClientDeleteResponse]{ + FinalStateVia: armruntime.FinalStateViaLocation, + }) + } else { + return armruntime.NewPollerFromResumeToken[AccountsClientDeleteResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("AccountsClient.Delete", "location", resp, client.pl) - if err != nil { - return AccountsClientDeletePollerResponse{}, err - } - result.Poller = &AccountsClientDeletePoller{ - pt: pt, - } - return result, nil } // Delete - Deletes account. @@ -176,7 +173,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -222,7 +219,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -230,7 +227,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.Account); err != nil { return AccountsClientGetResponse{}, err } @@ -250,7 +247,7 @@ func (client *AccountsClient) Head(ctx context.Context, resourceGroupName string if err != nil { return AccountsClientHeadResponse{}, err } - result := AccountsClientHeadResponse{RawResponse: resp} + result := AccountsClientHeadResponse{} if resp.StatusCode >= 200 && resp.StatusCode < 300 { result.Success = true } @@ -277,7 +274,7 @@ func (client *AccountsClient) headCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -288,16 +285,32 @@ func (client *AccountsClient) headCreateRequest(ctx context.Context, resourceGro // resourceGroupName - The resource group name. // options - AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.ListByResourceGroup // method. -func (client *AccountsClient) ListByResourceGroup(resourceGroupName string, options *AccountsClientListByResourceGroupOptions) *AccountsClientListByResourceGroupPager { - return &AccountsClientListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) +func (client *AccountsClient) ListByResourceGroup(resourceGroupName string, options *AccountsClientListByResourceGroupOptions) *runtime.Pager[AccountsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[AccountsClientListByResourceGroupResponse]{ + More: func(page AccountsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp AccountsClientListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.AccountList.NextLink) + Fetcher: func(ctx context.Context, page *AccountsClientListByResourceGroupResponse) (AccountsClientListByResourceGroupResponse, 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 AccountsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccountsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccountsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) }, - } + }) } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. @@ -316,7 +329,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -324,7 +337,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.AccountList); err != nil { return AccountsClientListByResourceGroupResponse{}, err } @@ -335,16 +348,32 @@ func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Respo // If the operation fails it returns an *azcore.ResponseError type. // options - AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.ListBySubscription // method. -func (client *AccountsClient) ListBySubscription(options *AccountsClientListBySubscriptionOptions) *AccountsClientListBySubscriptionPager { - return &AccountsClientListBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) +func (client *AccountsClient) ListBySubscription(options *AccountsClientListBySubscriptionOptions) *runtime.Pager[AccountsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[AccountsClientListBySubscriptionResponse]{ + More: func(page AccountsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp AccountsClientListBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.AccountList.NextLink) + Fetcher: func(ctx context.Context, page *AccountsClientListBySubscriptionResponse) (AccountsClientListBySubscriptionResponse, 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 AccountsClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccountsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccountsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) }, - } + }) } // listBySubscriptionCreateRequest creates the ListBySubscription request. @@ -359,7 +388,7 @@ func (client *AccountsClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -367,7 +396,7 @@ func (client *AccountsClient) listBySubscriptionCreateRequest(ctx context.Contex // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *AccountsClient) listBySubscriptionHandleResponse(resp *http.Response) (AccountsClientListBySubscriptionResponse, error) { - result := AccountsClientListBySubscriptionResponse{RawResponse: resp} + result := AccountsClientListBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AccountList); err != nil { return AccountsClientListBySubscriptionResponse{}, err } @@ -380,22 +409,18 @@ func (client *AccountsClient) listBySubscriptionHandleResponse(resp *http.Respon // accountName - Account name. // accountUpdatePayload - Updated Account. // options - AccountsClientBeginUpdateOptions contains the optional parameters for the AccountsClient.BeginUpdate method. -func (client *AccountsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, accountUpdatePayload AccountUpdate, options *AccountsClientBeginUpdateOptions) (AccountsClientUpdatePollerResponse, error) { - resp, err := client.update(ctx, resourceGroupName, accountName, accountUpdatePayload, options) - if err != nil { - return AccountsClientUpdatePollerResponse{}, err +func (client *AccountsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, accountUpdatePayload AccountUpdate, options *AccountsClientBeginUpdateOptions) (*armruntime.Poller[AccountsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, accountUpdatePayload, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[AccountsClientUpdateResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[AccountsClientUpdateResponse](options.ResumeToken, client.pl, nil) } - result := AccountsClientUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("AccountsClient.Update", "azure-async-operation", resp, client.pl) - if err != nil { - return AccountsClientUpdatePollerResponse{}, err - } - result.Poller = &AccountsClientUpdatePoller{ - pt: pt, - } - return result, nil } // Update - Updates account's patchable properties @@ -435,7 +460,7 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, accountUpdatePayload) diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_client.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_client.go index 79bd8a77e55e..df823a48e2d3 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_client.go +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/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" @@ -33,20 +34,24 @@ type Client struct { // subscriptionID - The Azure subscription ID. // 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 { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, 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 := &Client{ 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 ADU resource name availability. @@ -80,7 +85,7 @@ func (client *Client) checkNameAvailabilityCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, request) @@ -88,7 +93,7 @@ func (client *Client) checkNameAvailabilityCreateRequest(ctx context.Context, re // 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.CheckNameAvailabilityResponse); err != nil { return ClientCheckNameAvailabilityResponse{}, err } diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_constants.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_constants.go index 96a247169d1b..1b36c0cbc10e 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_constants.go +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/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 armdeviceupdate const ( moduleName = "armdeviceupdate" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -27,11 +27,6 @@ func PossibleActionTypeValues() []ActionType { } } -// ToPtr returns a *ActionType pointing to the current value. -func (c ActionType) ToPtr() *ActionType { - return &c -} - // AuthenticationType - Authentication Type type AuthenticationType string @@ -46,11 +41,6 @@ func PossibleAuthenticationTypeValues() []AuthenticationType { } } -// ToPtr returns a *AuthenticationType pointing to the current value. -func (c AuthenticationType) ToPtr() *AuthenticationType { - return &c -} - // CheckNameAvailabilityReason - The reason why the given name is not available. type CheckNameAvailabilityReason string @@ -67,11 +57,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 @@ -92,11 +77,6 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// ToPtr returns a *CreatedByType pointing to the current value. -func (c CreatedByType) ToPtr() *CreatedByType { - return &c -} - // GroupIDProvisioningState - The provisioning state of private link group ID. type GroupIDProvisioningState string @@ -115,11 +95,6 @@ func PossibleGroupIDProvisioningStateValues() []GroupIDProvisioningState { } } -// ToPtr returns a *GroupIDProvisioningState pointing to the current value. -func (c GroupIDProvisioningState) ToPtr() *GroupIDProvisioningState { - return &c -} - // ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). type ManagedServiceIdentityType string @@ -140,11 +115,6 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { } } -// ToPtr returns a *ManagedServiceIdentityType pointing to the current value. -func (c ManagedServiceIdentityType) ToPtr() *ManagedServiceIdentityType { - return &c -} - // Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default // value is "user,system" type Origin string @@ -164,11 +134,6 @@ func PossibleOriginValues() []Origin { } } -// ToPtr returns a *Origin pointing to the current value. -func (c Origin) ToPtr() *Origin { - return &c -} - // PrivateEndpointConnectionProvisioningState - The current provisioning state. type PrivateEndpointConnectionProvisioningState string @@ -189,11 +154,6 @@ func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpoin } } -// ToPtr returns a *PrivateEndpointConnectionProvisioningState pointing to the current value. -func (c PrivateEndpointConnectionProvisioningState) ToPtr() *PrivateEndpointConnectionProvisioningState { - return &c -} - // PrivateEndpointConnectionProxyProvisioningState - The current provisioning state. type PrivateEndpointConnectionProxyProvisioningState string @@ -214,11 +174,6 @@ func PossiblePrivateEndpointConnectionProxyProvisioningStateValues() []PrivateEn } } -// ToPtr returns a *PrivateEndpointConnectionProxyProvisioningState pointing to the current value. -func (c PrivateEndpointConnectionProxyProvisioningState) ToPtr() *PrivateEndpointConnectionProxyProvisioningState { - return &c -} - // PrivateEndpointServiceConnectionStatus - The private endpoint connection status. type PrivateEndpointServiceConnectionStatus string @@ -237,11 +192,6 @@ func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointSer } } -// ToPtr returns a *PrivateEndpointServiceConnectionStatus pointing to the current value. -func (c PrivateEndpointServiceConnectionStatus) ToPtr() *PrivateEndpointServiceConnectionStatus { - return &c -} - // ProvisioningState - Provisioning state. type ProvisioningState string @@ -266,11 +216,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 the account. type PublicNetworkAccess string @@ -287,7 +232,34 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { } } -// ToPtr returns a *PublicNetworkAccess pointing to the current value. -func (c PublicNetworkAccess) ToPtr() *PublicNetworkAccess { - return &c +// Role - Whether the location is primary or failover +type Role string + +const ( + RoleFailover Role = "Failover" + RolePrimary Role = "Primary" +) + +// PossibleRoleValues returns the possible values for the Role const type. +func PossibleRoleValues() []Role { + return []Role{ + RoleFailover, + RolePrimary, + } +} + +// SKU - Device Update Sku +type SKU string + +const ( + SKUFree SKU = "Free" + SKUStandard SKU = "Standard" +) + +// PossibleSKUValues returns the possible values for the SKU const type. +func PossibleSKUValues() []SKU { + return []SKU{ + SKUFree, + SKUStandard, + } } diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_instances_client.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_instances_client.go index e22c7a67ae36..62663c2973b9 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_instances_client.go +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_instances_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 InstancesClient struct { // subscriptionID - The Azure subscription ID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *InstancesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*InstancesClient, 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 := &InstancesClient{ 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 or updates instance. @@ -56,22 +61,18 @@ func NewInstancesClient(subscriptionID string, credential azcore.TokenCredential // instanceName - Instance name. // instance - Instance details. // options - InstancesClientBeginCreateOptions contains the optional parameters for the InstancesClient.BeginCreate method. -func (client *InstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, instanceName string, instance Instance, options *InstancesClientBeginCreateOptions) (InstancesClientCreatePollerResponse, error) { - resp, err := client.create(ctx, resourceGroupName, accountName, instanceName, instance, options) - if err != nil { - return InstancesClientCreatePollerResponse{}, err - } - result := InstancesClientCreatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("InstancesClient.Create", "azure-async-operation", resp, client.pl) - if err != nil { - return InstancesClientCreatePollerResponse{}, err - } - result.Poller = &InstancesClientCreatePoller{ - pt: pt, +func (client *InstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, instanceName string, instance Instance, options *InstancesClientBeginCreateOptions) (*armruntime.Poller[InstancesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, accountName, instanceName, instance, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[InstancesClientCreateResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[InstancesClientCreateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Create - Creates or updates instance. @@ -115,7 +116,7 @@ func (client *InstancesClient) createCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, instance) @@ -127,22 +128,18 @@ func (client *InstancesClient) createCreateRequest(ctx context.Context, resource // accountName - Account name. // instanceName - Instance name. // options - InstancesClientBeginDeleteOptions contains the optional parameters for the InstancesClient.BeginDelete method. -func (client *InstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, instanceName string, options *InstancesClientBeginDeleteOptions) (InstancesClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, instanceName, options) - if err != nil { - return InstancesClientDeletePollerResponse{}, err - } - result := InstancesClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("InstancesClient.Delete", "location", resp, client.pl) - if err != nil { - return InstancesClientDeletePollerResponse{}, err - } - result.Poller = &InstancesClientDeletePoller{ - pt: pt, +func (client *InstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, instanceName string, options *InstancesClientBeginDeleteOptions) (*armruntime.Poller[InstancesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, instanceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[InstancesClientDeleteResponse]{ + FinalStateVia: armruntime.FinalStateViaLocation, + }) + } else { + return armruntime.NewPollerFromResumeToken[InstancesClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - Deletes instance. @@ -186,7 +183,7 @@ func (client *InstancesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -237,7 +234,7 @@ func (client *InstancesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -245,7 +242,7 @@ func (client *InstancesClient) getCreateRequest(ctx context.Context, resourceGro // getHandleResponse handles the Get response. func (client *InstancesClient) getHandleResponse(resp *http.Response) (InstancesClientGetResponse, error) { - result := InstancesClientGetResponse{RawResponse: resp} + result := InstancesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Instance); err != nil { return InstancesClientGetResponse{}, err } @@ -266,7 +263,7 @@ func (client *InstancesClient) Head(ctx context.Context, resourceGroupName strin if err != nil { return InstancesClientHeadResponse{}, err } - result := InstancesClientHeadResponse{RawResponse: resp} + result := InstancesClientHeadResponse{} if resp.StatusCode >= 200 && resp.StatusCode < 300 { result.Success = true } @@ -297,7 +294,7 @@ func (client *InstancesClient) headCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,16 +305,32 @@ func (client *InstancesClient) headCreateRequest(ctx context.Context, resourceGr // resourceGroupName - The resource group name. // accountName - Account name. // options - InstancesClientListByAccountOptions contains the optional parameters for the InstancesClient.ListByAccount method. -func (client *InstancesClient) ListByAccount(resourceGroupName string, accountName string, options *InstancesClientListByAccountOptions) *InstancesClientListByAccountPager { - return &InstancesClientListByAccountPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByAccountCreateRequest(ctx, resourceGroupName, accountName, options) +func (client *InstancesClient) ListByAccount(resourceGroupName string, accountName string, options *InstancesClientListByAccountOptions) *runtime.Pager[InstancesClientListByAccountResponse] { + return runtime.NewPager(runtime.PageProcessor[InstancesClientListByAccountResponse]{ + More: func(page InstancesClientListByAccountResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp InstancesClientListByAccountResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.InstanceList.NextLink) + Fetcher: func(ctx context.Context, page *InstancesClientListByAccountResponse) (InstancesClientListByAccountResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByAccountCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return InstancesClientListByAccountResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InstancesClientListByAccountResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InstancesClientListByAccountResponse{}, runtime.NewResponseError(resp) + } + return client.listByAccountHandleResponse(resp) }, - } + }) } // listByAccountCreateRequest creates the ListByAccount request. @@ -340,7 +353,7 @@ func (client *InstancesClient) listByAccountCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -348,7 +361,7 @@ func (client *InstancesClient) listByAccountCreateRequest(ctx context.Context, r // listByAccountHandleResponse handles the ListByAccount response. func (client *InstancesClient) listByAccountHandleResponse(resp *http.Response) (InstancesClientListByAccountResponse, error) { - result := InstancesClientListByAccountResponse{RawResponse: resp} + result := InstancesClientListByAccountResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.InstanceList); err != nil { return InstancesClientListByAccountResponse{}, err } @@ -401,7 +414,7 @@ func (client *InstancesClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, tagUpdatePayload) @@ -409,7 +422,7 @@ func (client *InstancesClient) updateCreateRequest(ctx context.Context, resource // updateHandleResponse handles the Update response. func (client *InstancesClient) updateHandleResponse(resp *http.Response) (InstancesClientUpdateResponse, error) { - result := InstancesClientUpdateResponse{RawResponse: resp} + result := InstancesClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Instance); err != nil { return InstancesClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_models.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_models.go index d9011c981360..186791e3cbc2 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_models.go +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/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 armdeviceupdate -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // Account - Device Update account details. type Account struct { @@ -42,20 +37,6 @@ type Account struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Account. -func (a Account) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "identity", a.Identity) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - // AccountList - List of Accounts. type AccountList struct { // The link used to get the next page of Accounts list. @@ -65,14 +46,6 @@ type AccountList struct { Value []*Account `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AccountList. -func (a AccountList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - // AccountProperties - Device Update account properties. type AccountProperties struct { // List of private endpoint connections associated with the account. @@ -81,23 +54,19 @@ type AccountProperties struct { // Whether or not public network access is allowed for the account. PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // Device Update Sku + SKU *SKU `json:"sku,omitempty"` + // READ-ONLY; API host name. HostName *string `json:"hostName,omitempty" azure:"ro"` + // READ-ONLY; Device Update account primary and failover location details + Locations []*Location `json:"locations,omitempty" azure:"ro"` + // READ-ONLY; Provisioning state. ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AccountProperties. -func (a AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "hostName", a.HostName) - populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) - return json.Marshal(objectMap) -} - // AccountUpdate - Request payload used to update and existing Accounts. type AccountUpdate struct { // The type of identity used for the resource. @@ -110,28 +79,22 @@ type AccountUpdate struct { Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AccountUpdate. -func (a AccountUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", a.Identity) - populate(objectMap, "location", a.Location) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - // AccountsClientBeginCreateOptions contains the optional parameters for the AccountsClient.BeginCreate method. type AccountsClientBeginCreateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. type AccountsClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // AccountsClientBeginUpdateOptions contains the optional parameters for the AccountsClient.BeginUpdate method. type AccountsClientBeginUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. @@ -213,7 +176,7 @@ type DiagnosticStorageProperties struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info map[string]interface{} `json:"info,omitempty" azure:"ro"` + Info interface{} `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -237,17 +200,6 @@ 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 { @@ -276,18 +228,6 @@ type GroupConnectivityInformation struct { MemberName *string `json:"memberName,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type GroupConnectivityInformation. -func (g GroupConnectivityInformation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "customerVisibleFqdns", g.CustomerVisibleFqdns) - populate(objectMap, "groupId", g.GroupID) - populate(objectMap, "internalFqdn", g.InternalFqdn) - populate(objectMap, "memberName", g.MemberName) - populate(objectMap, "privateLinkServiceArmRegion", g.PrivateLinkServiceArmRegion) - populate(objectMap, "redirectMapId", g.RedirectMapID) - return json.Marshal(objectMap) -} - // GroupInformation - The group information for creating a private endpoint on an Account type GroupInformation struct { // REQUIRED; The properties for a group information object @@ -321,16 +261,6 @@ type GroupInformationProperties struct { RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type GroupInformationProperties. -func (g GroupInformationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupId", g.GroupID) - populate(objectMap, "provisioningState", g.ProvisioningState) - populate(objectMap, "requiredMembers", g.RequiredMembers) - populate(objectMap, "requiredZoneNames", g.RequiredZoneNames) - return json.Marshal(objectMap) -} - // Instance - Device Update instance details. type Instance struct { // REQUIRED; The geo-location where the resource lives @@ -355,19 +285,6 @@ type Instance struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Instance. -func (i Instance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", i.ID) - 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) -} - // InstanceList - List of Instances. type InstanceList struct { // The link used to get the next page of Instances list. @@ -377,14 +294,6 @@ type InstanceList struct { Value []*Instance `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type InstanceList. -func (i InstanceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) - return json.Marshal(objectMap) -} - // InstanceProperties - Device Update instance properties. type InstanceProperties struct { // Customer-initiated diagnostic log collection storage properties @@ -403,25 +312,16 @@ type InstanceProperties struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type InstanceProperties. -func (i InstanceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accountName", i.AccountName) - populate(objectMap, "diagnosticStorageProperties", i.DiagnosticStorageProperties) - populate(objectMap, "enableDiagnostics", i.EnableDiagnostics) - populate(objectMap, "iotHubs", i.IotHubs) - populate(objectMap, "provisioningState", i.ProvisioningState) - return json.Marshal(objectMap) -} - // InstancesClientBeginCreateOptions contains the optional parameters for the InstancesClient.BeginCreate method. type InstancesClientBeginCreateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // InstancesClientBeginDeleteOptions contains the optional parameters for the InstancesClient.BeginDelete method. type InstancesClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // InstancesClientGetOptions contains the optional parameters for the InstancesClient.Get method. @@ -448,12 +348,13 @@ type InstancesClientUpdateOptions struct { type IotHubSettings struct { // REQUIRED; IoTHub resource ID ResourceID *string `json:"resourceId,omitempty"` +} - // EventHub connection string. - EventHubConnectionString *string `json:"eventHubConnectionString,omitempty"` +type Location struct { + Name *string `json:"name,omitempty"` - // IoTHub connection string. - IoTHubConnectionString *string `json:"ioTHubConnectionString,omitempty"` + // Whether the location is primary or failover + Role *Role `json:"role,omitempty"` } // ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) @@ -476,16 +377,6 @@ type ManagedServiceIdentity struct { TenantID *string `json:"tenantId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. -func (m ManagedServiceIdentity) 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) -} - // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. @@ -535,14 +426,6 @@ type OperationListResult struct { Value []*Operation `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 @@ -578,13 +461,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) -} - // PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. type PrivateEndpointConnectionProperties struct { // REQUIRED; A collection of information about the state of the connection between service consumer and provider. @@ -600,26 +476,18 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *PrivateEndpointConnectionProvisioningState `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) -} - // PrivateEndpointConnectionProxiesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.BeginCreateOrUpdate // method. type PrivateEndpointConnectionProxiesClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // PrivateEndpointConnectionProxiesClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.BeginDelete // method. type PrivateEndpointConnectionProxiesClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // PrivateEndpointConnectionProxiesClientGetOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Get @@ -634,6 +502,12 @@ type PrivateEndpointConnectionProxiesClientListByAccountOptions struct { // placeholder for future optional parameters } +// PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.UpdatePrivateEndpointProperties +// method. +type PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesOptions struct { + // placeholder for future optional parameters +} + // PrivateEndpointConnectionProxiesClientValidateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Validate // method. type PrivateEndpointConnectionProxiesClientValidateOptions struct { @@ -642,6 +516,9 @@ type PrivateEndpointConnectionProxiesClientValidateOptions struct { // PrivateEndpointConnectionProxy - Private endpoint connection proxy details. type PrivateEndpointConnectionProxy struct { + // Private endpoint connection proxy object property bag. + Properties *PrivateEndpointConnectionProxyProperties `json:"properties,omitempty"` + // Remote private endpoint details. RemotePrivateEndpoint *RemotePrivateEndpoint `json:"remotePrivateEndpoint,omitempty"` @@ -657,9 +534,6 @@ type PrivateEndpointConnectionProxy struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The provisioning state of the private endpoint connection proxy resource. - ProvisioningState *PrivateEndpointConnectionProxyProvisioningState `json:"provisioningState,omitempty" azure:"ro"` - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` @@ -677,16 +551,14 @@ type PrivateEndpointConnectionProxyListResult struct { Value []*PrivateEndpointConnectionProxy `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProxyListResult. -func (p PrivateEndpointConnectionProxyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) +// PrivateEndpointConnectionProxyProperties - Private endpoint connection proxy object property bag. +type PrivateEndpointConnectionProxyProperties struct { + // READ-ONLY; The provisioning state of the private endpoint connection proxy resource. + ProvisioningState *PrivateEndpointConnectionProxyProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// PrivateEndpointConnectionProxyProperties - Private endpoint connection proxy object properties. -type PrivateEndpointConnectionProxyProperties struct { +// PrivateEndpointConnectionProxyPropertiesAutoGenerated - Private endpoint connection proxy object properties. +type PrivateEndpointConnectionProxyPropertiesAutoGenerated struct { // Remote private endpoint details. RemotePrivateEndpoint *RemotePrivateEndpoint `json:"remotePrivateEndpoint,omitempty"` @@ -695,21 +567,20 @@ type PrivateEndpointConnectionProxyProperties struct { // READ-ONLY; ETag from NRP. ETag *string `json:"eTag,omitempty" azure:"ro"` - - // READ-ONLY; The provisioning state of the private endpoint connection proxy resource. - ProvisioningState *PrivateEndpointConnectionProxyProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } // PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate // method. type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // 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 @@ -724,6 +595,24 @@ type PrivateEndpointConnectionsClientListByAccountOptions struct { // placeholder for future optional parameters } +// PrivateEndpointUpdate - Private endpoint update details. +type PrivateEndpointUpdate struct { + // Remote endpoint resource ID. + ID *string `json:"id,omitempty"` + + // Original resource ID needed by Microsoft.Network. + ImmutableResourceID *string `json:"immutableResourceId,omitempty"` + + // Original subscription ID needed by Microsoft.Network. + ImmutableSubscriptionID *string `json:"immutableSubscriptionId,omitempty"` + + // ARM location of the remote private endpoint. + Location *string `json:"location,omitempty"` + + // Virtual network traffic tag. + VnetTrafficTag *string `json:"vnetTrafficTag,omitempty"` +} + // PrivateLinkResourceListResult - The available private link resources for an Account type PrivateLinkResourceListResult struct { // The URI that can be used to request the next list of private link resources. @@ -733,14 +622,6 @@ type PrivateLinkResourceListResult struct { Value []*GroupInformation `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, "nextLink", p.NextLink) - 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. @@ -753,15 +634,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 @@ -785,15 +657,6 @@ type PrivateLinkServiceConnection struct { RequestMessage *string `json:"requestMessage,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnection. -func (p PrivateLinkServiceConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupIds", p.GroupIDs) - populate(objectMap, "name", p.Name) - populate(objectMap, "requestMessage", p.RequestMessage) - return json.Marshal(objectMap) -} - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer // and provider. type PrivateLinkServiceConnectionState struct { @@ -822,16 +685,6 @@ type PrivateLinkServiceProxy struct { RemotePrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"remotePrivateLinkServiceConnectionState,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceProxy. -func (p PrivateLinkServiceProxy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupConnectivityInformation", p.GroupConnectivityInformation) - populate(objectMap, "id", p.ID) - populate(objectMap, "remotePrivateEndpointConnection", p.RemotePrivateEndpointConnection) - populate(objectMap, "remotePrivateLinkServiceConnectionState", p.RemotePrivateLinkServiceConnectionState) - return json.Marshal(objectMap) -} - // PrivateLinkServiceProxyRemotePrivateEndpointConnection - Remote private endpoint connection details. type PrivateLinkServiceProxyRemotePrivateEndpointConnection struct { // READ-ONLY; Remote private endpoint connection ID. @@ -862,6 +715,15 @@ type RemotePrivateEndpoint struct { // Remote endpoint resource ID. ID *string `json:"id,omitempty"` + // Original resource ID needed by Microsoft.Network. + ImmutableResourceID *string `json:"immutableResourceId,omitempty"` + + // Original subscription ID needed by Microsoft.Network. + ImmutableSubscriptionID *string `json:"immutableSubscriptionId,omitempty"` + + // ARM location of the remote private endpoint. + Location *string `json:"location,omitempty"` + // List of private link service connections that need manual approval. ManualPrivateLinkServiceConnections []*PrivateLinkServiceConnection `json:"manualPrivateLinkServiceConnections,omitempty"` @@ -871,20 +733,8 @@ type RemotePrivateEndpoint struct { // List of private link service proxies. PrivateLinkServiceProxies []*PrivateLinkServiceProxy `json:"privateLinkServiceProxies,omitempty"` - // READ-ONLY; Virtual network traffic tag. - VnetTrafficTag *string `json:"vnetTrafficTag,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type RemotePrivateEndpoint. -func (r RemotePrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "connectionDetails", r.ConnectionDetails) - populate(objectMap, "id", r.ID) - populate(objectMap, "manualPrivateLinkServiceConnections", r.ManualPrivateLinkServiceConnections) - populate(objectMap, "privateLinkServiceConnections", r.PrivateLinkServiceConnections) - populate(objectMap, "privateLinkServiceProxies", r.PrivateLinkServiceProxies) - populate(objectMap, "vnetTrafficTag", r.VnetTrafficTag) - return json.Marshal(objectMap) + // Virtual network traffic tag. + VnetTrafficTag *string `json:"vnetTrafficTag,omitempty"` } // RemotePrivateEndpointConnection - Remote private endpoint connection details. @@ -929,66 +779,12 @@ 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 -} - // TagUpdate - Request payload used to update an existing resource's tags. type TagUpdate struct { // List of key value pairs that describe the resource. This will overwrite the existing tags. Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type TagUpdate. -func (t TagUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", t.Tags) - return json.Marshal(objectMap) -} - // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { @@ -1011,18 +807,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) -} - // UserAssignedIdentity - User assigned identity properties type UserAssignedIdentity struct { // READ-ONLY; The client ID of the assigned identity. @@ -1031,20 +815,3 @@ type UserAssignedIdentity struct { // READ-ONLY; The principal ID of the 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/deviceupdate/armdeviceupdate/zz_generated_models_serde.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_models_serde.go new file mode 100644 index 000000000000..b7ab26b85070 --- /dev/null +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_models_serde.go @@ -0,0 +1,300 @@ +//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 armdeviceupdate + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Account. +func (a Account) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AccountList. +func (a AccountList) 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 AccountProperties. +func (a AccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hostName", a.HostName) + populate(objectMap, "locations", a.Locations) + populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) + populate(objectMap, "sku", a.SKU) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AccountUpdate. +func (a AccountUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "location", a.Location) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// 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 GroupConnectivityInformation. +func (g GroupConnectivityInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customerVisibleFqdns", g.CustomerVisibleFqdns) + populate(objectMap, "groupId", g.GroupID) + populate(objectMap, "internalFqdn", g.InternalFqdn) + populate(objectMap, "memberName", g.MemberName) + populate(objectMap, "privateLinkServiceArmRegion", g.PrivateLinkServiceArmRegion) + populate(objectMap, "redirectMapId", g.RedirectMapID) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type GroupInformationProperties. +func (g GroupInformationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", g.GroupID) + populate(objectMap, "provisioningState", g.ProvisioningState) + populate(objectMap, "requiredMembers", g.RequiredMembers) + populate(objectMap, "requiredZoneNames", g.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Instance. +func (i Instance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + 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) +} + +// MarshalJSON implements the json.Marshaller interface for type InstanceList. +func (i InstanceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type InstanceProperties. +func (i InstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountName", i.AccountName) + populate(objectMap, "diagnosticStorageProperties", i.DiagnosticStorageProperties) + populate(objectMap, "enableDiagnostics", i.EnableDiagnostics) + populate(objectMap, "iotHubs", i.IotHubs) + populate(objectMap, "provisioningState", i.ProvisioningState) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) 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 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 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 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 PrivateEndpointConnectionProxyListResult. +func (p PrivateEndpointConnectionProxyListResult) 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 PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) 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) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnection. +func (p PrivateLinkServiceConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "name", p.Name) + populate(objectMap, "requestMessage", p.RequestMessage) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceProxy. +func (p PrivateLinkServiceProxy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupConnectivityInformation", p.GroupConnectivityInformation) + populate(objectMap, "id", p.ID) + populate(objectMap, "remotePrivateEndpointConnection", p.RemotePrivateEndpointConnection) + populate(objectMap, "remotePrivateLinkServiceConnectionState", p.RemotePrivateLinkServiceConnectionState) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type RemotePrivateEndpoint. +func (r RemotePrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectionDetails", r.ConnectionDetails) + populate(objectMap, "id", r.ID) + populate(objectMap, "immutableResourceId", r.ImmutableResourceID) + populate(objectMap, "immutableSubscriptionId", r.ImmutableSubscriptionID) + populate(objectMap, "location", r.Location) + populate(objectMap, "manualPrivateLinkServiceConnections", r.ManualPrivateLinkServiceConnections) + populate(objectMap, "privateLinkServiceConnections", r.PrivateLinkServiceConnections) + populate(objectMap, "privateLinkServiceProxies", r.PrivateLinkServiceProxies) + populate(objectMap, "vnetTrafficTag", r.VnetTrafficTag) + 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 TagUpdate. +func (t TagUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", t.Tags) + 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, "systemData", t.SystemData) + 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/deviceupdate/armdeviceupdate/zz_generated_operations_client.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_operations_client.go index 71aefb7bb895..d4a334862bfa 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_operations_client.go +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/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 - Returns list of operations for Microsoft.DeviceUpdate resource 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. @@ -66,7 +87,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -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/deviceupdate/armdeviceupdate/zz_generated_pagers.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_pagers.go deleted file mode 100644 index 63fa41fe668b..000000000000 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/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 armdeviceupdate - -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" -) - -// AccountsClientListByResourceGroupPager provides operations for iterating over paged responses. -type AccountsClientListByResourceGroupPager struct { - client *AccountsClient - current AccountsClientListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, AccountsClientListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *AccountsClientListByResourceGroupPager) 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 *AccountsClientListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.AccountList.NextLink == nil || len(*p.current.AccountList.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 AccountsClientListByResourceGroupResponse page. -func (p *AccountsClientListByResourceGroupPager) PageResponse() AccountsClientListByResourceGroupResponse { - return p.current -} - -// AccountsClientListBySubscriptionPager provides operations for iterating over paged responses. -type AccountsClientListBySubscriptionPager struct { - client *AccountsClient - current AccountsClientListBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, AccountsClientListBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *AccountsClientListBySubscriptionPager) 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 *AccountsClientListBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.AccountList.NextLink == nil || len(*p.current.AccountList.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 AccountsClientListBySubscriptionResponse page. -func (p *AccountsClientListBySubscriptionPager) PageResponse() AccountsClientListBySubscriptionResponse { - return p.current -} - -// InstancesClientListByAccountPager provides operations for iterating over paged responses. -type InstancesClientListByAccountPager struct { - client *InstancesClient - current InstancesClientListByAccountResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, InstancesClientListByAccountResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *InstancesClientListByAccountPager) 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 *InstancesClientListByAccountPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.InstanceList.NextLink == nil || len(*p.current.InstanceList.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.listByAccountHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current InstancesClientListByAccountResponse page. -func (p *InstancesClientListByAccountPager) PageResponse() InstancesClientListByAccountResponse { - 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.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 -} diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_pollers.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_pollers.go deleted file mode 100644 index fbbcf21a00c3..000000000000 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_pollers.go +++ /dev/null @@ -1,402 +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 armdeviceupdate - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// AccountsClientCreatePoller provides polling facilities until the operation reaches a terminal state. -type AccountsClientCreatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *AccountsClientCreatePoller) 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 *AccountsClientCreatePoller) 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 AccountsClientCreateResponse will be returned. -func (p *AccountsClientCreatePoller) FinalResponse(ctx context.Context) (AccountsClientCreateResponse, error) { - respType := AccountsClientCreateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.Account) - if err != nil { - return AccountsClientCreateResponse{}, 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 *AccountsClientCreatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// AccountsClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type AccountsClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *AccountsClientDeletePoller) 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 *AccountsClientDeletePoller) 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 AccountsClientDeleteResponse will be returned. -func (p *AccountsClientDeletePoller) FinalResponse(ctx context.Context) (AccountsClientDeleteResponse, error) { - respType := AccountsClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return AccountsClientDeleteResponse{}, 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 *AccountsClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// AccountsClientUpdatePoller provides polling facilities until the operation reaches a terminal state. -type AccountsClientUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *AccountsClientUpdatePoller) 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 *AccountsClientUpdatePoller) 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 AccountsClientUpdateResponse will be returned. -func (p *AccountsClientUpdatePoller) FinalResponse(ctx context.Context) (AccountsClientUpdateResponse, error) { - respType := AccountsClientUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.Account) - if err != nil { - return AccountsClientUpdateResponse{}, 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 *AccountsClientUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// InstancesClientCreatePoller provides polling facilities until the operation reaches a terminal state. -type InstancesClientCreatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *InstancesClientCreatePoller) 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 *InstancesClientCreatePoller) 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 InstancesClientCreateResponse will be returned. -func (p *InstancesClientCreatePoller) FinalResponse(ctx context.Context) (InstancesClientCreateResponse, error) { - respType := InstancesClientCreateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.Instance) - if err != nil { - return InstancesClientCreateResponse{}, 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 *InstancesClientCreatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// InstancesClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type InstancesClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *InstancesClientDeletePoller) 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 *InstancesClientDeletePoller) 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 InstancesClientDeleteResponse will be returned. -func (p *InstancesClientDeletePoller) FinalResponse(ctx context.Context) (InstancesClientDeleteResponse, error) { - respType := InstancesClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return InstancesClientDeleteResponse{}, 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 *InstancesClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller) 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 *PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller) 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 PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse will be returned. -func (p *PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse, error) { - respType := PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.PrivateEndpointConnectionProxy) - if err != nil { - return PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse{}, 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 *PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PrivateEndpointConnectionProxiesClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type PrivateEndpointConnectionProxiesClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PrivateEndpointConnectionProxiesClientDeletePoller) 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 *PrivateEndpointConnectionProxiesClientDeletePoller) 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 PrivateEndpointConnectionProxiesClientDeleteResponse will be returned. -func (p *PrivateEndpointConnectionProxiesClientDeletePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionProxiesClientDeleteResponse, error) { - respType := PrivateEndpointConnectionProxiesClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return PrivateEndpointConnectionProxiesClientDeleteResponse{}, 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 *PrivateEndpointConnectionProxiesClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PrivateEndpointConnectionsClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type PrivateEndpointConnectionsClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PrivateEndpointConnectionsClientCreateOrUpdatePoller) 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 *PrivateEndpointConnectionsClientCreateOrUpdatePoller) 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 PrivateEndpointConnectionsClientCreateOrUpdateResponse will be returned. -func (p *PrivateEndpointConnectionsClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error) { - respType := PrivateEndpointConnectionsClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.PrivateEndpointConnection) - if err != nil { - return PrivateEndpointConnectionsClientCreateOrUpdateResponse{}, 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 *PrivateEndpointConnectionsClientCreateOrUpdatePoller) 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() -} diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_privateendpointconnectionproxies_client.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_privateendpointconnectionproxies_client.go index 29de9a7321d9..0b8802f971a8 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_privateendpointconnectionproxies_client.go +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_privateendpointconnectionproxies_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 PrivateEndpointConnectionProxiesClient struct { // subscriptionID - The Azure subscription ID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewPrivateEndpointConnectionProxiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionProxiesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPrivateEndpointConnectionProxiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionProxiesClient, 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 := &PrivateEndpointConnectionProxiesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - (INTERNAL - DO NOT USE) Creates or updates the specified private endpoint connection proxy resource @@ -58,22 +63,18 @@ func NewPrivateEndpointConnectionProxiesClient(subscriptionID string, credential // privateEndpointConnectionProxy - The parameters for creating a private endpoint connection proxy. // options - PrivateEndpointConnectionProxiesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.BeginCreateOrUpdate // method. -func (client *PrivateEndpointConnectionProxiesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionProxyID string, privateEndpointConnectionProxy PrivateEndpointConnectionProxy, options *PrivateEndpointConnectionProxiesClientBeginCreateOrUpdateOptions) (PrivateEndpointConnectionProxiesClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, privateEndpointConnectionProxyID, privateEndpointConnectionProxy, options) - if err != nil { - return PrivateEndpointConnectionProxiesClientCreateOrUpdatePollerResponse{}, err - } - result := PrivateEndpointConnectionProxiesClientCreateOrUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("PrivateEndpointConnectionProxiesClient.CreateOrUpdate", "azure-async-operation", resp, client.pl) - if err != nil { - return PrivateEndpointConnectionProxiesClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller{ - pt: pt, +func (client *PrivateEndpointConnectionProxiesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionProxyID string, privateEndpointConnectionProxy PrivateEndpointConnectionProxy, options *PrivateEndpointConnectionProxiesClientBeginCreateOrUpdateOptions) (*armruntime.Poller[PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, privateEndpointConnectionProxyID, privateEndpointConnectionProxy, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // CreateOrUpdate - (INTERNAL - DO NOT USE) Creates or updates the specified private endpoint connection proxy resource associated @@ -118,7 +119,7 @@ func (client *PrivateEndpointConnectionProxiesClient) createOrUpdateCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, privateEndpointConnectionProxy) @@ -132,22 +133,18 @@ func (client *PrivateEndpointConnectionProxiesClient) createOrUpdateCreateReques // privateEndpointConnectionProxyID - The ID of the private endpoint connection proxy object. // options - PrivateEndpointConnectionProxiesClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.BeginDelete // method. -func (client *PrivateEndpointConnectionProxiesClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionProxyID string, options *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (PrivateEndpointConnectionProxiesClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, privateEndpointConnectionProxyID, options) - if err != nil { - return PrivateEndpointConnectionProxiesClientDeletePollerResponse{}, err - } - result := PrivateEndpointConnectionProxiesClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("PrivateEndpointConnectionProxiesClient.Delete", "location", resp, client.pl) - if err != nil { - return PrivateEndpointConnectionProxiesClientDeletePollerResponse{}, err - } - result.Poller = &PrivateEndpointConnectionProxiesClientDeletePoller{ - pt: pt, +func (client *PrivateEndpointConnectionProxiesClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionProxyID string, options *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*armruntime.Poller[PrivateEndpointConnectionProxiesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, privateEndpointConnectionProxyID, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[PrivateEndpointConnectionProxiesClientDeleteResponse]{ + FinalStateVia: armruntime.FinalStateViaLocation, + }) + } else { + return armruntime.NewPollerFromResumeToken[PrivateEndpointConnectionProxiesClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - (INTERNAL - DO NOT USE) Deletes the specified private endpoint connection proxy associated with the device update @@ -192,7 +189,7 @@ func (client *PrivateEndpointConnectionProxiesClient) deleteCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -244,7 +241,7 @@ func (client *PrivateEndpointConnectionProxiesClient) getCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -252,7 +249,7 @@ func (client *PrivateEndpointConnectionProxiesClient) getCreateRequest(ctx conte // getHandleResponse handles the Get response. func (client *PrivateEndpointConnectionProxiesClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientGetResponse, error) { - result := PrivateEndpointConnectionProxiesClientGetResponse{RawResponse: resp} + result := PrivateEndpointConnectionProxiesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxy); err != nil { return PrivateEndpointConnectionProxiesClientGetResponse{}, err } @@ -265,19 +262,26 @@ func (client *PrivateEndpointConnectionProxiesClient) getHandleResponse(resp *ht // accountName - Account name. // options - PrivateEndpointConnectionProxiesClientListByAccountOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.ListByAccount // method. -func (client *PrivateEndpointConnectionProxiesClient) ListByAccount(ctx context.Context, resourceGroupName string, accountName string, options *PrivateEndpointConnectionProxiesClientListByAccountOptions) (PrivateEndpointConnectionProxiesClientListByAccountResponse, error) { - req, err := client.listByAccountCreateRequest(ctx, resourceGroupName, accountName, options) - if err != nil { - return PrivateEndpointConnectionProxiesClientListByAccountResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PrivateEndpointConnectionProxiesClientListByAccountResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionProxiesClientListByAccountResponse{}, runtime.NewResponseError(resp) - } - return client.listByAccountHandleResponse(resp) +func (client *PrivateEndpointConnectionProxiesClient) ListByAccount(resourceGroupName string, accountName string, options *PrivateEndpointConnectionProxiesClientListByAccountOptions) *runtime.Pager[PrivateEndpointConnectionProxiesClientListByAccountResponse] { + return runtime.NewPager(runtime.PageProcessor[PrivateEndpointConnectionProxiesClientListByAccountResponse]{ + More: func(page PrivateEndpointConnectionProxiesClientListByAccountResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionProxiesClientListByAccountResponse) (PrivateEndpointConnectionProxiesClientListByAccountResponse, error) { + req, err := client.listByAccountCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return PrivateEndpointConnectionProxiesClientListByAccountResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionProxiesClientListByAccountResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionProxiesClientListByAccountResponse{}, runtime.NewResponseError(resp) + } + return client.listByAccountHandleResponse(resp) + }, + }) } // listByAccountCreateRequest creates the ListByAccount request. @@ -300,7 +304,7 @@ func (client *PrivateEndpointConnectionProxiesClient) listByAccountCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,13 +312,67 @@ func (client *PrivateEndpointConnectionProxiesClient) listByAccountCreateRequest // listByAccountHandleResponse handles the ListByAccount response. func (client *PrivateEndpointConnectionProxiesClient) listByAccountHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientListByAccountResponse, error) { - result := PrivateEndpointConnectionProxiesClientListByAccountResponse{RawResponse: resp} + result := PrivateEndpointConnectionProxiesClientListByAccountResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxyListResult); err != nil { return PrivateEndpointConnectionProxiesClientListByAccountResponse{}, err } return result, nil } +// UpdatePrivateEndpointProperties - (INTERNAL - DO NOT USE) Updates a private endpoint inside the private endpoint connection +// proxy object. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The resource group name. +// accountName - Account name. +// privateEndpointConnectionProxyID - The ID of the private endpoint connection proxy object. +// privateEndpointUpdate - The parameters for updating a private endpoint connection proxy. +// options - PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesOptions contains the optional parameters +// for the PrivateEndpointConnectionProxiesClient.UpdatePrivateEndpointProperties method. +func (client *PrivateEndpointConnectionProxiesClient) UpdatePrivateEndpointProperties(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionProxyID string, privateEndpointUpdate PrivateEndpointUpdate, options *PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesOptions) (PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesResponse, error) { + req, err := client.updatePrivateEndpointPropertiesCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionProxyID, privateEndpointUpdate, options) + if err != nil { + return PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesResponse{}, runtime.NewResponseError(resp) + } + return PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesResponse{}, nil +} + +// updatePrivateEndpointPropertiesCreateRequest creates the UpdatePrivateEndpointProperties request. +func (client *PrivateEndpointConnectionProxiesClient) updatePrivateEndpointPropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionProxyID string, privateEndpointUpdate PrivateEndpointUpdate, options *PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyId}/updatePrivateEndpointProperties" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if privateEndpointConnectionProxyID == "" { + return nil, errors.New("parameter privateEndpointConnectionProxyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionProxyId}", url.PathEscape(privateEndpointConnectionProxyID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, privateEndpointUpdate) +} + // Validate - (INTERNAL - DO NOT USE) Validates a private endpoint connection proxy object. // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The resource group name. @@ -335,7 +393,7 @@ func (client *PrivateEndpointConnectionProxiesClient) Validate(ctx context.Conte if !runtime.HasStatusCode(resp, http.StatusOK) { return PrivateEndpointConnectionProxiesClientValidateResponse{}, runtime.NewResponseError(resp) } - return PrivateEndpointConnectionProxiesClientValidateResponse{RawResponse: resp}, nil + return PrivateEndpointConnectionProxiesClientValidateResponse{}, nil } // validateCreateRequest creates the Validate request. @@ -362,7 +420,7 @@ func (client *PrivateEndpointConnectionProxiesClient) validateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, privateEndpointConnectionProxy) diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_privateendpointconnections_client.go index 727f5d75d93d..d8cc55ad81df 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/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" @@ -33,20 +34,24 @@ type PrivateEndpointConnectionsClient struct { // subscriptionID - The Azure subscription ID. // 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 { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, 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 := &PrivateEndpointConnectionsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreateOrUpdate - Update the state of specified private endpoint connection associated with the device update account. @@ -57,22 +62,18 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // privateEndpointConnection - The parameters for creating a private endpoint connection. // options - PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate // method. -func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, privateEndpointConnectionName, privateEndpointConnection, options) - if err != nil { - return PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse{}, err - } - result := PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("PrivateEndpointConnectionsClient.CreateOrUpdate", "azure-async-operation", resp, client.pl) - if err != nil { - return PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &PrivateEndpointConnectionsClientCreateOrUpdatePoller{ - pt: pt, +func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*armruntime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, privateEndpointConnectionName, privateEndpointConnection, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[PrivateEndpointConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // CreateOrUpdate - Update the state of specified private endpoint connection associated with the device update account. @@ -116,7 +117,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, privateEndpointConnection) @@ -129,22 +130,18 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource // options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. -func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (PrivateEndpointConnectionsClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options) - if err != nil { - return PrivateEndpointConnectionsClientDeletePollerResponse{}, err - } - result := PrivateEndpointConnectionsClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("PrivateEndpointConnectionsClient.Delete", "location", resp, client.pl) - if err != nil { - return PrivateEndpointConnectionsClientDeletePollerResponse{}, err - } - result.Poller = &PrivateEndpointConnectionsClientDeletePoller{ - pt: pt, +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*armruntime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + FinalStateVia: armruntime.FinalStateViaLocation, + }) + } else { + return armruntime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Delete - Deletes the specified private endpoint connection associated with the device update account. @@ -188,7 +185,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -240,7 +237,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -248,7 +245,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 } @@ -261,19 +258,26 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // accountName - Account name. // options - PrivateEndpointConnectionsClientListByAccountOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByAccount // method. -func (client *PrivateEndpointConnectionsClient) ListByAccount(ctx context.Context, resourceGroupName string, accountName string, options *PrivateEndpointConnectionsClientListByAccountOptions) (PrivateEndpointConnectionsClientListByAccountResponse, error) { - req, err := client.listByAccountCreateRequest(ctx, resourceGroupName, accountName, options) - if err != nil { - return PrivateEndpointConnectionsClientListByAccountResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PrivateEndpointConnectionsClientListByAccountResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientListByAccountResponse{}, runtime.NewResponseError(resp) - } - return client.listByAccountHandleResponse(resp) +func (client *PrivateEndpointConnectionsClient) ListByAccount(resourceGroupName string, accountName string, options *PrivateEndpointConnectionsClientListByAccountOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByAccountResponse] { + return runtime.NewPager(runtime.PageProcessor[PrivateEndpointConnectionsClientListByAccountResponse]{ + More: func(page PrivateEndpointConnectionsClientListByAccountResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListByAccountResponse) (PrivateEndpointConnectionsClientListByAccountResponse, error) { + req, err := client.listByAccountCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return PrivateEndpointConnectionsClientListByAccountResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsClientListByAccountResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsClientListByAccountResponse{}, runtime.NewResponseError(resp) + } + return client.listByAccountHandleResponse(resp) + }, + }) } // listByAccountCreateRequest creates the ListByAccount request. @@ -296,7 +300,7 @@ func (client *PrivateEndpointConnectionsClient) listByAccountCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -304,7 +308,7 @@ func (client *PrivateEndpointConnectionsClient) listByAccountCreateRequest(ctx c // listByAccountHandleResponse handles the ListByAccount response. func (client *PrivateEndpointConnectionsClient) listByAccountHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListByAccountResponse, error) { - result := PrivateEndpointConnectionsClientListByAccountResponse{RawResponse: resp} + result := PrivateEndpointConnectionsClientListByAccountResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { return PrivateEndpointConnectionsClientListByAccountResponse{}, err } diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_privatelinkresources_client.go index e1e1770429f6..9542d9361235 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/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 Azure subscription ID. // 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 { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, 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 := &PrivateLinkResourcesClient{ 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 - Get the specified private link resource associated with the device update account. @@ -95,7 +100,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -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.GroupInformation); err != nil { return PrivateLinkResourcesClientGetResponse{}, err } @@ -116,19 +121,26 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // accountName - Account name. // options - PrivateLinkResourcesClientListByAccountOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByAccount // method. -func (client *PrivateLinkResourcesClient) ListByAccount(ctx context.Context, resourceGroupName string, accountName string, options *PrivateLinkResourcesClientListByAccountOptions) (PrivateLinkResourcesClientListByAccountResponse, error) { - req, err := client.listByAccountCreateRequest(ctx, resourceGroupName, accountName, options) - if err != nil { - return PrivateLinkResourcesClientListByAccountResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PrivateLinkResourcesClientListByAccountResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientListByAccountResponse{}, runtime.NewResponseError(resp) - } - return client.listByAccountHandleResponse(resp) +func (client *PrivateLinkResourcesClient) ListByAccount(resourceGroupName string, accountName string, options *PrivateLinkResourcesClientListByAccountOptions) *runtime.Pager[PrivateLinkResourcesClientListByAccountResponse] { + return runtime.NewPager(runtime.PageProcessor[PrivateLinkResourcesClientListByAccountResponse]{ + More: func(page PrivateLinkResourcesClientListByAccountResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *PrivateLinkResourcesClientListByAccountResponse) (PrivateLinkResourcesClientListByAccountResponse, error) { + req, err := client.listByAccountCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return PrivateLinkResourcesClientListByAccountResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesClientListByAccountResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesClientListByAccountResponse{}, runtime.NewResponseError(resp) + } + return client.listByAccountHandleResponse(resp) + }, + }) } // listByAccountCreateRequest creates the ListByAccount request. @@ -151,7 +163,7 @@ func (client *PrivateLinkResourcesClient) listByAccountCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-03-01-preview") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -159,7 +171,7 @@ func (client *PrivateLinkResourcesClient) listByAccountCreateRequest(ctx context // listByAccountHandleResponse handles the ListByAccount response. func (client *PrivateLinkResourcesClient) listByAccountHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListByAccountResponse, error) { - result := PrivateLinkResourcesClientListByAccountResponse{RawResponse: resp} + result := PrivateLinkResourcesClientListByAccountResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { return PrivateLinkResourcesClientListByAccountResponse{}, err } diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_response_types.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_response_types.go index 14240feaaf82..974baf3b4416 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_response_types.go +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/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,654 +8,139 @@ package armdeviceupdate -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - -// AccountsClientCreatePollerResponse contains the response from method AccountsClient.Create. -type AccountsClientCreatePollerResponse struct { - // Poller contains an initialized poller. - Poller *AccountsClientCreatePoller - - // 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 AccountsClientCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsClientCreateResponse, error) { - respType := AccountsClientCreateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Account) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a AccountsClientCreatePollerResponse from the provided client and resume token. -func (l *AccountsClientCreatePollerResponse) Resume(ctx context.Context, client *AccountsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("AccountsClient.Create", token, client.pl) - if err != nil { - return err - } - poller := &AccountsClientCreatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // AccountsClientCreateResponse contains the response from method AccountsClient.Create. type AccountsClientCreateResponse struct { - AccountsClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientCreateResult contains the result from method AccountsClient.Create. -type AccountsClientCreateResult struct { Account } -// AccountsClientDeletePollerResponse contains the response from method AccountsClient.Delete. -type AccountsClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *AccountsClientDeletePoller - - // 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 AccountsClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsClientDeleteResponse, error) { - respType := AccountsClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a AccountsClientDeletePollerResponse from the provided client and resume token. -func (l *AccountsClientDeletePollerResponse) Resume(ctx context.Context, client *AccountsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("AccountsClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &AccountsClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // 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 { Account } // AccountsClientHeadResponse contains the response from method AccountsClient.Head. type AccountsClientHeadResponse struct { - AccountsClientHeadResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientHeadResult contains the result from method AccountsClient.Head. -type AccountsClientHeadResult struct { // Success indicates if the operation succeeded or failed. Success bool } // 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 { AccountList } // AccountsClientListBySubscriptionResponse contains the response from method AccountsClient.ListBySubscription. type AccountsClientListBySubscriptionResponse struct { - AccountsClientListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// AccountsClientListBySubscriptionResult contains the result from method AccountsClient.ListBySubscription. -type AccountsClientListBySubscriptionResult struct { AccountList } -// AccountsClientUpdatePollerResponse contains the response from method AccountsClient.Update. -type AccountsClientUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *AccountsClientUpdatePoller - - // 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 AccountsClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsClientUpdateResponse, error) { - respType := AccountsClientUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Account) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a AccountsClientUpdatePollerResponse from the provided client and resume token. -func (l *AccountsClientUpdatePollerResponse) Resume(ctx context.Context, client *AccountsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("AccountsClient.Update", token, client.pl) - if err != nil { - return err - } - poller := &AccountsClientUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // 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 { Account } // 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 { CheckNameAvailabilityResponse } -// InstancesClientCreatePollerResponse contains the response from method InstancesClient.Create. -type InstancesClientCreatePollerResponse struct { - // Poller contains an initialized poller. - Poller *InstancesClientCreatePoller - - // 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 InstancesClientCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InstancesClientCreateResponse, error) { - respType := InstancesClientCreateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Instance) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a InstancesClientCreatePollerResponse from the provided client and resume token. -func (l *InstancesClientCreatePollerResponse) Resume(ctx context.Context, client *InstancesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("InstancesClient.Create", token, client.pl) - if err != nil { - return err - } - poller := &InstancesClientCreatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // InstancesClientCreateResponse contains the response from method InstancesClient.Create. type InstancesClientCreateResponse struct { - InstancesClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// InstancesClientCreateResult contains the result from method InstancesClient.Create. -type InstancesClientCreateResult struct { Instance } -// InstancesClientDeletePollerResponse contains the response from method InstancesClient.Delete. -type InstancesClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *InstancesClientDeletePoller - - // 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 InstancesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InstancesClientDeleteResponse, error) { - respType := InstancesClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a InstancesClientDeletePollerResponse from the provided client and resume token. -func (l *InstancesClientDeletePollerResponse) Resume(ctx context.Context, client *InstancesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("InstancesClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &InstancesClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // InstancesClientDeleteResponse contains the response from method InstancesClient.Delete. type InstancesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // InstancesClientGetResponse contains the response from method InstancesClient.Get. type InstancesClientGetResponse struct { - InstancesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// InstancesClientGetResult contains the result from method InstancesClient.Get. -type InstancesClientGetResult struct { Instance } // InstancesClientHeadResponse contains the response from method InstancesClient.Head. type InstancesClientHeadResponse struct { - InstancesClientHeadResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// InstancesClientHeadResult contains the result from method InstancesClient.Head. -type InstancesClientHeadResult struct { // Success indicates if the operation succeeded or failed. Success bool } // InstancesClientListByAccountResponse contains the response from method InstancesClient.ListByAccount. type InstancesClientListByAccountResponse struct { - InstancesClientListByAccountResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// InstancesClientListByAccountResult contains the result from method InstancesClient.ListByAccount. -type InstancesClientListByAccountResult struct { InstanceList } // InstancesClientUpdateResponse contains the response from method InstancesClient.Update. type InstancesClientUpdateResponse struct { - InstancesClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// InstancesClientUpdateResult contains the result from method InstancesClient.Update. -type InstancesClientUpdateResult struct { Instance } // 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 } -// PrivateEndpointConnectionProxiesClientCreateOrUpdatePollerResponse contains the response from method PrivateEndpointConnectionProxiesClient.CreateOrUpdate. -type PrivateEndpointConnectionProxiesClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller - - // 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 PrivateEndpointConnectionProxiesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse, error) { - respType := PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnectionProxy) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PrivateEndpointConnectionProxiesClientCreateOrUpdatePollerResponse from the provided client and resume -// token. -func (l *PrivateEndpointConnectionProxiesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionProxiesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionProxiesClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &PrivateEndpointConnectionProxiesClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionProxiesClient.CreateOrUpdate. type PrivateEndpointConnectionProxiesClientCreateOrUpdateResponse struct { - PrivateEndpointConnectionProxiesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionProxiesClientCreateOrUpdateResult contains the result from method PrivateEndpointConnectionProxiesClient.CreateOrUpdate. -type PrivateEndpointConnectionProxiesClientCreateOrUpdateResult struct { PrivateEndpointConnectionProxy } -// PrivateEndpointConnectionProxiesClientDeletePollerResponse contains the response from method PrivateEndpointConnectionProxiesClient.Delete. -type PrivateEndpointConnectionProxiesClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *PrivateEndpointConnectionProxiesClientDeletePoller - - // 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 PrivateEndpointConnectionProxiesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionProxiesClientDeleteResponse, error) { - respType := PrivateEndpointConnectionProxiesClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PrivateEndpointConnectionProxiesClientDeletePollerResponse from the provided client and resume token. -func (l *PrivateEndpointConnectionProxiesClientDeletePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionProxiesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionProxiesClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &PrivateEndpointConnectionProxiesClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // PrivateEndpointConnectionProxiesClientDeleteResponse contains the response from method PrivateEndpointConnectionProxiesClient.Delete. type PrivateEndpointConnectionProxiesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // PrivateEndpointConnectionProxiesClientGetResponse contains the response from method PrivateEndpointConnectionProxiesClient.Get. type PrivateEndpointConnectionProxiesClientGetResponse struct { - PrivateEndpointConnectionProxiesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionProxiesClientGetResult contains the result from method PrivateEndpointConnectionProxiesClient.Get. -type PrivateEndpointConnectionProxiesClientGetResult struct { PrivateEndpointConnectionProxy } // PrivateEndpointConnectionProxiesClientListByAccountResponse contains the response from method PrivateEndpointConnectionProxiesClient.ListByAccount. type PrivateEndpointConnectionProxiesClientListByAccountResponse struct { - PrivateEndpointConnectionProxiesClientListByAccountResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + PrivateEndpointConnectionProxyListResult } -// PrivateEndpointConnectionProxiesClientListByAccountResult contains the result from method PrivateEndpointConnectionProxiesClient.ListByAccount. -type PrivateEndpointConnectionProxiesClientListByAccountResult struct { - PrivateEndpointConnectionProxyListResult +// PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesResponse contains the response from method PrivateEndpointConnectionProxiesClient.UpdatePrivateEndpointProperties. +type PrivateEndpointConnectionProxiesClientUpdatePrivateEndpointPropertiesResponse struct { + // placeholder for future response values } // PrivateEndpointConnectionProxiesClientValidateResponse contains the response from method PrivateEndpointConnectionProxiesClient.Validate. type PrivateEndpointConnectionProxiesClientValidateResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse contains the response from method PrivateEndpointConnectionsClient.CreateOrUpdate. -type PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *PrivateEndpointConnectionsClientCreateOrUpdatePoller - - // 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 PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error) { - respType := PrivateEndpointConnectionsClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &PrivateEndpointConnectionsClientCreateOrUpdatePoller{ - 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 } // 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 } -// 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 } // PrivateEndpointConnectionsClientListByAccountResponse contains the response from method PrivateEndpointConnectionsClient.ListByAccount. type PrivateEndpointConnectionsClientListByAccountResponse struct { - PrivateEndpointConnectionsClientListByAccountResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateEndpointConnectionsClientListByAccountResult contains the result from method PrivateEndpointConnectionsClient.ListByAccount. -type PrivateEndpointConnectionsClientListByAccountResult struct { PrivateEndpointConnectionListResult } // 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 { GroupInformation } // PrivateLinkResourcesClientListByAccountResponse contains the response from method PrivateLinkResourcesClient.ListByAccount. type PrivateLinkResourcesClientListByAccountResponse struct { - PrivateLinkResourcesClientListByAccountResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PrivateLinkResourcesClientListByAccountResult contains the result from method PrivateLinkResourcesClient.ListByAccount. -type PrivateLinkResourcesClientListByAccountResult struct { PrivateLinkResourceListResult } diff --git a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_time_rfc3339.go b/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_time_rfc3339.go index dceef810c0f7..d8e3c23eb8f7 100644 --- a/sdk/resourcemanager/deviceupdate/armdeviceupdate/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/deviceupdate/armdeviceupdate/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.