diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/CHANGELOG.md b/sdk/resourcemanager/powerplatform/armpowerplatform/CHANGELOG.md index 1d7b8e8d84b5..9161cf0dd5cc 100644 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/CHANGELOG.md +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/CHANGELOG.md @@ -1,5 +1,27 @@ # Release History +## 0.2.0 (2023-03-21) +### Breaking Changes + +- Operation `*PrivateEndpointConnectionsClient.BeginCreateOrUpdate` has been changed to non-LRO, use `*PrivateEndpointConnectionsClient.CreateOrUpdate` instead. +- Operation `*PrivateEndpointConnectionsClient.BeginDelete` has been changed to non-LRO, use `*PrivateEndpointConnectionsClient.Delete` instead. + +### Features Added + +- New value `EnterprisePolicyKindIdentity` added to enum type `EnterprisePolicyKind` +- New enum type `HealthStatus` with values `HealthStatusHealthy`, `HealthStatusUndetermined`, `HealthStatusUnhealthy` +- New function `NewClientFactory(string, azcore.TokenCredential, *arm.ClientOptions) (*ClientFactory, error)` +- New function `*ClientFactory.NewAccountsClient() *AccountsClient` +- New function `*ClientFactory.NewEnterprisePoliciesClient() *EnterprisePoliciesClient` +- New function `*ClientFactory.NewOperationsClient() *OperationsClient` +- New function `*ClientFactory.NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient` +- New function `*ClientFactory.NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient` +- New struct `ClientFactory` +- New field `SystemID` in struct `AccountProperties` +- New field `HealthStatus` in struct `Properties` +- New field `SystemID` in struct `Properties` + + ## 0.1.0 (2022-06-10) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerplatform/armpowerplatform` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.1.0, which contains breaking changes. diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_accounts_client.go b/sdk/resourcemanager/powerplatform/armpowerplatform/accounts_client.go similarity index 85% rename from sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_accounts_client.go rename to sdk/resourcemanager/powerplatform/armpowerplatform/accounts_client.go index d4579061fb31..79690d260a6a 100644 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_accounts_client.go +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/accounts_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armpowerplatform @@ -13,8 +14,6 @@ import ( "errors" "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" @@ -25,48 +24,40 @@ import ( // AccountsClient contains the methods for the Accounts group. // Don't use this type directly, use NewAccountsClient() instead. type AccountsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewAccountsClient creates a new instance of AccountsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.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) + cl, err := arm.NewClient(moduleName+".AccountsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &AccountsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // CreateOrUpdate - Creates an account. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// accountName - Name of the account. -// resourceGroupName - The name of the resource group. The name is case insensitive. -// parameters - Parameters supplied to create or update an account. -// options - AccountsClientCreateOrUpdateOptions contains the optional parameters for the AccountsClient.CreateOrUpdate method. +// - accountName - Name of the account. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parameters - Parameters supplied to create or update an account. +// - options - AccountsClientCreateOrUpdateOptions contains the optional parameters for the AccountsClient.CreateOrUpdate method. func (client *AccountsClient) CreateOrUpdate(ctx context.Context, accountName string, resourceGroupName string, parameters Account, options *AccountsClientCreateOrUpdateOptions) (AccountsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, accountName, resourceGroupName, parameters, options) if err != nil { return AccountsClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientCreateOrUpdateResponse{}, err } @@ -91,7 +82,7 @@ func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, a return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -113,16 +104,17 @@ func (client *AccountsClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Delete an account. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// accountName - Name of the account. -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - AccountsClientDeleteOptions contains the optional parameters for the AccountsClient.Delete method. +// - accountName - Name of the account. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AccountsClientDeleteOptions contains the optional parameters for the AccountsClient.Delete method. func (client *AccountsClient) Delete(ctx context.Context, accountName string, resourceGroupName string, options *AccountsClientDeleteOptions) (AccountsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, accountName, resourceGroupName, options) if err != nil { return AccountsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientDeleteResponse{}, err } @@ -147,7 +139,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, accountNa return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -160,16 +152,17 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, accountNa // Get - Get information about an account. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// accountName - Name of the account. -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. +// - accountName - Name of the account. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. func (client *AccountsClient) Get(ctx context.Context, accountName string, resourceGroupName string, options *AccountsClientGetOptions) (AccountsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, accountName, resourceGroupName, options) if err != nil { return AccountsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientGetResponse{}, err } @@ -194,7 +187,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, accountName return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -215,11 +208,11 @@ func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsCl } // NewListByResourceGroupPager - Retrieve a list of accounts within a given resource group. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.ListByResourceGroup -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager +// method. func (client *AccountsClient) NewListByResourceGroupPager(resourceGroupName string, options *AccountsClientListByResourceGroupOptions) *runtime.Pager[AccountsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[AccountsClientListByResourceGroupResponse]{ More: func(page AccountsClientListByResourceGroupResponse) bool { @@ -236,7 +229,7 @@ func (client *AccountsClient) NewListByResourceGroupPager(resourceGroupName stri if err != nil { return AccountsClientListByResourceGroupResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientListByResourceGroupResponse{}, err } @@ -259,7 +252,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -280,10 +273,10 @@ func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Respo } // NewListBySubscriptionPager - Retrieve a list of accounts within a subscription. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// options - AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.ListBySubscription -// method. +// - options - AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.NewListBySubscriptionPager +// method. func (client *AccountsClient) NewListBySubscriptionPager(options *AccountsClientListBySubscriptionOptions) *runtime.Pager[AccountsClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[AccountsClientListBySubscriptionResponse]{ More: func(page AccountsClientListBySubscriptionResponse) bool { @@ -300,7 +293,7 @@ func (client *AccountsClient) NewListBySubscriptionPager(options *AccountsClient if err != nil { return AccountsClientListBySubscriptionResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientListBySubscriptionResponse{}, err } @@ -319,7 +312,7 @@ func (client *AccountsClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -341,17 +334,18 @@ func (client *AccountsClient) listBySubscriptionHandleResponse(resp *http.Respon // Update - Updates an account. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// accountName - Name of the account. -// resourceGroupName - The name of the resource group. The name is case insensitive. -// parameters - Parameters supplied to update an account. -// options - AccountsClientUpdateOptions contains the optional parameters for the AccountsClient.Update method. +// - accountName - Name of the account. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parameters - Parameters supplied to update an account. +// - options - AccountsClientUpdateOptions contains the optional parameters for the AccountsClient.Update method. func (client *AccountsClient) Update(ctx context.Context, accountName string, resourceGroupName string, parameters PatchAccount, options *AccountsClientUpdateOptions) (AccountsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, accountName, resourceGroupName, parameters, options) if err != nil { return AccountsClientUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientUpdateResponse{}, err } @@ -376,7 +370,7 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, accountNa return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/autorest.md b/sdk/resourcemanager/powerplatform/armpowerplatform/autorest.md index 8e1c69f84165..75f423e1707f 100644 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/autorest.md +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/powerplatform/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/powerplatform/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/powerplatform/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/powerplatform/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/client_factory.go b/sdk/resourcemanager/powerplatform/armpowerplatform/client_factory.go new file mode 100644 index 000000000000..d3afb931c4a5 --- /dev/null +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/client_factory.go @@ -0,0 +1,64 @@ +//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. +// DO NOT EDIT. + +package armpowerplatform + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewAccountsClient() *AccountsClient { + subClient, _ := NewAccountsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewEnterprisePoliciesClient() *EnterprisePoliciesClient { + subClient, _ := NewEnterprisePoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_constants.go b/sdk/resourcemanager/powerplatform/armpowerplatform/constants.go similarity index 89% rename from sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_constants.go rename to sdk/resourcemanager/powerplatform/armpowerplatform/constants.go index e14551fc7349..150bb9547e8f 100644 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_constants.go +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/constants.go @@ -5,12 +5,13 @@ // 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. +// DO NOT EDIT. package armpowerplatform const ( moduleName = "armpowerplatform" - moduleVersion = "v0.1.0" + moduleVersion = "v0.2.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -52,6 +53,7 @@ type EnterprisePolicyKind string const ( EnterprisePolicyKindEncryption EnterprisePolicyKind = "Encryption" + EnterprisePolicyKindIdentity EnterprisePolicyKind = "Identity" EnterprisePolicyKindLockbox EnterprisePolicyKind = "Lockbox" EnterprisePolicyKindNetworkInjection EnterprisePolicyKind = "NetworkInjection" EnterprisePolicyKindPrivateEndpoint EnterprisePolicyKind = "PrivateEndpoint" @@ -61,12 +63,31 @@ const ( func PossibleEnterprisePolicyKindValues() []EnterprisePolicyKind { return []EnterprisePolicyKind{ EnterprisePolicyKindEncryption, + EnterprisePolicyKindIdentity, EnterprisePolicyKindLockbox, EnterprisePolicyKindNetworkInjection, EnterprisePolicyKindPrivateEndpoint, } } +// HealthStatus - The health status of the resource. +type HealthStatus string + +const ( + HealthStatusHealthy HealthStatus = "Healthy" + HealthStatusUndetermined HealthStatus = "Undetermined" + HealthStatusUnhealthy HealthStatus = "Unhealthy" +) + +// PossibleHealthStatusValues returns the possible values for the HealthStatus const type. +func PossibleHealthStatusValues() []HealthStatus { + return []HealthStatus{ + HealthStatusHealthy, + HealthStatusUndetermined, + HealthStatusUnhealthy, + } +} + // 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 diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_enterprisepolicies_client.go b/sdk/resourcemanager/powerplatform/armpowerplatform/enterprisepolicies_client.go similarity index 85% rename from sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_enterprisepolicies_client.go rename to sdk/resourcemanager/powerplatform/armpowerplatform/enterprisepolicies_client.go index e87de4d95cb0..5e4b29e7ac08 100644 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_enterprisepolicies_client.go +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/enterprisepolicies_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armpowerplatform @@ -13,8 +14,6 @@ import ( "errors" "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" @@ -25,49 +24,41 @@ import ( // EnterprisePoliciesClient contains the methods for the EnterprisePolicies group. // Don't use this type directly, use NewEnterprisePoliciesClient() instead. type EnterprisePoliciesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewEnterprisePoliciesClient creates a new instance of EnterprisePoliciesClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewEnterprisePoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EnterprisePoliciesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.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) + cl, err := arm.NewClient(moduleName+".EnterprisePoliciesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &EnterprisePoliciesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // CreateOrUpdate - Creates an EnterprisePolicy // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// enterprisePolicyName - Name of the EnterprisePolicy. -// resourceGroupName - The name of the resource group. The name is case insensitive. -// parameters - Parameters supplied to create or update EnterprisePolicy. -// options - EnterprisePoliciesClientCreateOrUpdateOptions contains the optional parameters for the EnterprisePoliciesClient.CreateOrUpdate -// method. +// - enterprisePolicyName - Name of the EnterprisePolicy. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parameters - Parameters supplied to create or update EnterprisePolicy. +// - options - EnterprisePoliciesClientCreateOrUpdateOptions contains the optional parameters for the EnterprisePoliciesClient.CreateOrUpdate +// method. func (client *EnterprisePoliciesClient) CreateOrUpdate(ctx context.Context, enterprisePolicyName string, resourceGroupName string, parameters EnterprisePolicy, options *EnterprisePoliciesClientCreateOrUpdateOptions) (EnterprisePoliciesClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, enterprisePolicyName, resourceGroupName, parameters, options) if err != nil { return EnterprisePoliciesClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return EnterprisePoliciesClientCreateOrUpdateResponse{}, err } @@ -92,7 +83,7 @@ func (client *EnterprisePoliciesClient) createOrUpdateCreateRequest(ctx context. return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -114,17 +105,18 @@ func (client *EnterprisePoliciesClient) createOrUpdateHandleResponse(resp *http. // Delete - Delete an EnterprisePolicy // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// enterprisePolicyName - Name of the EnterprisePolicy -// options - EnterprisePoliciesClientDeleteOptions contains the optional parameters for the EnterprisePoliciesClient.Delete -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - enterprisePolicyName - Name of the EnterprisePolicy +// - options - EnterprisePoliciesClientDeleteOptions contains the optional parameters for the EnterprisePoliciesClient.Delete +// method. func (client *EnterprisePoliciesClient) Delete(ctx context.Context, resourceGroupName string, enterprisePolicyName string, options *EnterprisePoliciesClientDeleteOptions) (EnterprisePoliciesClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, enterprisePolicyName, options) if err != nil { return EnterprisePoliciesClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return EnterprisePoliciesClientDeleteResponse{}, err } @@ -149,7 +141,7 @@ func (client *EnterprisePoliciesClient) deleteCreateRequest(ctx context.Context, return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -162,16 +154,17 @@ func (client *EnterprisePoliciesClient) deleteCreateRequest(ctx context.Context, // Get - Get information about an EnterprisePolicy // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// enterprisePolicyName - The EnterprisePolicy name. -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - EnterprisePoliciesClientGetOptions contains the optional parameters for the EnterprisePoliciesClient.Get method. +// - enterprisePolicyName - The EnterprisePolicy name. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - EnterprisePoliciesClientGetOptions contains the optional parameters for the EnterprisePoliciesClient.Get method. func (client *EnterprisePoliciesClient) Get(ctx context.Context, enterprisePolicyName string, resourceGroupName string, options *EnterprisePoliciesClientGetOptions) (EnterprisePoliciesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, enterprisePolicyName, resourceGroupName, options) if err != nil { return EnterprisePoliciesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return EnterprisePoliciesClientGetResponse{}, err } @@ -196,7 +189,7 @@ func (client *EnterprisePoliciesClient) getCreateRequest(ctx context.Context, en return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -217,11 +210,11 @@ func (client *EnterprisePoliciesClient) getHandleResponse(resp *http.Response) ( } // NewListByResourceGroupPager - Retrieve a list of EnterprisePolicies within a given resource group -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - EnterprisePoliciesClientListByResourceGroupOptions contains the optional parameters for the EnterprisePoliciesClient.ListByResourceGroup -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - EnterprisePoliciesClientListByResourceGroupOptions contains the optional parameters for the EnterprisePoliciesClient.NewListByResourceGroupPager +// method. func (client *EnterprisePoliciesClient) NewListByResourceGroupPager(resourceGroupName string, options *EnterprisePoliciesClientListByResourceGroupOptions) *runtime.Pager[EnterprisePoliciesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[EnterprisePoliciesClientListByResourceGroupResponse]{ More: func(page EnterprisePoliciesClientListByResourceGroupResponse) bool { @@ -238,7 +231,7 @@ func (client *EnterprisePoliciesClient) NewListByResourceGroupPager(resourceGrou if err != nil { return EnterprisePoliciesClientListByResourceGroupResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return EnterprisePoliciesClientListByResourceGroupResponse{}, err } @@ -261,7 +254,7 @@ func (client *EnterprisePoliciesClient) listByResourceGroupCreateRequest(ctx con return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -282,10 +275,10 @@ func (client *EnterprisePoliciesClient) listByResourceGroupHandleResponse(resp * } // NewListBySubscriptionPager - Retrieve a list of EnterprisePolicies within a subscription -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// options - EnterprisePoliciesClientListBySubscriptionOptions contains the optional parameters for the EnterprisePoliciesClient.ListBySubscription -// method. +// - options - EnterprisePoliciesClientListBySubscriptionOptions contains the optional parameters for the EnterprisePoliciesClient.NewListBySubscriptionPager +// method. func (client *EnterprisePoliciesClient) NewListBySubscriptionPager(options *EnterprisePoliciesClientListBySubscriptionOptions) *runtime.Pager[EnterprisePoliciesClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[EnterprisePoliciesClientListBySubscriptionResponse]{ More: func(page EnterprisePoliciesClientListBySubscriptionResponse) bool { @@ -302,7 +295,7 @@ func (client *EnterprisePoliciesClient) NewListBySubscriptionPager(options *Ente if err != nil { return EnterprisePoliciesClientListBySubscriptionResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return EnterprisePoliciesClientListBySubscriptionResponse{}, err } @@ -321,7 +314,7 @@ func (client *EnterprisePoliciesClient) listBySubscriptionCreateRequest(ctx cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -343,18 +336,19 @@ func (client *EnterprisePoliciesClient) listBySubscriptionHandleResponse(resp *h // Update - Updates an EnterprisePolicy // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// enterprisePolicyName - Name of the EnterprisePolicy. -// resourceGroupName - The name of the resource group. The name is case insensitive. -// parameters - Parameters supplied to update EnterprisePolicy. -// options - EnterprisePoliciesClientUpdateOptions contains the optional parameters for the EnterprisePoliciesClient.Update -// method. +// - enterprisePolicyName - Name of the EnterprisePolicy. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parameters - Parameters supplied to update EnterprisePolicy. +// - options - EnterprisePoliciesClientUpdateOptions contains the optional parameters for the EnterprisePoliciesClient.Update +// method. func (client *EnterprisePoliciesClient) Update(ctx context.Context, enterprisePolicyName string, resourceGroupName string, parameters PatchEnterprisePolicy, options *EnterprisePoliciesClientUpdateOptions) (EnterprisePoliciesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, enterprisePolicyName, resourceGroupName, parameters, options) if err != nil { return EnterprisePoliciesClientUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return EnterprisePoliciesClientUpdateResponse{}, err } @@ -379,7 +373,7 @@ func (client *EnterprisePoliciesClient) updateCreateRequest(ctx context.Context, return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/go.mod b/sdk/resourcemanager/powerplatform/armpowerplatform/go.mod index ff3d91e49627..fac6c98a6f6e 100644 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/go.mod +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerplatform/armpo go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/text v0.7.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/go.sum b/sdk/resourcemanager/powerplatform/armpowerplatform/go.sum index 8828b17b1853..f54c298864a1 100644 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/go.sum +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/go.sum @@ -1,33 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 h1:+5VZ72z0Qan5Bog5C+ZkgSqUbeVUd9wgtHOrIKuc5b8= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -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/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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/powerplatform/armpowerplatform/zz_generated_models.go b/sdk/resourcemanager/powerplatform/armpowerplatform/models.go similarity index 94% rename from sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_models.go rename to sdk/resourcemanager/powerplatform/armpowerplatform/models.go index 945c57f913ac..b6133851edbf 100644 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_models.go +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/models.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armpowerplatform @@ -47,6 +48,9 @@ type AccountList struct { type AccountProperties struct { // The description of the account. Description *string `json:"description,omitempty"` + + // READ-ONLY; The internally assigned unique identifier of the resource. + SystemID *string `json:"systemId,omitempty" azure:"ro"` } // AccountsClientCreateOrUpdateOptions contains the optional parameters for the AccountsClient.CreateOrUpdate method. @@ -64,12 +68,14 @@ type AccountsClientGetOptions struct { // placeholder for future optional parameters } -// AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.ListByResourceGroup method. +// AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager +// method. type AccountsClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.ListBySubscription method. +// AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.NewListBySubscriptionPager +// method. type AccountsClientListBySubscriptionOptions struct { // placeholder for future optional parameters } @@ -95,13 +101,13 @@ type EnterprisePoliciesClientGetOptions struct { // placeholder for future optional parameters } -// EnterprisePoliciesClientListByResourceGroupOptions contains the optional parameters for the EnterprisePoliciesClient.ListByResourceGroup +// EnterprisePoliciesClientListByResourceGroupOptions contains the optional parameters for the EnterprisePoliciesClient.NewListByResourceGroupPager // method. type EnterprisePoliciesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// EnterprisePoliciesClientListBySubscriptionOptions contains the optional parameters for the EnterprisePoliciesClient.ListBySubscription +// EnterprisePoliciesClientListBySubscriptionOptions contains the optional parameters for the EnterprisePoliciesClient.NewListBySubscriptionPager // method. type EnterprisePoliciesClientListBySubscriptionOptions struct { // placeholder for future optional parameters @@ -167,7 +173,7 @@ type EnterprisePolicyList struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` + Info any `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -265,7 +271,7 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty" azure:"ro"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -385,18 +391,16 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// PrivateEndpointConnectionsClientCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.CreateOrUpdate // method. -type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +type PrivateEndpointConnectionsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters } -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// PrivateEndpointConnectionsClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Delete // method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +type PrivateEndpointConnectionsClientDeleteOptions struct { + // placeholder for future optional parameters } // PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get @@ -405,7 +409,7 @@ type PrivateEndpointConnectionsClientGetOptions struct { // placeholder for future optional parameters } -// PrivateEndpointConnectionsClientListByEnterprisePolicyOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByEnterprisePolicy +// PrivateEndpointConnectionsClientListByEnterprisePolicyOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByEnterprisePolicyPager // method. type PrivateEndpointConnectionsClientListByEnterprisePolicyOptions struct { // placeholder for future optional parameters @@ -449,7 +453,7 @@ type PrivateLinkResourcesClientGetOptions struct { // placeholder for future optional parameters } -// PrivateLinkResourcesClientListByEnterprisePolicyOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByEnterprisePolicy +// PrivateLinkResourcesClientListByEnterprisePolicyOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByEnterprisePolicyPager // method. type PrivateLinkResourcesClientListByEnterprisePolicyOptions struct { // placeholder for future optional parameters @@ -473,11 +477,17 @@ type Properties struct { // The encryption settings for a configuration store. Encryption *PropertiesEncryption `json:"encryption,omitempty"` + // The health status of the resource. + HealthStatus *HealthStatus `json:"healthStatus,omitempty"` + // Settings concerning lockbox. Lockbox *PropertiesLockbox `json:"lockbox,omitempty"` // Settings concerning network injection. NetworkInjection *PropertiesNetworkInjection `json:"networkInjection,omitempty"` + + // READ-ONLY; The internally assigned unique identifier of the resource. + SystemID *string `json:"systemId,omitempty" azure:"ro"` } // PropertiesEncryption - The encryption settings for a configuration store. diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/models_serde.go b/sdk/resourcemanager/powerplatform/armpowerplatform/models_serde.go new file mode 100644 index 000000000000..bd7865b44f35 --- /dev/null +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/models_serde.go @@ -0,0 +1,1349 @@ +//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. +// DO NOT EDIT. + +package armpowerplatform + +import ( + "encoding/json" + "fmt" + "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]any) + populate(objectMap, "id", a.ID) + 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) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Account. +func (a *Account) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccountList. +func (a AccountList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountList. +func (a *AccountList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccountProperties. +func (a AccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", a.Description) + populate(objectMap, "systemId", a.SystemID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountProperties. +func (a *AccountProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "systemId": + err = unpopulate(val, "SystemID", &a.SystemID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterprisePolicy. +func (e EnterprisePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "identity", e.Identity) + populate(objectMap, "kind", e.Kind) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterprisePolicy. +func (e *EnterprisePolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &e.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterprisePolicyIdentity. +func (e EnterprisePolicyIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "systemAssignedIdentityPrincipalId", e.SystemAssignedIdentityPrincipalID) + populate(objectMap, "tenantId", e.TenantID) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterprisePolicyIdentity. +func (e *EnterprisePolicyIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "systemAssignedIdentityPrincipalId": + err = unpopulate(val, "SystemAssignedIdentityPrincipalID", &e.SystemAssignedIdentityPrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &e.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterprisePolicyList. +func (e EnterprisePolicyList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterprisePolicyList. +func (e *EnterprisePolicyList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyProperties. +func (k KeyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", k.Name) + populate(objectMap, "version", k.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyProperties. +func (k *KeyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &k.Name) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &k.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. +func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", k.ID) + populate(objectMap, "key", k.Key) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. +func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &k.ID) + delete(rawMsg, key) + case "key": + err = unpopulate(val, "Key", &k.Key) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchAccount. +func (p PatchAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchAccount. +func (p *PatchAccount) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchEnterprisePolicy. +func (p PatchEnterprisePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "identity", p.Identity) + populate(objectMap, "kind", p.Kind) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchEnterprisePolicy. +func (p *PatchEnterprisePolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &p.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &p.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchTrackedResource. +func (p PatchTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchTrackedResource. +func (p *PatchTrackedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "encryption", p.Encryption) + populate(objectMap, "healthStatus", p.HealthStatus) + populate(objectMap, "lockbox", p.Lockbox) + populate(objectMap, "networkInjection", p.NetworkInjection) + populate(objectMap, "systemId", p.SystemID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. +func (p *Properties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "encryption": + err = unpopulate(val, "Encryption", &p.Encryption) + delete(rawMsg, key) + case "healthStatus": + err = unpopulate(val, "HealthStatus", &p.HealthStatus) + delete(rawMsg, key) + case "lockbox": + err = unpopulate(val, "Lockbox", &p.Lockbox) + delete(rawMsg, key) + case "networkInjection": + err = unpopulate(val, "NetworkInjection", &p.NetworkInjection) + delete(rawMsg, key) + case "systemId": + err = unpopulate(val, "SystemID", &p.SystemID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PropertiesEncryption. +func (p PropertiesEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyVault", p.KeyVault) + populate(objectMap, "state", p.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropertiesEncryption. +func (p *PropertiesEncryption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyVault": + err = unpopulate(val, "KeyVault", &p.KeyVault) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PropertiesLockbox. +func (p PropertiesLockbox) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "state", p.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropertiesLockbox. +func (p *PropertiesLockbox) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PropertiesNetworkInjection. +func (p PropertiesNetworkInjection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "virtualNetworks", p.VirtualNetworks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropertiesNetworkInjection. +func (p *PropertiesNetworkInjection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "virtualNetworks": + err = unpopulate(val, "VirtualNetworks", &p.VirtualNetworks) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubnetProperties. +func (s SubnetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetProperties. +func (s *SubnetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkProperties. +func (v VirtualNetworkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "subnet", v.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkProperties. +func (v *VirtualNetworkProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &v.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesList. +func (v VirtualNetworkPropertiesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesList. +func (v *VirtualNetworkPropertiesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + 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, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_operations_client.go b/sdk/resourcemanager/powerplatform/armpowerplatform/operations_client.go similarity index 77% rename from sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_operations_client.go rename to sdk/resourcemanager/powerplatform/armpowerplatform/operations_client.go index 79049c8178aa..d5d57934ecf8 100644 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_operations_client.go +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/operations_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armpowerplatform @@ -12,8 +13,6 @@ import ( "context" "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" @@ -22,36 +21,27 @@ import ( // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // 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. +// - 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, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.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) + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListPager - Lists all of the available PowerPlatform REST API operations. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { @@ -68,7 +58,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsClientListResponse{}, err } @@ -83,7 +73,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption // listCreateRequest creates the List request. func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.PowerPlatform/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/powerplatform/armpowerplatform/privateendpointconnections_client.go similarity index 68% rename from sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_privateendpointconnections_client.go rename to sdk/resourcemanager/powerplatform/armpowerplatform/privateendpointconnections_client.go index 0210fcb55d86..40b16d859a92 100644 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/privateendpointconnections_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armpowerplatform @@ -13,8 +14,6 @@ import ( "errors" "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" @@ -25,76 +24,53 @@ import ( // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. // Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. type PrivateEndpointConnectionsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.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) + cl, err := arm.NewClient(moduleName+".PrivateEndpointConnectionsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PrivateEndpointConnectionsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } -// BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-30-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// enterprisePolicyName - EnterprisePolicy for the Microsoft Azure subscription. -// privateEndpointConnectionName - The name of the private endpoint connection. -// parameters - Parameters supplied to create or update a private endpoint connection. -// options - PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate -// method. -func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, enterprisePolicyName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, parameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) - } -} - // CreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, enterprisePolicyName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - enterprisePolicyName - EnterprisePolicy for the Microsoft Azure subscription. +// - privateEndpointConnectionName - The name of the private endpoint connection. +// - parameters - Parameters supplied to create or update a private endpoint connection. +// - options - PrivateEndpointConnectionsClientCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.CreateOrUpdate +// method. +func (client *PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, enterprisePolicyName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientCreateOrUpdateOptions) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, parameters, options) if err != nil { - return nil, err + return PrivateEndpointConnectionsClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { - return nil, err + return PrivateEndpointConnectionsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) } - return resp, nil + return client.createOrUpdateHandleResponse(resp) } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, enterprisePolicyName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, enterprisePolicyName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/enterprisePolicies/{enterprisePolicyName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -112,7 +88,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -123,46 +99,41 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return req, runtime.MarshalAsJSON(req, parameters) } -// BeginDelete - Deletes a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-30-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// enterprisePolicyName - EnterprisePolicy for the Microsoft Azure subscription. -// privateEndpointConnectionName - The name of the private endpoint connection. -// options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, enterprisePolicyName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *PrivateEndpointConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error) { + result := PrivateEndpointConnectionsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientCreateOrUpdateResponse{}, err } + return result, nil } // Delete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, enterprisePolicyName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - enterprisePolicyName - EnterprisePolicy for the Microsoft Azure subscription. +// - privateEndpointConnectionName - The name of the private endpoint connection. +// - options - PrivateEndpointConnectionsClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Delete +// method. +func (client *PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, enterprisePolicyName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientDeleteOptions) (PrivateEndpointConnectionsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, options) if err != nil { - return nil, err + return PrivateEndpointConnectionsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { - return nil, err + return PrivateEndpointConnectionsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return PrivateEndpointConnectionsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return resp, nil + return PrivateEndpointConnectionsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, enterprisePolicyName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, enterprisePolicyName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/enterprisePolicies/{enterprisePolicyName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -180,7 +151,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -193,18 +164,19 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// enterprisePolicyName - EnterprisePolicy for the Microsoft Azure subscription. -// privateEndpointConnectionName - The name of the private endpoint connection. -// options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - enterprisePolicyName - EnterprisePolicy for the Microsoft Azure subscription. +// - privateEndpointConnectionName - The name of the private endpoint connection. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, enterprisePolicyName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } @@ -233,7 +205,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -254,12 +226,12 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res } // NewListByEnterprisePolicyPager - List all private endpoint connections on an EnterprisePolicy. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// enterprisePolicyName - EnterprisePolicy for the Microsoft Azure subscription. -// options - PrivateEndpointConnectionsClientListByEnterprisePolicyOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByEnterprisePolicy -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - enterprisePolicyName - EnterprisePolicy for the Microsoft Azure subscription. +// - options - PrivateEndpointConnectionsClientListByEnterprisePolicyOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByEnterprisePolicyPager +// method. func (client *PrivateEndpointConnectionsClient) NewListByEnterprisePolicyPager(resourceGroupName string, enterprisePolicyName string, options *PrivateEndpointConnectionsClientListByEnterprisePolicyOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByEnterprisePolicyResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByEnterprisePolicyResponse]{ More: func(page PrivateEndpointConnectionsClientListByEnterprisePolicyResponse) bool { @@ -270,7 +242,7 @@ func (client *PrivateEndpointConnectionsClient) NewListByEnterprisePolicyPager(r if err != nil { return PrivateEndpointConnectionsClientListByEnterprisePolicyResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientListByEnterprisePolicyResponse{}, err } @@ -297,7 +269,7 @@ func (client *PrivateEndpointConnectionsClient) listByEnterprisePolicyCreateRequ return nil, errors.New("parameter enterprisePolicyName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{enterprisePolicyName}", url.PathEscape(enterprisePolicyName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/powerplatform/armpowerplatform/privatelinkresources_client.go similarity index 82% rename from sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_privatelinkresources_client.go rename to sdk/resourcemanager/powerplatform/armpowerplatform/privatelinkresources_client.go index 2954d7b0d328..54aa7e21e91a 100644 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/privatelinkresources_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armpowerplatform @@ -13,8 +14,6 @@ import ( "errors" "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" @@ -25,49 +24,41 @@ import ( // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. // Don't use this type directly, use NewPrivateLinkResourcesClient() instead. type PrivateLinkResourcesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.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) + cl, err := arm.NewClient(moduleName+".PrivateLinkResourcesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PrivateLinkResourcesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // Get - Gets the private link resources that need to be created for an EnterprisePolicy. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// enterprisePolicyName - EnterprisePolicy for the Microsoft Azure subscription. -// groupName - The name of the private link resource. -// options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - enterprisePolicyName - EnterprisePolicy for the Microsoft Azure subscription. +// - groupName - The name of the private link resource. +// - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get +// method. func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, enterprisePolicyName string, groupName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, enterprisePolicyName, groupName, options) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } @@ -96,7 +87,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, errors.New("parameter groupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -117,12 +108,12 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) } // NewListByEnterprisePolicyPager - Gets the private link resources that need to be created for enterprisePolicy. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-30-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// enterprisePolicyName - EnterprisePolicy for the Microsoft Azure subscription. -// options - PrivateLinkResourcesClientListByEnterprisePolicyOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByEnterprisePolicy -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - enterprisePolicyName - EnterprisePolicy for the Microsoft Azure subscription. +// - options - PrivateLinkResourcesClientListByEnterprisePolicyOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByEnterprisePolicyPager +// method. func (client *PrivateLinkResourcesClient) NewListByEnterprisePolicyPager(resourceGroupName string, enterprisePolicyName string, options *PrivateLinkResourcesClientListByEnterprisePolicyOptions) *runtime.Pager[PrivateLinkResourcesClientListByEnterprisePolicyResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListByEnterprisePolicyResponse]{ More: func(page PrivateLinkResourcesClientListByEnterprisePolicyResponse) bool { @@ -133,7 +124,7 @@ func (client *PrivateLinkResourcesClient) NewListByEnterprisePolicyPager(resourc if err != nil { return PrivateLinkResourcesClientListByEnterprisePolicyResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientListByEnterprisePolicyResponse{}, err } @@ -160,7 +151,7 @@ func (client *PrivateLinkResourcesClient) listByEnterprisePolicyCreateRequest(ct return nil, errors.New("parameter enterprisePolicyName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{enterprisePolicyName}", url.PathEscape(enterprisePolicyName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_response_types.go b/sdk/resourcemanager/powerplatform/armpowerplatform/response_types.go similarity index 89% rename from sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_response_types.go rename to sdk/resourcemanager/powerplatform/armpowerplatform/response_types.go index 1717be0e6408..956468c4c94d 100644 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_response_types.go +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/response_types.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armpowerplatform @@ -23,12 +24,12 @@ type AccountsClientGetResponse struct { Account } -// AccountsClientListByResourceGroupResponse contains the response from method AccountsClient.ListByResourceGroup. +// AccountsClientListByResourceGroupResponse contains the response from method AccountsClient.NewListByResourceGroupPager. type AccountsClientListByResourceGroupResponse struct { AccountList } -// AccountsClientListBySubscriptionResponse contains the response from method AccountsClient.ListBySubscription. +// AccountsClientListBySubscriptionResponse contains the response from method AccountsClient.NewListBySubscriptionPager. type AccountsClientListBySubscriptionResponse struct { AccountList } @@ -53,12 +54,12 @@ type EnterprisePoliciesClientGetResponse struct { EnterprisePolicy } -// EnterprisePoliciesClientListByResourceGroupResponse contains the response from method EnterprisePoliciesClient.ListByResourceGroup. +// EnterprisePoliciesClientListByResourceGroupResponse contains the response from method EnterprisePoliciesClient.NewListByResourceGroupPager. type EnterprisePoliciesClientListByResourceGroupResponse struct { EnterprisePolicyList } -// EnterprisePoliciesClientListBySubscriptionResponse contains the response from method EnterprisePoliciesClient.ListBySubscription. +// EnterprisePoliciesClientListBySubscriptionResponse contains the response from method EnterprisePoliciesClient.NewListBySubscriptionPager. type EnterprisePoliciesClientListBySubscriptionResponse struct { EnterprisePolicyList } @@ -68,7 +69,7 @@ type EnterprisePoliciesClientUpdateResponse struct { EnterprisePolicy } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult } @@ -88,7 +89,7 @@ type PrivateEndpointConnectionsClientGetResponse struct { PrivateEndpointConnection } -// PrivateEndpointConnectionsClientListByEnterprisePolicyResponse contains the response from method PrivateEndpointConnectionsClient.ListByEnterprisePolicy. +// PrivateEndpointConnectionsClientListByEnterprisePolicyResponse contains the response from method PrivateEndpointConnectionsClient.NewListByEnterprisePolicyPager. type PrivateEndpointConnectionsClientListByEnterprisePolicyResponse struct { PrivateEndpointConnectionListResult } @@ -98,7 +99,7 @@ type PrivateLinkResourcesClientGetResponse struct { PrivateLinkResource } -// PrivateLinkResourcesClientListByEnterprisePolicyResponse contains the response from method PrivateLinkResourcesClient.ListByEnterprisePolicy. +// PrivateLinkResourcesClientListByEnterprisePolicyResponse contains the response from method PrivateLinkResourcesClient.NewListByEnterprisePolicyPager. type PrivateLinkResourcesClientListByEnterprisePolicyResponse struct { PrivateLinkResourceListResult } diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_time_rfc3339.go b/sdk/resourcemanager/powerplatform/armpowerplatform/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/powerplatform/armpowerplatform/time_rfc3339.go index 1202991dd6c9..e9ffd6a4bd39 100644 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/powerplatform/armpowerplatform/time_rfc3339.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armpowerplatform @@ -61,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_accounts_client_test.go b/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_accounts_client_test.go deleted file mode 100644 index d49b44acbc94..000000000000 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_accounts_client_test.go +++ /dev/null @@ -1,171 +0,0 @@ -//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 armpowerplatform_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/powerplatform/armpowerplatform" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/createOrUpdateAccount.json -func ExampleAccountsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewAccountsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "account", - "resourceGroup", - armpowerplatform.Account{ - Location: to.Ptr("East US"), - Tags: map[string]*string{ - "Organization": to.Ptr("Administration"), - }, - Properties: &armpowerplatform.AccountProperties{ - Description: to.Ptr("Description of the account."), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/getAccount.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, err := armpowerplatform.NewAccountsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "account", - "rg", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/deleteAccount.json -func ExampleAccountsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewAccountsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "account", - "resourceGroup", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/updateAccount.json -func ExampleAccountsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewAccountsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "account", - "resourceGroup", - armpowerplatform.PatchAccount{ - Location: to.Ptr("East US"), - Tags: map[string]*string{ - "Organization": to.Ptr("Administration"), - }, - Properties: &armpowerplatform.AccountProperties{ - Description: to.Ptr("Description of account."), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/listAccountsByResourceGroup.json -func ExampleAccountsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewAccountsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("rg", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/listAccountsBySubscription.json -func ExampleAccountsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewAccountsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_enterprisepolicies_client_test.go b/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_enterprisepolicies_client_test.go deleted file mode 100644 index 6348e1cd3bbf..000000000000 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_enterprisepolicies_client_test.go +++ /dev/null @@ -1,172 +0,0 @@ -//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 armpowerplatform_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/powerplatform/armpowerplatform" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/createOrUpdateEnterprisePolicy.json -func ExampleEnterprisePoliciesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewEnterprisePoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "enterprisePolicy", - "resourceGroup", - armpowerplatform.EnterprisePolicy{ - Location: to.Ptr("East US"), - Tags: map[string]*string{ - "Organization": to.Ptr("Administration"), - }, - Identity: &armpowerplatform.EnterprisePolicyIdentity{ - Type: to.Ptr(armpowerplatform.ResourceIdentityTypeSystemAssigned), - }, - Kind: to.Ptr(armpowerplatform.EnterprisePolicyKindLockbox), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/getEnterprisePolicy.json -func ExampleEnterprisePoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewEnterprisePoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "enterprisePolicy", - "rg", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/deleteEnterprisePolicy.json -func ExampleEnterprisePoliciesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewEnterprisePoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "resourceGroup", - "enterprisePolicy", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/updateEnterprisePolicy.json -func ExampleEnterprisePoliciesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewEnterprisePoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "enterprisePolicy", - "resourceGroup", - armpowerplatform.PatchEnterprisePolicy{ - Location: to.Ptr("East US"), - Tags: map[string]*string{ - "Organization": to.Ptr("Administration"), - }, - Identity: &armpowerplatform.EnterprisePolicyIdentity{ - Type: to.Ptr(armpowerplatform.ResourceIdentityTypeSystemAssigned), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/listEnterprisePoliciesByResourceGroup.json -func ExampleEnterprisePoliciesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewEnterprisePoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("rg1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/listEnterprisePoliciesBySubscription.json -func ExampleEnterprisePoliciesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewEnterprisePoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_operations_client_test.go deleted file mode 100644 index 3e8030a3d5b1..000000000000 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//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 armpowerplatform_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerplatform/armpowerplatform" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/listOperations.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_privateendpointconnections_client_test.go deleted file mode 100644 index 1be2869594e6..000000000000 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_privateendpointconnections_client_test.go +++ /dev/null @@ -1,127 +0,0 @@ -//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 armpowerplatform_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/powerplatform/armpowerplatform" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/PrivateEndpointConnectionListGet.json -func ExamplePrivateEndpointConnectionsClient_NewListByEnterprisePolicyPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewPrivateEndpointConnectionsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByEnterprisePolicyPager("rg1", - "ddb1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/PrivateEndpointConnectionGet.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, err := armpowerplatform.NewPrivateEndpointConnectionsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "ddb1", - "privateEndpointConnectionName", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/PrivateEndpointConnectionUpdate.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, err := armpowerplatform.NewPrivateEndpointConnectionsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "rg1", - "ddb1", - "privateEndpointConnectionName", - armpowerplatform.PrivateEndpointConnection{ - Properties: &armpowerplatform.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armpowerplatform.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr(armpowerplatform.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/PrivateEndpointConnectionDelete.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, err := armpowerplatform.NewPrivateEndpointConnectionsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "rg1", - "ddb1", - "privateEndpointConnectionName", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_privatelinkresources_client_test.go deleted file mode 100644 index c76aed9b123d..000000000000 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/ze_generated_example_privatelinkresources_client_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//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 armpowerplatform_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerplatform/armpowerplatform" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/PrivateLinkResourceListGet.json -func ExamplePrivateLinkResourcesClient_NewListByEnterprisePolicyPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerplatform.NewPrivateLinkResourcesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByEnterprisePolicyPager("rg1", - "ddb1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/PrivateLinkResourceGet.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, err := armpowerplatform.NewPrivateLinkResourcesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "ddb1", - "sql", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_models_serde.go b/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_models_serde.go deleted file mode 100644 index 1d42276e28c6..000000000000 --- a/sdk/resourcemanager/powerplatform/armpowerplatform/zz_generated_models_serde.go +++ /dev/null @@ -1,178 +0,0 @@ -//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 armpowerplatform - -import ( - "encoding/json" - "fmt" - "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, "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 EnterprisePolicy. -func (e EnterprisePolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", e.ID) - populate(objectMap, "identity", e.Identity) - populate(objectMap, "kind", e.Kind) - populate(objectMap, "location", e.Location) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "tags", e.Tags) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PatchAccount. -func (p PatchAccount) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PatchEnterprisePolicy. -func (p PatchEnterprisePolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "kind", p.Kind) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PatchTrackedResource. -func (p PatchTrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - 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 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 fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesList. -func (v VirtualNetworkPropertiesList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", v.NextLink) - populate(objectMap, "value", v.Value) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}