diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/CHANGELOG.md b/sdk/resourcemanager/servicelinker/armservicelinker/CHANGELOG.md index cac270158d1a..f718374f2317 100644 --- a/sdk/resourcemanager/servicelinker/armservicelinker/CHANGELOG.md +++ b/sdk/resourcemanager/servicelinker/armservicelinker/CHANGELOG.md @@ -1,5 +1,125 @@ # Release History +## 2.0.0-beta.1 (2024-02-07) +### Breaking Changes + +- Type of `ErrorAdditionalInfo.Info` has been changed from `any` to `interface{}` +- Function `NewClientFactory` has been removed +- Function `*ClientFactory.NewLinkerClient` has been removed +- Function `*ClientFactory.NewOperationsClient` has been removed +- Function `dateTimeRFC3339.MarshalText` has been removed +- Function `*dateTimeRFC3339.Parse` has been removed +- Function `*dateTimeRFC3339.UnmarshalText` has been removed +- Struct `ClientFactory` has been removed +- Struct `LinkerList` has been removed +- Struct `SourceConfigurationResult` has been removed +- Field `SourceConfigurationResult` of struct `LinkerClientListConfigurationsResponse` has been removed +- Field `LinkerList` of struct `LinkerClientListResponse` has been removed + +### Features Added + +- New value `ActionTypeEnable`, `ActionTypeOptOut` added to type alias `ActionType` +- New value `AuthTypeAccessKey`, `AuthTypeUserAccount` added to type alias `AuthType` +- New value `ClientTypeDapr`, `ClientTypeKafkaSpringBoot` added to type alias `ClientType` +- New value `TargetServiceTypeSelfHostedServer` added to type alias `TargetServiceType` +- New type alias `AccessKeyPermissions` with values `AccessKeyPermissionsListen`, `AccessKeyPermissionsManage`, `AccessKeyPermissionsRead`, `AccessKeyPermissionsSend`, `AccessKeyPermissionsWrite` +- New type alias `AllowType` with values `AllowTypeFalse`, `AllowTypeTrue` +- New type alias `DeleteOrUpdateBehavior` with values `DeleteOrUpdateBehaviorDefault`, `DeleteOrUpdateBehaviorForcedCleanup` +- New type alias `DryrunActionName` with values `DryrunActionNameCreateOrUpdate` +- New type alias `DryrunPrerequisiteResultType` with values `DryrunPrerequisiteResultTypeBasicError`, `DryrunPrerequisiteResultTypePermissionsMissing` +- New type alias `DryrunPreviewOperationType` with values `DryrunPreviewOperationTypeConfigAuth`, `DryrunPreviewOperationTypeConfigConnection`, `DryrunPreviewOperationTypeConfigNetwork` +- New function `*AccessKeyInfoBase.GetAuthInfoBase() *AuthInfoBase` +- New function `*BasicErrorDryrunPrerequisiteResult.GetDryrunPrerequisiteResult() *DryrunPrerequisiteResult` +- New function `NewConfigurationNamesClient(azcore.TokenCredential, *arm.ClientOptions) (*ConfigurationNamesClient, error)` +- New function `*ConfigurationNamesClient.NewListPager(*ConfigurationNamesClientListOptions) *runtime.Pager[ConfigurationNamesClientListResponse]` +- New function `NewConnectorClient(azcore.TokenCredential, *arm.ClientOptions) (*ConnectorClient, error)` +- New function `*ConnectorClient.BeginCreateDryrun(context.Context, string, string, string, string, DryrunResource, *ConnectorClientBeginCreateDryrunOptions) (*runtime.Poller[ConnectorClientCreateDryrunResponse], error)` +- New function `*ConnectorClient.BeginCreateOrUpdate(context.Context, string, string, string, string, LinkerResource, *ConnectorClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConnectorClientCreateOrUpdateResponse], error)` +- New function `*ConnectorClient.BeginDelete(context.Context, string, string, string, string, *ConnectorClientBeginDeleteOptions) (*runtime.Poller[ConnectorClientDeleteResponse], error)` +- New function `*ConnectorClient.DeleteDryrun(context.Context, string, string, string, string, *ConnectorClientDeleteDryrunOptions) (ConnectorClientDeleteDryrunResponse, error)` +- New function `*ConnectorClient.GenerateConfigurations(context.Context, string, string, string, string, *ConnectorClientGenerateConfigurationsOptions) (ConnectorClientGenerateConfigurationsResponse, error)` +- New function `*ConnectorClient.Get(context.Context, string, string, string, string, *ConnectorClientGetOptions) (ConnectorClientGetResponse, error)` +- New function `*ConnectorClient.GetDryrun(context.Context, string, string, string, string, *ConnectorClientGetDryrunOptions) (ConnectorClientGetDryrunResponse, error)` +- New function `*ConnectorClient.NewListDryrunPager(string, string, string, *ConnectorClientListDryrunOptions) *runtime.Pager[ConnectorClientListDryrunResponse]` +- New function `*ConnectorClient.NewListPager(string, string, string, *ConnectorClientListOptions) *runtime.Pager[ConnectorClientListResponse]` +- New function `*ConnectorClient.BeginUpdate(context.Context, string, string, string, string, LinkerPatch, *ConnectorClientBeginUpdateOptions) (*runtime.Poller[ConnectorClientUpdateResponse], error)` +- New function `*ConnectorClient.BeginUpdateDryrun(context.Context, string, string, string, string, DryrunPatch, *ConnectorClientBeginUpdateDryrunOptions) (*runtime.Poller[ConnectorClientUpdateDryrunResponse], error)` +- New function `*ConnectorClient.BeginValidate(context.Context, string, string, string, string, *ConnectorClientBeginValidateOptions) (*runtime.Poller[ConnectorClientValidateResponse], error)` +- New function `*CreateOrUpdateDryrunParameters.GetDryrunParameters() *DryrunParameters` +- New function `*DryrunParameters.GetDryrunParameters() *DryrunParameters` +- New function `*DryrunPrerequisiteResult.GetDryrunPrerequisiteResult() *DryrunPrerequisiteResult` +- New function `NewLinkersClient(azcore.TokenCredential, *arm.ClientOptions) (*LinkersClient, error)` +- New function `*LinkersClient.BeginCreateDryrun(context.Context, string, string, DryrunResource, *LinkersClientBeginCreateDryrunOptions) (*runtime.Poller[LinkersClientCreateDryrunResponse], error)` +- New function `*LinkersClient.DeleteDryrun(context.Context, string, string, *LinkersClientDeleteDryrunOptions) (LinkersClientDeleteDryrunResponse, error)` +- New function `*LinkersClient.GenerateConfigurations(context.Context, string, string, *LinkersClientGenerateConfigurationsOptions) (LinkersClientGenerateConfigurationsResponse, error)` +- New function `*LinkersClient.GetDryrun(context.Context, string, string, *LinkersClientGetDryrunOptions) (LinkersClientGetDryrunResponse, error)` +- New function `*LinkersClient.NewListDryrunPager(string, *LinkersClientListDryrunOptions) *runtime.Pager[LinkersClientListDryrunResponse]` +- New function `*LinkersClient.BeginUpdateDryrun(context.Context, string, string, DryrunPatch, *LinkersClientBeginUpdateDryrunOptions) (*runtime.Poller[LinkersClientUpdateDryrunResponse], error)` +- New function `*PermissionsMissingDryrunPrerequisiteResult.GetDryrunPrerequisiteResult() *DryrunPrerequisiteResult` +- New function `*SelfHostedServer.GetTargetServiceBase() *TargetServiceBase` +- New function `*UserAccountAuthInfo.GetAuthInfoBase() *AuthInfoBase` +- New function `timeRFC3339.MarshalText() ([]byte, error)` +- New function `*timeRFC3339.Parse(string) error` +- New function `*timeRFC3339.UnmarshalText([]byte) error` +- New struct `AccessKeyInfoBase` +- New struct `BasicErrorDryrunPrerequisiteResult` +- New struct `ConfigurationInfo` +- New struct `ConfigurationName` +- New struct `ConfigurationNameItem` +- New struct `ConfigurationNameResult` +- New struct `ConfigurationNames` +- New struct `ConfigurationNamesClient` +- New struct `ConfigurationNamesClientListResponse` +- New struct `ConfigurationResult` +- New struct `ConnectorClient` +- New struct `ConnectorClientCreateDryrunResponse` +- New struct `ConnectorClientCreateOrUpdateResponse` +- New struct `ConnectorClientDeleteResponse` +- New struct `ConnectorClientListDryrunResponse` +- New struct `ConnectorClientListResponse` +- New struct `ConnectorClientUpdateDryrunResponse` +- New struct `ConnectorClientUpdateResponse` +- New struct `ConnectorClientValidateResponse` +- New struct `CreateOrUpdateDryrunParameters` +- New struct `DaprMetadata` +- New struct `DaprProperties` +- New struct `DatabaseAADAuthInfo` +- New struct `DryrunList` +- New struct `DryrunOperationPreview` +- New struct `DryrunPatch` +- New struct `DryrunProperties` +- New struct `DryrunResource` +- New struct `FirewallRules` +- New struct `LinkersClient` +- New struct `LinkersClientCreateDryrunResponse` +- New struct `LinkersClientListDryrunResponse` +- New struct `LinkersClientUpdateDryrunResponse` +- New struct `PermissionsMissingDryrunPrerequisiteResult` +- New struct `PublicNetworkSolution` +- New struct `ResourceList` +- New struct `SelfHostedServer` +- New struct `UserAccountAuthInfo` +- New anonymous field `ConfigurationResult` in struct `LinkerClientListConfigurationsResponse` +- New anonymous field `ResourceList` in struct `LinkerClientListResponse` +- New field `ConfigurationInfo` in struct `LinkerProperties` +- New field `PublicNetworkSolution` in struct `LinkerProperties` +- New field `SystemData` in struct `ProxyResource` +- New field `SystemData` in struct `Resource` +- New field `KeyVaultSecretName` in struct `SecretStore` +- New field `DeleteOrUpdateBehavior` in struct `ServicePrincipalCertificateAuthInfo` +- New field `Roles` in struct `ServicePrincipalCertificateAuthInfo` +- New field `DeleteOrUpdateBehavior` in struct `ServicePrincipalSecretAuthInfo` +- New field `Roles` in struct `ServicePrincipalSecretAuthInfo` +- New field `UserName` in struct `ServicePrincipalSecretAuthInfo` +- New field `DeleteOrUpdateBehavior` in struct `SystemAssignedIdentityAuthInfo` +- New field `Roles` in struct `SystemAssignedIdentityAuthInfo` +- New field `UserName` in struct `SystemAssignedIdentityAuthInfo` +- New field `DeleteOrUpdateBehavior` in struct `UserAssignedIdentityAuthInfo` +- New field `Roles` in struct `UserAssignedIdentityAuthInfo` +- New field `UserName` in struct `UserAssignedIdentityAuthInfo` +- New field `DeleteOrUpdateBehavior` in struct `VNetSolution` + + ## 1.0.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicelinker/armservicelinker` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/autorest.md b/sdk/resourcemanager/servicelinker/armservicelinker/autorest.md index 7c484bb849fd..199dde15424f 100644 --- a/sdk/resourcemanager/servicelinker/armservicelinker/autorest.md +++ b/sdk/resourcemanager/servicelinker/armservicelinker/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/servicelinker/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/servicelinker/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/servicelinker/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/servicelinker/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/configurationnames_client.go b/sdk/resourcemanager/servicelinker/armservicelinker/configurationnames_client.go new file mode 100644 index 000000000000..6f168fdb8ac6 --- /dev/null +++ b/sdk/resourcemanager/servicelinker/armservicelinker/configurationnames_client.go @@ -0,0 +1,110 @@ +//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 armservicelinker + +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" +) + +// ConfigurationNamesClient contains the methods for the ConfigurationNames group. +// Don't use this type directly, use NewConfigurationNamesClient() instead. +type ConfigurationNamesClient struct { + host string + pl runtime.Pipeline +} + +// NewConfigurationNamesClient creates a new instance of ConfigurationNamesClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConfigurationNamesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationNamesClient, 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) + if err != nil { + return nil, err + } + client := &ConfigurationNamesClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Lists the configuration names generated by Service Connector for all target, client types, auth types. +// Generated from API version 2022-11-01-preview +// options - ConfigurationNamesClientListOptions contains the optional parameters for the ConfigurationNamesClient.List method. +func (client *ConfigurationNamesClient) NewListPager(options *ConfigurationNamesClientListOptions) *runtime.Pager[ConfigurationNamesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ConfigurationNamesClientListResponse]{ + More: func(page ConfigurationNamesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConfigurationNamesClientListResponse) (ConfigurationNamesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConfigurationNamesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConfigurationNamesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConfigurationNamesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ConfigurationNamesClient) listCreateRequest(ctx context.Context, options *ConfigurationNamesClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ServiceLinker/configurationNames" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ConfigurationNamesClient) listHandleResponse(resp *http.Response) (ConfigurationNamesClientListResponse, error) { + result := ConfigurationNamesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationNameResult); err != nil { + return ConfigurationNamesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/connector_client.go b/sdk/resourcemanager/servicelinker/armservicelinker/connector_client.go new file mode 100644 index 000000000000..5a358932d314 --- /dev/null +++ b/sdk/resourcemanager/servicelinker/armservicelinker/connector_client.go @@ -0,0 +1,862 @@ +//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 armservicelinker + +import ( + "context" + "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" + "net/url" + "strings" +) + +// ConnectorClient contains the methods for the Connector group. +// Don't use this type directly, use NewConnectorClient() instead. +type ConnectorClient struct { + host string + pl runtime.Pipeline +} + +// NewConnectorClient creates a new instance of ConnectorClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConnectorClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectorClient, 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) + if err != nil { + return nil, err + } + client := &ConnectorClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateDryrun - create a dryrun job to do necessary check before actual creation +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// subscriptionID - The ID of the target subscription. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// location - The name of Azure region. +// dryrunName - The name of dryrun. +// parameters - dryrun resource. +// options - ConnectorClientBeginCreateDryrunOptions contains the optional parameters for the ConnectorClient.BeginCreateDryrun +// method. +func (client *ConnectorClient) BeginCreateDryrun(ctx context.Context, subscriptionID string, resourceGroupName string, location string, dryrunName string, parameters DryrunResource, options *ConnectorClientBeginCreateDryrunOptions) (*runtime.Poller[ConnectorClientCreateDryrunResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createDryrun(ctx, subscriptionID, resourceGroupName, location, dryrunName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectorClientCreateDryrunResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectorClientCreateDryrunResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateDryrun - create a dryrun job to do necessary check before actual creation +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +func (client *ConnectorClient) createDryrun(ctx context.Context, subscriptionID string, resourceGroupName string, location string, dryrunName string, parameters DryrunResource, options *ConnectorClientBeginCreateDryrunOptions) (*http.Response, error) { + req, err := client.createDryrunCreateRequest(ctx, subscriptionID, resourceGroupName, location, dryrunName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createDryrunCreateRequest creates the CreateDryrun request. +func (client *ConnectorClient) createDryrunCreateRequest(ctx context.Context, subscriptionID string, resourceGroupName string, location string, dryrunName string, parameters DryrunResource, options *ConnectorClientBeginCreateDryrunOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" + if subscriptionID == "" { + return nil, errors.New("parameter subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if dryrunName == "" { + return nil, errors.New("parameter dryrunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dryrunName}", url.PathEscape(dryrunName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginCreateOrUpdate - Create or update Connector resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// subscriptionID - The ID of the target subscription. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// location - The name of Azure region. +// connectorName - The name of resource. +// parameters - Connector details. +// options - ConnectorClientBeginCreateOrUpdateOptions contains the optional parameters for the ConnectorClient.BeginCreateOrUpdate +// method. +func (client *ConnectorClient) BeginCreateOrUpdate(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, parameters LinkerResource, options *ConnectorClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConnectorClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, subscriptionID, resourceGroupName, location, connectorName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectorClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectorClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update Connector resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +func (client *ConnectorClient) createOrUpdate(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, parameters LinkerResource, options *ConnectorClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, subscriptionID, resourceGroupName, location, connectorName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectorClient) createOrUpdateCreateRequest(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, parameters LinkerResource, options *ConnectorClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" + if subscriptionID == "" { + return nil, errors.New("parameter subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Delete a Connector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// subscriptionID - The ID of the target subscription. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// location - The name of Azure region. +// connectorName - The name of resource. +// options - ConnectorClientBeginDeleteOptions contains the optional parameters for the ConnectorClient.BeginDelete method. +func (client *ConnectorClient) BeginDelete(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, options *ConnectorClientBeginDeleteOptions) (*runtime.Poller[ConnectorClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, subscriptionID, resourceGroupName, location, connectorName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectorClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectorClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete a Connector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +func (client *ConnectorClient) deleteOperation(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, options *ConnectorClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, subscriptionID, resourceGroupName, location, connectorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectorClient) deleteCreateRequest(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, options *ConnectorClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" + if subscriptionID == "" { + return nil, errors.New("parameter subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// DeleteDryrun - delete a dryrun job +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// subscriptionID - The ID of the target subscription. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// location - The name of Azure region. +// dryrunName - The name of dryrun. +// options - ConnectorClientDeleteDryrunOptions contains the optional parameters for the ConnectorClient.DeleteDryrun method. +func (client *ConnectorClient) DeleteDryrun(ctx context.Context, subscriptionID string, resourceGroupName string, location string, dryrunName string, options *ConnectorClientDeleteDryrunOptions) (ConnectorClientDeleteDryrunResponse, error) { + req, err := client.deleteDryrunCreateRequest(ctx, subscriptionID, resourceGroupName, location, dryrunName, options) + if err != nil { + return ConnectorClientDeleteDryrunResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorClientDeleteDryrunResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ConnectorClientDeleteDryrunResponse{}, runtime.NewResponseError(resp) + } + return ConnectorClientDeleteDryrunResponse{}, nil +} + +// deleteDryrunCreateRequest creates the DeleteDryrun request. +func (client *ConnectorClient) deleteDryrunCreateRequest(ctx context.Context, subscriptionID string, resourceGroupName string, location string, dryrunName string, options *ConnectorClientDeleteDryrunOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" + if subscriptionID == "" { + return nil, errors.New("parameter subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if dryrunName == "" { + return nil, errors.New("parameter dryrunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dryrunName}", url.PathEscape(dryrunName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GenerateConfigurations - Generate configurations for a Connector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// subscriptionID - The ID of the target subscription. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// location - The name of Azure region. +// connectorName - The name of resource. +// options - ConnectorClientGenerateConfigurationsOptions contains the optional parameters for the ConnectorClient.GenerateConfigurations +// method. +func (client *ConnectorClient) GenerateConfigurations(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, options *ConnectorClientGenerateConfigurationsOptions) (ConnectorClientGenerateConfigurationsResponse, error) { + req, err := client.generateConfigurationsCreateRequest(ctx, subscriptionID, resourceGroupName, location, connectorName, options) + if err != nil { + return ConnectorClientGenerateConfigurationsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorClientGenerateConfigurationsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectorClientGenerateConfigurationsResponse{}, runtime.NewResponseError(resp) + } + return client.generateConfigurationsHandleResponse(resp) +} + +// generateConfigurationsCreateRequest creates the GenerateConfigurations request. +func (client *ConnectorClient) generateConfigurationsCreateRequest(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, options *ConnectorClientGenerateConfigurationsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations" + if subscriptionID == "" { + return nil, errors.New("parameter subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// generateConfigurationsHandleResponse handles the GenerateConfigurations response. +func (client *ConnectorClient) generateConfigurationsHandleResponse(resp *http.Response) (ConnectorClientGenerateConfigurationsResponse, error) { + result := ConnectorClientGenerateConfigurationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationResult); err != nil { + return ConnectorClientGenerateConfigurationsResponse{}, err + } + return result, nil +} + +// Get - Returns Connector resource for a given name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// subscriptionID - The ID of the target subscription. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// location - The name of Azure region. +// connectorName - The name of resource. +// options - ConnectorClientGetOptions contains the optional parameters for the ConnectorClient.Get method. +func (client *ConnectorClient) Get(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, options *ConnectorClientGetOptions) (ConnectorClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, subscriptionID, resourceGroupName, location, connectorName, options) + if err != nil { + return ConnectorClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectorClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectorClient) getCreateRequest(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, options *ConnectorClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" + if subscriptionID == "" { + return nil, errors.New("parameter subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ConnectorClient) getHandleResponse(resp *http.Response) (ConnectorClientGetResponse, error) { + result := ConnectorClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LinkerResource); err != nil { + return ConnectorClientGetResponse{}, err + } + return result, nil +} + +// GetDryrun - get a dryrun job +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// subscriptionID - The ID of the target subscription. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// location - The name of Azure region. +// dryrunName - The name of dryrun. +// options - ConnectorClientGetDryrunOptions contains the optional parameters for the ConnectorClient.GetDryrun method. +func (client *ConnectorClient) GetDryrun(ctx context.Context, subscriptionID string, resourceGroupName string, location string, dryrunName string, options *ConnectorClientGetDryrunOptions) (ConnectorClientGetDryrunResponse, error) { + req, err := client.getDryrunCreateRequest(ctx, subscriptionID, resourceGroupName, location, dryrunName, options) + if err != nil { + return ConnectorClientGetDryrunResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorClientGetDryrunResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectorClientGetDryrunResponse{}, runtime.NewResponseError(resp) + } + return client.getDryrunHandleResponse(resp) +} + +// getDryrunCreateRequest creates the GetDryrun request. +func (client *ConnectorClient) getDryrunCreateRequest(ctx context.Context, subscriptionID string, resourceGroupName string, location string, dryrunName string, options *ConnectorClientGetDryrunOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" + if subscriptionID == "" { + return nil, errors.New("parameter subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if dryrunName == "" { + return nil, errors.New("parameter dryrunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dryrunName}", url.PathEscape(dryrunName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getDryrunHandleResponse handles the GetDryrun response. +func (client *ConnectorClient) getDryrunHandleResponse(resp *http.Response) (ConnectorClientGetDryrunResponse, error) { + result := ConnectorClientGetDryrunResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DryrunResource); err != nil { + return ConnectorClientGetDryrunResponse{}, err + } + return result, nil +} + +// NewListPager - Returns list of connector which connects to the resource, which supports to config the target service during +// the resource provision. +// Generated from API version 2022-11-01-preview +// subscriptionID - The ID of the target subscription. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// location - The name of Azure region. +// options - ConnectorClientListOptions contains the optional parameters for the ConnectorClient.List method. +func (client *ConnectorClient) NewListPager(subscriptionID string, resourceGroupName string, location string, options *ConnectorClientListOptions) *runtime.Pager[ConnectorClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectorClientListResponse]{ + More: func(page ConnectorClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectorClientListResponse) (ConnectorClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, subscriptionID, resourceGroupName, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConnectorClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectorClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ConnectorClient) listCreateRequest(ctx context.Context, subscriptionID string, resourceGroupName string, location string, options *ConnectorClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors" + if subscriptionID == "" { + return nil, errors.New("parameter subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ConnectorClient) listHandleResponse(resp *http.Response) (ConnectorClientListResponse, error) { + result := ConnectorClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceList); err != nil { + return ConnectorClientListResponse{}, err + } + return result, nil +} + +// NewListDryrunPager - list dryrun jobs +// Generated from API version 2022-11-01-preview +// subscriptionID - The ID of the target subscription. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// location - The name of Azure region. +// options - ConnectorClientListDryrunOptions contains the optional parameters for the ConnectorClient.ListDryrun method. +func (client *ConnectorClient) NewListDryrunPager(subscriptionID string, resourceGroupName string, location string, options *ConnectorClientListDryrunOptions) *runtime.Pager[ConnectorClientListDryrunResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectorClientListDryrunResponse]{ + More: func(page ConnectorClientListDryrunResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectorClientListDryrunResponse) (ConnectorClientListDryrunResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listDryrunCreateRequest(ctx, subscriptionID, resourceGroupName, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConnectorClientListDryrunResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorClientListDryrunResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectorClientListDryrunResponse{}, runtime.NewResponseError(resp) + } + return client.listDryrunHandleResponse(resp) + }, + }) +} + +// listDryrunCreateRequest creates the ListDryrun request. +func (client *ConnectorClient) listDryrunCreateRequest(ctx context.Context, subscriptionID string, resourceGroupName string, location string, options *ConnectorClientListDryrunOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns" + if subscriptionID == "" { + return nil, errors.New("parameter subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listDryrunHandleResponse handles the ListDryrun response. +func (client *ConnectorClient) listDryrunHandleResponse(resp *http.Response) (ConnectorClientListDryrunResponse, error) { + result := ConnectorClientListDryrunResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DryrunList); err != nil { + return ConnectorClientListDryrunResponse{}, err + } + return result, nil +} + +// BeginUpdate - Operation to update an existing Connector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// subscriptionID - The ID of the target subscription. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// location - The name of Azure region. +// connectorName - The name of resource. +// parameters - Connector details. +// options - ConnectorClientBeginUpdateOptions contains the optional parameters for the ConnectorClient.BeginUpdate method. +func (client *ConnectorClient) BeginUpdate(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, parameters LinkerPatch, options *ConnectorClientBeginUpdateOptions) (*runtime.Poller[ConnectorClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, subscriptionID, resourceGroupName, location, connectorName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectorClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectorClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Operation to update an existing Connector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +func (client *ConnectorClient) update(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, parameters LinkerPatch, options *ConnectorClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, subscriptionID, resourceGroupName, location, connectorName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ConnectorClient) updateCreateRequest(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, parameters LinkerPatch, options *ConnectorClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" + if subscriptionID == "" { + return nil, errors.New("parameter subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginUpdateDryrun - update a dryrun job to do necessary check before actual creation +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// subscriptionID - The ID of the target subscription. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// location - The name of Azure region. +// dryrunName - The name of dryrun. +// parameters - dryrun resource. +// options - ConnectorClientBeginUpdateDryrunOptions contains the optional parameters for the ConnectorClient.BeginUpdateDryrun +// method. +func (client *ConnectorClient) BeginUpdateDryrun(ctx context.Context, subscriptionID string, resourceGroupName string, location string, dryrunName string, parameters DryrunPatch, options *ConnectorClientBeginUpdateDryrunOptions) (*runtime.Poller[ConnectorClientUpdateDryrunResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateDryrun(ctx, subscriptionID, resourceGroupName, location, dryrunName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectorClientUpdateDryrunResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectorClientUpdateDryrunResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateDryrun - update a dryrun job to do necessary check before actual creation +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +func (client *ConnectorClient) updateDryrun(ctx context.Context, subscriptionID string, resourceGroupName string, location string, dryrunName string, parameters DryrunPatch, options *ConnectorClientBeginUpdateDryrunOptions) (*http.Response, error) { + req, err := client.updateDryrunCreateRequest(ctx, subscriptionID, resourceGroupName, location, dryrunName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateDryrunCreateRequest creates the UpdateDryrun request. +func (client *ConnectorClient) updateDryrunCreateRequest(ctx context.Context, subscriptionID string, resourceGroupName string, location string, dryrunName string, parameters DryrunPatch, options *ConnectorClientBeginUpdateDryrunOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" + if subscriptionID == "" { + return nil, errors.New("parameter subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if dryrunName == "" { + return nil, errors.New("parameter dryrunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dryrunName}", url.PathEscape(dryrunName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginValidate - Validate a Connector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// subscriptionID - The ID of the target subscription. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// location - The name of Azure region. +// connectorName - The name of resource. +// options - ConnectorClientBeginValidateOptions contains the optional parameters for the ConnectorClient.BeginValidate method. +func (client *ConnectorClient) BeginValidate(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, options *ConnectorClientBeginValidateOptions) (*runtime.Poller[ConnectorClientValidateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validate(ctx, subscriptionID, resourceGroupName, location, connectorName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectorClientValidateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectorClientValidateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Validate - Validate a Connector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +func (client *ConnectorClient) validate(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, options *ConnectorClientBeginValidateOptions) (*http.Response, error) { + req, err := client.validateCreateRequest(ctx, subscriptionID, resourceGroupName, location, connectorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// validateCreateRequest creates the Validate request. +func (client *ConnectorClient) validateCreateRequest(ctx context.Context, subscriptionID string, resourceGroupName string, location string, connectorName string, options *ConnectorClientBeginValidateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate" + if subscriptionID == "" { + return nil, errors.New("parameter subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_constants.go b/sdk/resourcemanager/servicelinker/armservicelinker/constants.go similarity index 55% rename from sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_constants.go rename to sdk/resourcemanager/servicelinker/armservicelinker/constants.go index bb82b66c87fa..46db6358edd5 100644 --- a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_constants.go +++ b/sdk/resourcemanager/servicelinker/armservicelinker/constants.go @@ -5,25 +5,67 @@ // 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 armservicelinker const ( moduleName = "armservicelinker" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0-beta.1" ) +type AccessKeyPermissions string + +const ( + AccessKeyPermissionsListen AccessKeyPermissions = "Listen" + AccessKeyPermissionsManage AccessKeyPermissions = "Manage" + AccessKeyPermissionsRead AccessKeyPermissions = "Read" + AccessKeyPermissionsSend AccessKeyPermissions = "Send" + AccessKeyPermissionsWrite AccessKeyPermissions = "Write" +) + +// PossibleAccessKeyPermissionsValues returns the possible values for the AccessKeyPermissions const type. +func PossibleAccessKeyPermissionsValues() []AccessKeyPermissions { + return []AccessKeyPermissions{ + AccessKeyPermissionsListen, + AccessKeyPermissionsManage, + AccessKeyPermissionsRead, + AccessKeyPermissionsSend, + AccessKeyPermissionsWrite, + } +} + // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. type ActionType string const ( + ActionTypeEnable ActionType = "enable" ActionTypeInternal ActionType = "Internal" + ActionTypeOptOut ActionType = "optOut" ) // PossibleActionTypeValues returns the possible values for the ActionType const type. func PossibleActionTypeValues() []ActionType { return []ActionType{ + ActionTypeEnable, ActionTypeInternal, + ActionTypeOptOut, + } +} + +// AllowType - Whether to allow firewall rules. +type AllowType string + +const ( + AllowTypeFalse AllowType = "false" + AllowTypeTrue AllowType = "true" +) + +// PossibleAllowTypeValues returns the possible values for the AllowType const type. +func PossibleAllowTypeValues() []AllowType { + return []AllowType{ + AllowTypeFalse, + AllowTypeTrue, } } @@ -31,20 +73,24 @@ func PossibleActionTypeValues() []ActionType { type AuthType string const ( + AuthTypeAccessKey AuthType = "accessKey" AuthTypeSecret AuthType = "secret" AuthTypeServicePrincipalCertificate AuthType = "servicePrincipalCertificate" AuthTypeServicePrincipalSecret AuthType = "servicePrincipalSecret" AuthTypeSystemAssignedIdentity AuthType = "systemAssignedIdentity" + AuthTypeUserAccount AuthType = "userAccount" AuthTypeUserAssignedIdentity AuthType = "userAssignedIdentity" ) // PossibleAuthTypeValues returns the possible values for the AuthType const type. func PossibleAuthTypeValues() []AuthType { return []AuthType{ + AuthTypeAccessKey, AuthTypeSecret, AuthTypeServicePrincipalCertificate, AuthTypeServicePrincipalSecret, AuthTypeSystemAssignedIdentity, + AuthTypeUserAccount, AuthTypeUserAssignedIdentity, } } @@ -67,25 +113,29 @@ func PossibleAzureResourceTypeValues() []AzureResourceType { type ClientType string const ( - ClientTypeDjango ClientType = "django" - ClientTypeDotnet ClientType = "dotnet" - ClientTypeGo ClientType = "go" - ClientTypeJava ClientType = "java" - ClientTypeNodejs ClientType = "nodejs" - ClientTypeNone ClientType = "none" - ClientTypePhp ClientType = "php" - ClientTypePython ClientType = "python" - ClientTypeRuby ClientType = "ruby" - ClientTypeSpringBoot ClientType = "springBoot" + ClientTypeDapr ClientType = "dapr" + ClientTypeDjango ClientType = "django" + ClientTypeDotnet ClientType = "dotnet" + ClientTypeGo ClientType = "go" + ClientTypeJava ClientType = "java" + ClientTypeKafkaSpringBoot ClientType = "kafka-springBoot" + ClientTypeNodejs ClientType = "nodejs" + ClientTypeNone ClientType = "none" + ClientTypePhp ClientType = "php" + ClientTypePython ClientType = "python" + ClientTypeRuby ClientType = "ruby" + ClientTypeSpringBoot ClientType = "springBoot" ) // PossibleClientTypeValues returns the possible values for the ClientType const type. func PossibleClientTypeValues() []ClientType { return []ClientType{ + ClientTypeDapr, ClientTypeDjango, ClientTypeDotnet, ClientTypeGo, ClientTypeJava, + ClientTypeKafkaSpringBoot, ClientTypeNodejs, ClientTypeNone, ClientTypePhp, @@ -115,6 +165,70 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// DeleteOrUpdateBehavior - The cleanup behavior to indicate whether clean up operation when resource is deleted or updated +type DeleteOrUpdateBehavior string + +const ( + DeleteOrUpdateBehaviorDefault DeleteOrUpdateBehavior = "Default" + DeleteOrUpdateBehaviorForcedCleanup DeleteOrUpdateBehavior = "ForcedCleanup" +) + +// PossibleDeleteOrUpdateBehaviorValues returns the possible values for the DeleteOrUpdateBehavior const type. +func PossibleDeleteOrUpdateBehaviorValues() []DeleteOrUpdateBehavior { + return []DeleteOrUpdateBehavior{ + DeleteOrUpdateBehaviorDefault, + DeleteOrUpdateBehaviorForcedCleanup, + } +} + +// DryrunActionName - The name of action for you dryrun job. +type DryrunActionName string + +const ( + DryrunActionNameCreateOrUpdate DryrunActionName = "createOrUpdate" +) + +// PossibleDryrunActionNameValues returns the possible values for the DryrunActionName const type. +func PossibleDryrunActionNameValues() []DryrunActionName { + return []DryrunActionName{ + DryrunActionNameCreateOrUpdate, + } +} + +// DryrunPrerequisiteResultType - The type of dryrun result. +type DryrunPrerequisiteResultType string + +const ( + DryrunPrerequisiteResultTypeBasicError DryrunPrerequisiteResultType = "basicError" + DryrunPrerequisiteResultTypePermissionsMissing DryrunPrerequisiteResultType = "permissionsMissing" +) + +// PossibleDryrunPrerequisiteResultTypeValues returns the possible values for the DryrunPrerequisiteResultType const type. +func PossibleDryrunPrerequisiteResultTypeValues() []DryrunPrerequisiteResultType { + return []DryrunPrerequisiteResultType{ + DryrunPrerequisiteResultTypeBasicError, + DryrunPrerequisiteResultTypePermissionsMissing, + } +} + +// DryrunPreviewOperationType - The operation type +type DryrunPreviewOperationType string + +const ( + DryrunPreviewOperationTypeConfigAuth DryrunPreviewOperationType = "configAuth" + DryrunPreviewOperationTypeConfigConnection DryrunPreviewOperationType = "configConnection" + DryrunPreviewOperationTypeConfigNetwork DryrunPreviewOperationType = "configNetwork" +) + +// PossibleDryrunPreviewOperationTypeValues returns the possible values for the DryrunPreviewOperationType const type. +func PossibleDryrunPreviewOperationTypeValues() []DryrunPreviewOperationType { + return []DryrunPreviewOperationType{ + DryrunPreviewOperationTypeConfigAuth, + DryrunPreviewOperationTypeConfigConnection, + DryrunPreviewOperationTypeConfigNetwork, + } +} + // 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 @@ -159,6 +273,7 @@ const ( TargetServiceTypeAzureResource TargetServiceType = "AzureResource" TargetServiceTypeConfluentBootstrapServer TargetServiceType = "ConfluentBootstrapServer" TargetServiceTypeConfluentSchemaRegistry TargetServiceType = "ConfluentSchemaRegistry" + TargetServiceTypeSelfHostedServer TargetServiceType = "SelfHostedServer" ) // PossibleTargetServiceTypeValues returns the possible values for the TargetServiceType const type. @@ -167,6 +282,7 @@ func PossibleTargetServiceTypeValues() []TargetServiceType { TargetServiceTypeAzureResource, TargetServiceTypeConfluentBootstrapServer, TargetServiceTypeConfluentSchemaRegistry, + TargetServiceTypeSelfHostedServer, } } diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/go.mod b/sdk/resourcemanager/servicelinker/armservicelinker/go.mod index 9350335fc702..002b32a98f95 100644 --- a/sdk/resourcemanager/servicelinker/armservicelinker/go.mod +++ b/sdk/resourcemanager/servicelinker/armservicelinker/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicelinker/armservicelinker +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicelinker/armservicelinker/v2 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.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // 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 + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/go.sum b/sdk/resourcemanager/servicelinker/armservicelinker/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/servicelinker/armservicelinker/go.sum +++ b/sdk/resourcemanager/servicelinker/armservicelinker/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.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= 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.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.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= +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/servicelinker/armservicelinker/zz_generated_linker_client.go b/sdk/resourcemanager/servicelinker/armservicelinker/linker_client.go similarity index 91% rename from sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_linker_client.go rename to sdk/resourcemanager/servicelinker/armservicelinker/linker_client.go index 713c83a0d710..b553aac80c80 100644 --- a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_linker_client.go +++ b/sdk/resourcemanager/servicelinker/armservicelinker/linker_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 armservicelinker @@ -51,9 +52,9 @@ func NewLinkerClient(credential azcore.TokenCredential, options *arm.ClientOptio return client, nil } -// BeginCreateOrUpdate - Create or update linker resource. +// BeginCreateOrUpdate - Create or update Linker resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-11-01-preview // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // linkerName - The name Linker resource. // parameters - Linker details. @@ -73,9 +74,9 @@ func (client *LinkerClient) BeginCreateOrUpdate(ctx context.Context, resourceURI } } -// CreateOrUpdate - Create or update linker resource. +// CreateOrUpdate - Create or update Linker resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-11-01-preview func (client *LinkerClient) createOrUpdate(ctx context.Context, resourceURI string, linkerName string, parameters LinkerResource, options *LinkerClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceURI, linkerName, parameters, options) if err != nil { @@ -104,15 +105,15 @@ func (client *LinkerClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } -// BeginDelete - Delete a link. +// BeginDelete - Delete a Linker. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-11-01-preview // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // linkerName - The name Linker resource. // options - LinkerClientBeginDeleteOptions contains the optional parameters for the LinkerClient.BeginDelete method. @@ -130,9 +131,9 @@ func (client *LinkerClient) BeginDelete(ctx context.Context, resourceURI string, } } -// Delete - Delete a link. +// Delete - Delete a Linker. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-11-01-preview func (client *LinkerClient) deleteOperation(ctx context.Context, resourceURI string, linkerName string, options *LinkerClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceURI, linkerName, options) if err != nil { @@ -161,7 +162,7 @@ func (client *LinkerClient) deleteCreateRequest(ctx context.Context, resourceURI return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -169,7 +170,7 @@ func (client *LinkerClient) deleteCreateRequest(ctx context.Context, resourceURI // Get - Returns Linker resource for a given name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-11-01-preview // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // linkerName - The name Linker resource. // options - LinkerClientGetOptions contains the optional parameters for the LinkerClient.Get method. @@ -201,7 +202,7 @@ func (client *LinkerClient) getCreateRequest(ctx context.Context, resourceURI st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -216,9 +217,9 @@ func (client *LinkerClient) getHandleResponse(resp *http.Response) (LinkerClient return result, nil } -// NewListPager - Returns list of Linkers which connects to the resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// NewListPager - Returns list of Linkers which connects to the resource. which supports to config both application and target +// service during the resource provision. +// Generated from API version 2022-11-01-preview // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // options - LinkerClientListOptions contains the optional parameters for the LinkerClient.List method. func (client *LinkerClient) NewListPager(resourceURI string, options *LinkerClientListOptions) *runtime.Pager[LinkerClientListResponse] { @@ -258,7 +259,7 @@ func (client *LinkerClient) listCreateRequest(ctx context.Context, resourceURI s return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,15 +268,15 @@ func (client *LinkerClient) listCreateRequest(ctx context.Context, resourceURI s // listHandleResponse handles the List response. func (client *LinkerClient) listHandleResponse(resp *http.Response) (LinkerClientListResponse, error) { result := LinkerClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LinkerList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceList); err != nil { return LinkerClientListResponse{}, err } return result, nil } -// ListConfigurations - list source configurations for a linker. +// ListConfigurations - list source configurations for a Linker. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-11-01-preview // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // linkerName - The name Linker resource. // options - LinkerClientListConfigurationsOptions contains the optional parameters for the LinkerClient.ListConfigurations @@ -308,7 +309,7 @@ func (client *LinkerClient) listConfigurationsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -317,15 +318,15 @@ func (client *LinkerClient) listConfigurationsCreateRequest(ctx context.Context, // listConfigurationsHandleResponse handles the ListConfigurations response. func (client *LinkerClient) listConfigurationsHandleResponse(resp *http.Response) (LinkerClientListConfigurationsResponse, error) { result := LinkerClientListConfigurationsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SourceConfigurationResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationResult); err != nil { return LinkerClientListConfigurationsResponse{}, err } return result, nil } -// BeginUpdate - Operation to update an existing link. +// BeginUpdate - Operation to update an existing Linker. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-11-01-preview // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // linkerName - The name Linker resource. // parameters - Linker details. @@ -344,9 +345,9 @@ func (client *LinkerClient) BeginUpdate(ctx context.Context, resourceURI string, } } -// Update - Operation to update an existing link. +// Update - Operation to update an existing Linker. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-11-01-preview func (client *LinkerClient) update(ctx context.Context, resourceURI string, linkerName string, parameters LinkerPatch, options *LinkerClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceURI, linkerName, parameters, options) if err != nil { @@ -375,15 +376,15 @@ func (client *LinkerClient) updateCreateRequest(ctx context.Context, resourceURI return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } -// BeginValidate - Validate a link. +// BeginValidate - Validate a Linker. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-11-01-preview // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // linkerName - The name Linker resource. // options - LinkerClientBeginValidateOptions contains the optional parameters for the LinkerClient.BeginValidate method. @@ -394,16 +395,16 @@ func (client *LinkerClient) BeginValidate(ctx context.Context, resourceURI strin return nil, err } return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LinkerClientValidateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + FinalStateVia: runtime.FinalStateViaLocation, }) } else { return runtime.NewPollerFromResumeToken[LinkerClientValidateResponse](options.ResumeToken, client.pl, nil) } } -// Validate - Validate a link. +// Validate - Validate a Linker. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-11-01-preview func (client *LinkerClient) validate(ctx context.Context, resourceURI string, linkerName string, options *LinkerClientBeginValidateOptions) (*http.Response, error) { req, err := client.validateCreateRequest(ctx, resourceURI, linkerName, options) if err != nil { @@ -432,7 +433,7 @@ func (client *LinkerClient) validateCreateRequest(ctx context.Context, resourceU return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/linkers_client.go b/sdk/resourcemanager/servicelinker/armservicelinker/linkers_client.go new file mode 100644 index 000000000000..c1ac0b3d83f5 --- /dev/null +++ b/sdk/resourcemanager/servicelinker/armservicelinker/linkers_client.go @@ -0,0 +1,369 @@ +//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 armservicelinker + +import ( + "context" + "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" + "net/url" + "strings" +) + +// LinkersClient contains the methods for the Linkers group. +// Don't use this type directly, use NewLinkersClient() instead. +type LinkersClient struct { + host string + pl runtime.Pipeline +} + +// NewLinkersClient creates a new instance of LinkersClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewLinkersClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*LinkersClient, 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) + if err != nil { + return nil, err + } + client := &LinkersClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateDryrun - create a dryrun job to do necessary check before actual creation +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. +// dryrunName - The name of dryrun. +// parameters - dryrun resource. +// options - LinkersClientBeginCreateDryrunOptions contains the optional parameters for the LinkersClient.BeginCreateDryrun +// method. +func (client *LinkersClient) BeginCreateDryrun(ctx context.Context, resourceURI string, dryrunName string, parameters DryrunResource, options *LinkersClientBeginCreateDryrunOptions) (*runtime.Poller[LinkersClientCreateDryrunResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createDryrun(ctx, resourceURI, dryrunName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LinkersClientCreateDryrunResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[LinkersClientCreateDryrunResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateDryrun - create a dryrun job to do necessary check before actual creation +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +func (client *LinkersClient) createDryrun(ctx context.Context, resourceURI string, dryrunName string, parameters DryrunResource, options *LinkersClientBeginCreateDryrunOptions) (*http.Response, error) { + req, err := client.createDryrunCreateRequest(ctx, resourceURI, dryrunName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createDryrunCreateRequest creates the CreateDryrun request. +func (client *LinkersClient) createDryrunCreateRequest(ctx context.Context, resourceURI string, dryrunName string, parameters DryrunResource, options *LinkersClientBeginCreateDryrunOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if dryrunName == "" { + return nil, errors.New("parameter dryrunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dryrunName}", url.PathEscape(dryrunName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// DeleteDryrun - delete a dryrun job +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. +// dryrunName - The name of dryrun. +// options - LinkersClientDeleteDryrunOptions contains the optional parameters for the LinkersClient.DeleteDryrun method. +func (client *LinkersClient) DeleteDryrun(ctx context.Context, resourceURI string, dryrunName string, options *LinkersClientDeleteDryrunOptions) (LinkersClientDeleteDryrunResponse, error) { + req, err := client.deleteDryrunCreateRequest(ctx, resourceURI, dryrunName, options) + if err != nil { + return LinkersClientDeleteDryrunResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LinkersClientDeleteDryrunResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return LinkersClientDeleteDryrunResponse{}, runtime.NewResponseError(resp) + } + return LinkersClientDeleteDryrunResponse{}, nil +} + +// deleteDryrunCreateRequest creates the DeleteDryrun request. +func (client *LinkersClient) deleteDryrunCreateRequest(ctx context.Context, resourceURI string, dryrunName string, options *LinkersClientDeleteDryrunOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if dryrunName == "" { + return nil, errors.New("parameter dryrunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dryrunName}", url.PathEscape(dryrunName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GenerateConfigurations - Generate configurations for a Linker. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. +// linkerName - The name Linker resource. +// options - LinkersClientGenerateConfigurationsOptions contains the optional parameters for the LinkersClient.GenerateConfigurations +// method. +func (client *LinkersClient) GenerateConfigurations(ctx context.Context, resourceURI string, linkerName string, options *LinkersClientGenerateConfigurationsOptions) (LinkersClientGenerateConfigurationsResponse, error) { + req, err := client.generateConfigurationsCreateRequest(ctx, resourceURI, linkerName, options) + if err != nil { + return LinkersClientGenerateConfigurationsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LinkersClientGenerateConfigurationsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LinkersClientGenerateConfigurationsResponse{}, runtime.NewResponseError(resp) + } + return client.generateConfigurationsHandleResponse(resp) +} + +// generateConfigurationsCreateRequest creates the GenerateConfigurations request. +func (client *LinkersClient) generateConfigurationsCreateRequest(ctx context.Context, resourceURI string, linkerName string, options *LinkersClientGenerateConfigurationsOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if linkerName == "" { + return nil, errors.New("parameter linkerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{linkerName}", url.PathEscape(linkerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// generateConfigurationsHandleResponse handles the GenerateConfigurations response. +func (client *LinkersClient) generateConfigurationsHandleResponse(resp *http.Response) (LinkersClientGenerateConfigurationsResponse, error) { + result := LinkersClientGenerateConfigurationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationResult); err != nil { + return LinkersClientGenerateConfigurationsResponse{}, err + } + return result, nil +} + +// GetDryrun - get a dryrun job +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. +// dryrunName - The name of dryrun. +// options - LinkersClientGetDryrunOptions contains the optional parameters for the LinkersClient.GetDryrun method. +func (client *LinkersClient) GetDryrun(ctx context.Context, resourceURI string, dryrunName string, options *LinkersClientGetDryrunOptions) (LinkersClientGetDryrunResponse, error) { + req, err := client.getDryrunCreateRequest(ctx, resourceURI, dryrunName, options) + if err != nil { + return LinkersClientGetDryrunResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LinkersClientGetDryrunResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LinkersClientGetDryrunResponse{}, runtime.NewResponseError(resp) + } + return client.getDryrunHandleResponse(resp) +} + +// getDryrunCreateRequest creates the GetDryrun request. +func (client *LinkersClient) getDryrunCreateRequest(ctx context.Context, resourceURI string, dryrunName string, options *LinkersClientGetDryrunOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if dryrunName == "" { + return nil, errors.New("parameter dryrunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dryrunName}", url.PathEscape(dryrunName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getDryrunHandleResponse handles the GetDryrun response. +func (client *LinkersClient) getDryrunHandleResponse(resp *http.Response) (LinkersClientGetDryrunResponse, error) { + result := LinkersClientGetDryrunResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DryrunResource); err != nil { + return LinkersClientGetDryrunResponse{}, err + } + return result, nil +} + +// NewListDryrunPager - list dryrun jobs +// Generated from API version 2022-11-01-preview +// resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. +// options - LinkersClientListDryrunOptions contains the optional parameters for the LinkersClient.ListDryrun method. +func (client *LinkersClient) NewListDryrunPager(resourceURI string, options *LinkersClientListDryrunOptions) *runtime.Pager[LinkersClientListDryrunResponse] { + return runtime.NewPager(runtime.PagingHandler[LinkersClientListDryrunResponse]{ + More: func(page LinkersClientListDryrunResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LinkersClientListDryrunResponse) (LinkersClientListDryrunResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listDryrunCreateRequest(ctx, resourceURI, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LinkersClientListDryrunResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LinkersClientListDryrunResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LinkersClientListDryrunResponse{}, runtime.NewResponseError(resp) + } + return client.listDryrunHandleResponse(resp) + }, + }) +} + +// listDryrunCreateRequest creates the ListDryrun request. +func (client *LinkersClient) listDryrunCreateRequest(ctx context.Context, resourceURI string, options *LinkersClientListDryrunOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listDryrunHandleResponse handles the ListDryrun response. +func (client *LinkersClient) listDryrunHandleResponse(resp *http.Response) (LinkersClientListDryrunResponse, error) { + result := LinkersClientListDryrunResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DryrunList); err != nil { + return LinkersClientListDryrunResponse{}, err + } + return result, nil +} + +// BeginUpdateDryrun - add a dryrun job to do necessary check before actual creation +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +// resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. +// dryrunName - The name of dryrun. +// parameters - dryrun resource. +// options - LinkersClientBeginUpdateDryrunOptions contains the optional parameters for the LinkersClient.BeginUpdateDryrun +// method. +func (client *LinkersClient) BeginUpdateDryrun(ctx context.Context, resourceURI string, dryrunName string, parameters DryrunPatch, options *LinkersClientBeginUpdateDryrunOptions) (*runtime.Poller[LinkersClientUpdateDryrunResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateDryrun(ctx, resourceURI, dryrunName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LinkersClientUpdateDryrunResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[LinkersClientUpdateDryrunResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateDryrun - add a dryrun job to do necessary check before actual creation +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01-preview +func (client *LinkersClient) updateDryrun(ctx context.Context, resourceURI string, dryrunName string, parameters DryrunPatch, options *LinkersClientBeginUpdateDryrunOptions) (*http.Response, error) { + req, err := client.updateDryrunCreateRequest(ctx, resourceURI, dryrunName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateDryrunCreateRequest creates the UpdateDryrun request. +func (client *LinkersClient) updateDryrunCreateRequest(ctx context.Context, resourceURI string, dryrunName string, parameters DryrunPatch, options *LinkersClientBeginUpdateDryrunOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if dryrunName == "" { + return nil, errors.New("parameter dryrunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dryrunName}", url.PathEscape(dryrunName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_models.go b/sdk/resourcemanager/servicelinker/armservicelinker/models.go similarity index 50% rename from sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_models.go rename to sdk/resourcemanager/servicelinker/armservicelinker/models.go index 8c974a4187dc..d2743d1a3adf 100644 --- a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_models.go +++ b/sdk/resourcemanager/servicelinker/armservicelinker/models.go @@ -5,16 +5,35 @@ // 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 armservicelinker import "time" +// AccessKeyInfoBase - The access key directly from target resource properties, which target service is Azure Resource, such +// as Microsoft.Storage +type AccessKeyInfoBase struct { + // REQUIRED; The authentication type. + AuthType *AuthType `json:"authType,omitempty"` + + // Permissions of the accessKey. Read and Write are for Azure Cosmos DB and Azure App Configuration, Listen, Send and Manage + // are for Azure Event Hub and Azure Service Bus. + Permissions []*AccessKeyPermissions `json:"permissions,omitempty"` +} + +// GetAuthInfoBase implements the AuthInfoBaseClassification interface for type AccessKeyInfoBase. +func (a *AccessKeyInfoBase) GetAuthInfoBase() *AuthInfoBase { + return &AuthInfoBase{ + AuthType: a.AuthType, + } +} + // AuthInfoBaseClassification provides polymorphic access to related types. // Call the interface's GetAuthInfoBase() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *AuthInfoBase, *SecretAuthInfo, *ServicePrincipalCertificateAuthInfo, *ServicePrincipalSecretAuthInfo, *SystemAssignedIdentityAuthInfo, -// - *UserAssignedIdentityAuthInfo +// - *AccessKeyInfoBase, *AuthInfoBase, *SecretAuthInfo, *ServicePrincipalCertificateAuthInfo, *ServicePrincipalSecretAuthInfo, +// - *SystemAssignedIdentityAuthInfo, *UserAccountAuthInfo, *UserAssignedIdentityAuthInfo type AuthInfoBaseClassification interface { // GetAuthInfoBase returns the AuthInfoBase content of the underlying type. GetAuthInfoBase() *AuthInfoBase @@ -84,6 +103,104 @@ func (a *AzureResourcePropertiesBase) GetAzureResourcePropertiesBase() *AzureRes return a } +// BasicErrorDryrunPrerequisiteResult - The represent of basic error +type BasicErrorDryrunPrerequisiteResult struct { + // REQUIRED; The type of dryrun result. + Type *DryrunPrerequisiteResultType `json:"type,omitempty"` + + // The error code. + Code *string `json:"code,omitempty"` + + // The error message. + Message *string `json:"message,omitempty"` +} + +// GetDryrunPrerequisiteResult implements the DryrunPrerequisiteResultClassification interface for type BasicErrorDryrunPrerequisiteResult. +func (b *BasicErrorDryrunPrerequisiteResult) GetDryrunPrerequisiteResult() *DryrunPrerequisiteResult { + return &DryrunPrerequisiteResult{ + Type: b.Type, + } +} + +// ConfigurationInfo - The configuration information, used to generate configurations or save to applications +type ConfigurationInfo struct { + // Optional, indicate whether to apply configurations on source application. If enable, generate configurations and applied + // to the source application. Default is enable. If optOut, no configuration + // change will be made on source. + Action *ActionType `json:"action,omitempty"` + + // A dictionary of additional configurations to be added. Service will auto generate a set of basic configurations and this + // property is to full fill more customized configurations + AdditionalConfigurations map[string]*string `json:"additionalConfigurations,omitempty"` + + // Optional. A dictionary of default key name and customized key name mapping. If not specified, default key name will be + // used for generate configurations + CustomizedKeys map[string]*string `json:"customizedKeys,omitempty"` + + // Indicates some additional properties for dapr client type + DaprProperties *DaprProperties `json:"daprProperties,omitempty"` + + // Indicates whether to clean up previous operation when Linker is updating or deleting + DeleteOrUpdateBehavior *DeleteOrUpdateBehavior `json:"deleteOrUpdateBehavior,omitempty"` +} + +// ConfigurationName - The configuration names. +type ConfigurationName struct { + // Description for the configuration name. + Description *string `json:"description,omitempty"` + + // Represent the configuration is required or not + Required *bool `json:"required,omitempty"` + Value *string `json:"value,omitempty"` +} + +type ConfigurationNameItem struct { + // The result detail. + Properties *ConfigurationNames `json:"properties,omitempty"` +} + +// ConfigurationNameResult - Configuration Name list which will be set based on different target resource, client type, auth +// type. +type ConfigurationNameResult struct { + // Expected configuration names for each target service. + Value []*ConfigurationNameItem `json:"value,omitempty"` + + // READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ConfigurationNames - The configuration names which will be set based on specific target resource, client type, auth type. +type ConfigurationNames struct { + // The auth type. + AuthType *AuthType `json:"authType,omitempty"` + + // The client type for configuration names. + ClientType *ClientType `json:"clientType,omitempty"` + + // Indicates some additional properties for dapr client type + DaprProperties *DaprProperties `json:"daprProperties,omitempty"` + + // The configuration names to be set in compute service environment. + Names []*ConfigurationName `json:"names,omitempty"` + + // The target service provider name and resource name. + TargetService *string `json:"targetService,omitempty"` +} + +// ConfigurationNamesClientListOptions contains the optional parameters for the ConfigurationNamesClient.List method. +type ConfigurationNamesClientListOptions struct { + // OData filter options. + Filter *string + // OData skipToken option for pagination. + SkipToken *string +} + +// ConfigurationResult - Configurations for source resource, include appSettings, connectionString and serviceBindings +type ConfigurationResult struct { + // The configuration properties for source resource. + Configurations []*SourceConfiguration `json:"configurations,omitempty"` +} + // ConfluentBootstrapServer - The service properties when target service type is ConfluentBootstrapServer type ConfluentBootstrapServer struct { // REQUIRED; The target service type. @@ -116,6 +233,253 @@ func (c *ConfluentSchemaRegistry) GetTargetServiceBase() *TargetServiceBase { } } +// ConnectorClientBeginCreateDryrunOptions contains the optional parameters for the ConnectorClient.BeginCreateDryrun method. +type ConnectorClientBeginCreateDryrunOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectorClientBeginCreateOrUpdateOptions contains the optional parameters for the ConnectorClient.BeginCreateOrUpdate +// method. +type ConnectorClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectorClientBeginDeleteOptions contains the optional parameters for the ConnectorClient.BeginDelete method. +type ConnectorClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectorClientBeginUpdateDryrunOptions contains the optional parameters for the ConnectorClient.BeginUpdateDryrun method. +type ConnectorClientBeginUpdateDryrunOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectorClientBeginUpdateOptions contains the optional parameters for the ConnectorClient.BeginUpdate method. +type ConnectorClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectorClientBeginValidateOptions contains the optional parameters for the ConnectorClient.BeginValidate method. +type ConnectorClientBeginValidateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectorClientDeleteDryrunOptions contains the optional parameters for the ConnectorClient.DeleteDryrun method. +type ConnectorClientDeleteDryrunOptions struct { + // placeholder for future optional parameters +} + +// ConnectorClientGenerateConfigurationsOptions contains the optional parameters for the ConnectorClient.GenerateConfigurations +// method. +type ConnectorClientGenerateConfigurationsOptions struct { + // Connection Info, including format, secret store, etc + Parameters *ConfigurationInfo +} + +// ConnectorClientGetDryrunOptions contains the optional parameters for the ConnectorClient.GetDryrun method. +type ConnectorClientGetDryrunOptions struct { + // placeholder for future optional parameters +} + +// ConnectorClientGetOptions contains the optional parameters for the ConnectorClient.Get method. +type ConnectorClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectorClientListDryrunOptions contains the optional parameters for the ConnectorClient.ListDryrun method. +type ConnectorClientListDryrunOptions struct { + // placeholder for future optional parameters +} + +// ConnectorClientListOptions contains the optional parameters for the ConnectorClient.List method. +type ConnectorClientListOptions struct { + // placeholder for future optional parameters +} + +// CreateOrUpdateDryrunParameters - The dryrun parameters for creation or update a linker +type CreateOrUpdateDryrunParameters struct { + // REQUIRED; The name of action for you dryrun job. + ActionName *DryrunActionName `json:"actionName,omitempty"` + + // The authentication type. + AuthInfo AuthInfoBaseClassification `json:"authInfo,omitempty"` + + // The application client type + ClientType *ClientType `json:"clientType,omitempty"` + + // The connection information consumed by applications, including secrets, connection strings. + ConfigurationInfo *ConfigurationInfo `json:"configurationInfo,omitempty"` + + // The network solution. + PublicNetworkSolution *PublicNetworkSolution `json:"publicNetworkSolution,omitempty"` + + // connection scope in source service. + Scope *string `json:"scope,omitempty"` + + // An option to store secret value in secure place + SecretStore *SecretStore `json:"secretStore,omitempty"` + + // The target service properties + TargetService TargetServiceBaseClassification `json:"targetService,omitempty"` + + // The VNet solution. + VNetSolution *VNetSolution `json:"vNetSolution,omitempty"` + + // READ-ONLY; The provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// GetDryrunParameters implements the DryrunParametersClassification interface for type CreateOrUpdateDryrunParameters. +func (c *CreateOrUpdateDryrunParameters) GetDryrunParameters() *DryrunParameters { + return &DryrunParameters{ + ActionName: c.ActionName, + } +} + +// DaprMetadata - The dapr component metadata. +type DaprMetadata struct { + // Metadata property name. + Name *string `json:"name,omitempty"` + + // The secret name where dapr could get value + SecretRef *string `json:"secretRef,omitempty"` + + // Metadata property value. + Value *string `json:"value,omitempty"` +} + +// DaprProperties - Indicates some additional properties for dapr client type +type DaprProperties struct { + // The dapr component type + ComponentType *string `json:"componentType,omitempty"` + + // Additional dapr metadata + Metadata []*DaprMetadata `json:"metadata,omitempty"` + + // The dapr component scopes + Scopes []*string `json:"scopes,omitempty"` + + // The name of a secret store dapr to retrieve secret + SecretStoreComponent *string `json:"secretStoreComponent,omitempty"` + + // The dapr component version + Version *string `json:"version,omitempty"` +} + +// DatabaseAADAuthInfo - The extra auth info required by Database AAD authentication. +type DatabaseAADAuthInfo struct { + // Username created in the database which is mapped to a user in AAD. + UserName *string `json:"userName,omitempty"` +} + +// DryrunList - The list of dryrun. +type DryrunList struct { + // The link used to get the next page of dryrun list. + NextLink *string `json:"nextLink,omitempty"` + + // The list of dryrun. + Value []*DryrunResource `json:"value,omitempty"` +} + +// DryrunOperationPreview - The preview of the operations for creation +type DryrunOperationPreview struct { + // The action defined by RBAC, refer https://docs.microsoft.com/azure/role-based-access-control/role-definitions#actions-format + Action *string `json:"action,omitempty"` + + // The description of the operation + Description *string `json:"description,omitempty"` + + // The operation name + Name *string `json:"name,omitempty"` + + // The operation type + OperationType *DryrunPreviewOperationType `json:"operationType,omitempty"` + + // The scope of the operation, refer https://docs.microsoft.com/azure/role-based-access-control/scope-overview + Scope *string `json:"scope,omitempty"` +} + +// DryrunParametersClassification provides polymorphic access to related types. +// Call the interface's GetDryrunParameters() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *CreateOrUpdateDryrunParameters, *DryrunParameters +type DryrunParametersClassification interface { + // GetDryrunParameters returns the DryrunParameters content of the underlying type. + GetDryrunParameters() *DryrunParameters +} + +// DryrunParameters - The parameters of the dryrun +type DryrunParameters struct { + // REQUIRED; The name of action for you dryrun job. + ActionName *DryrunActionName `json:"actionName,omitempty"` +} + +// GetDryrunParameters implements the DryrunParametersClassification interface for type DryrunParameters. +func (d *DryrunParameters) GetDryrunParameters() *DryrunParameters { return d } + +// DryrunPatch - a dryrun job to be updated. +type DryrunPatch struct { + // The properties of the dryrun job. + Properties *DryrunProperties `json:"properties,omitempty"` +} + +// DryrunPrerequisiteResultClassification provides polymorphic access to related types. +// Call the interface's GetDryrunPrerequisiteResult() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BasicErrorDryrunPrerequisiteResult, *DryrunPrerequisiteResult, *PermissionsMissingDryrunPrerequisiteResult +type DryrunPrerequisiteResultClassification interface { + // GetDryrunPrerequisiteResult returns the DryrunPrerequisiteResult content of the underlying type. + GetDryrunPrerequisiteResult() *DryrunPrerequisiteResult +} + +// DryrunPrerequisiteResult - A result of dryrun +type DryrunPrerequisiteResult struct { + // REQUIRED; The type of dryrun result. + Type *DryrunPrerequisiteResultType `json:"type,omitempty"` +} + +// GetDryrunPrerequisiteResult implements the DryrunPrerequisiteResultClassification interface for type DryrunPrerequisiteResult. +func (d *DryrunPrerequisiteResult) GetDryrunPrerequisiteResult() *DryrunPrerequisiteResult { return d } + +// DryrunProperties - The properties of the dryrun job +type DryrunProperties struct { + // The parameters of the dryrun + Parameters DryrunParametersClassification `json:"parameters,omitempty"` + + // READ-ONLY; the preview of the operations for creation + OperationPreviews []*DryrunOperationPreview `json:"operationPreviews,omitempty" azure:"ro"` + + // READ-ONLY; the result of the dryrun + PrerequisiteResults []DryrunPrerequisiteResultClassification `json:"prerequisiteResults,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// DryrunResource - a dryrun job resource +type DryrunResource struct { + // The properties of the dryrun job. + Properties *DryrunProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -150,6 +514,20 @@ type ErrorResponse struct { Error *ErrorDetail `json:"error,omitempty"` } +// FirewallRules - Target service's firewall rules. to allow connections from source service. +type FirewallRules struct { + // Allow Azure services to access the target service if true. + AzureServices *AllowType `json:"azureServices,omitempty"` + + // Allow caller client IP to access the target service if true. the property is used when connecting local application to + // target service. + CallerClientIP *AllowType `json:"callerClientIP,omitempty"` + + // This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client + // IPs for a given database account. + IPRanges []*string `json:"ipRanges,omitempty"` +} + // KeyVaultSecretReferenceSecretInfo - The secret info when type is keyVaultSecretReference. It's for scenario that user provides // a secret stored in user's keyvault and source is Azure Kubernetes. The key Vault's resource id is linked to // secretStore.keyVaultId. @@ -227,22 +605,13 @@ type LinkerClientListOptions struct { // placeholder for future optional parameters } -// LinkerList - The list of Linker. -type LinkerList struct { - // The link used to get the next page of Linker list. - NextLink *string `json:"nextLink,omitempty"` - - // The list of Linkers. - Value []*LinkerResource `json:"value,omitempty"` -} - -// LinkerPatch - A linker to be updated. +// LinkerPatch - A Linker to be updated. type LinkerPatch struct { // Linker properties Properties *LinkerProperties `json:"properties,omitempty"` } -// LinkerProperties - The properties of the linker. +// LinkerProperties - The properties of the Linker. type LinkerProperties struct { // The authentication type. AuthInfo AuthInfoBaseClassification `json:"authInfo,omitempty"` @@ -250,6 +619,12 @@ type LinkerProperties struct { // The application client type ClientType *ClientType `json:"clientType,omitempty"` + // The connection information consumed by applications, including secrets, connection strings. + ConfigurationInfo *ConfigurationInfo `json:"configurationInfo,omitempty"` + + // The network solution. + PublicNetworkSolution *PublicNetworkSolution `json:"publicNetworkSolution,omitempty"` + // connection scope in source service. Scope *string `json:"scope,omitempty"` @@ -268,7 +643,7 @@ type LinkerProperties struct { // LinkerResource - Linker of source and target resource type LinkerResource struct { - // REQUIRED; The properties of the linker. + // REQUIRED; The properties of the Linker. Properties *LinkerProperties `json:"properties,omitempty"` // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} @@ -277,13 +652,47 @@ type LinkerResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The system data. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } +// LinkersClientBeginCreateDryrunOptions contains the optional parameters for the LinkersClient.BeginCreateDryrun method. +type LinkersClientBeginCreateDryrunOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LinkersClientBeginUpdateDryrunOptions contains the optional parameters for the LinkersClient.BeginUpdateDryrun method. +type LinkersClientBeginUpdateDryrunOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LinkersClientDeleteDryrunOptions contains the optional parameters for the LinkersClient.DeleteDryrun method. +type LinkersClientDeleteDryrunOptions struct { + // placeholder for future optional parameters +} + +// LinkersClientGenerateConfigurationsOptions contains the optional parameters for the LinkersClient.GenerateConfigurations +// method. +type LinkersClientGenerateConfigurationsOptions struct { + // Connection Info, including format, secret store, etc + Parameters *ConfigurationInfo +} + +// LinkersClientGetDryrunOptions contains the optional parameters for the LinkersClient.GetDryrun method. +type LinkersClientGetDryrunOptions struct { + // placeholder for future optional parameters +} + +// LinkersClientListDryrunOptions contains the optional parameters for the LinkersClient.ListDryrun method. +type LinkersClientListDryrunOptions struct { + // placeholder for future optional parameters +} + // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. @@ -338,6 +747,28 @@ type OperationsClientListOptions struct { // placeholder for future optional parameters } +// PermissionsMissingDryrunPrerequisiteResult - The represent of missing permissions +type PermissionsMissingDryrunPrerequisiteResult struct { + // REQUIRED; The type of dryrun result. + Type *DryrunPrerequisiteResultType `json:"type,omitempty"` + + // The permission list + Permissions []*string `json:"permissions,omitempty"` + + // The recommended role to resolve permissions missing + RecommendedRole *string `json:"recommendedRole,omitempty"` + + // The permission scope + Scope *string `json:"scope,omitempty"` +} + +// GetDryrunPrerequisiteResult implements the DryrunPrerequisiteResultClassification interface for type PermissionsMissingDryrunPrerequisiteResult. +func (p *PermissionsMissingDryrunPrerequisiteResult) GetDryrunPrerequisiteResult() *DryrunPrerequisiteResult { + return &DryrunPrerequisiteResult{ + Type: p.Type, + } +} + // ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a // location type ProxyResource struct { @@ -347,10 +778,26 @@ type ProxyResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } +// PublicNetworkSolution - Indicates public network solution, include firewall rules +type PublicNetworkSolution struct { + // Optional. Indicates public network solution. If enable, enable public network access of target service with best try. Default + // is enable. If optOut, opt out public network access configuration. + Action *ActionType `json:"action,omitempty"` + + // Indicates whether to clean up previous operation(such as firewall rules) when Linker is updating or deleting + DeleteOrUpdateBehavior *DeleteOrUpdateBehavior `json:"deleteOrUpdateBehavior,omitempty"` + + // Describe firewall rules of target service to make sure source application could connect to the target. + FirewallRules *FirewallRules `json:"firewallRules,omitempty"` +} + // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} @@ -359,10 +806,22 @@ type Resource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } +// ResourceList - The list of Linker. +type ResourceList struct { + // The Linker used to get the next page of Linker list. + NextLink *string `json:"nextLink,omitempty"` + + // The list of Linkers. + Value []*LinkerResource `json:"value,omitempty"` +} + // SecretAuthInfo - The authentication info when authType is secret type SecretAuthInfo struct { // REQUIRED; The authentication type. @@ -404,6 +863,25 @@ func (s *SecretInfoBase) GetSecretInfoBase() *SecretInfoBase { return s } type SecretStore struct { // The key vault id to store secret KeyVaultID *string `json:"keyVaultId,omitempty"` + + // The key vault secret name to store secret, only valid when storing one secret + KeyVaultSecretName *string `json:"keyVaultSecretName,omitempty"` +} + +// SelfHostedServer - The service properties when target service type is SelfHostedServer +type SelfHostedServer struct { + // REQUIRED; The target service type. + Type *TargetServiceType `json:"type,omitempty"` + + // The endpoint of service. + Endpoint *string `json:"endpoint,omitempty"` +} + +// GetTargetServiceBase implements the TargetServiceBaseClassification interface for type SelfHostedServer. +func (s *SelfHostedServer) GetTargetServiceBase() *TargetServiceBase { + return &TargetServiceBase{ + Type: s.Type, + } } // ServicePrincipalCertificateAuthInfo - The authentication info when authType is servicePrincipal certificate @@ -419,6 +897,12 @@ type ServicePrincipalCertificateAuthInfo struct { // REQUIRED; Principal Id for servicePrincipal auth. PrincipalID *string `json:"principalId,omitempty"` + + // Indicates whether to clean up previous operation when Linker is updating or deleting + DeleteOrUpdateBehavior *DeleteOrUpdateBehavior `json:"deleteOrUpdateBehavior,omitempty"` + + // Optional, this value specifies the Azure roles to be assigned. Automatically + Roles []*string `json:"roles,omitempty"` } // GetAuthInfoBase implements the AuthInfoBaseClassification interface for type ServicePrincipalCertificateAuthInfo. @@ -441,6 +925,15 @@ type ServicePrincipalSecretAuthInfo struct { // REQUIRED; Secret for servicePrincipal auth. Secret *string `json:"secret,omitempty"` + + // Indicates whether to clean up previous operation when Linker is updating or deleting + DeleteOrUpdateBehavior *DeleteOrUpdateBehavior `json:"deleteOrUpdateBehavior,omitempty"` + + // Optional, this value specifies the Azure roles to be assigned. Automatically + Roles []*string `json:"roles,omitempty"` + + // Username created in the database which is mapped to a user in AAD. + UserName *string `json:"userName,omitempty"` } // GetAuthInfoBase implements the AuthInfoBaseClassification interface for type ServicePrincipalSecretAuthInfo. @@ -459,16 +952,19 @@ type SourceConfiguration struct { Value *string `json:"value,omitempty"` } -// SourceConfigurationResult - Configurations for source resource, include appSettings, connectionString and serviceBindings -type SourceConfigurationResult struct { - // The configuration properties for source resource. - Configurations []*SourceConfiguration `json:"configurations,omitempty"` -} - // SystemAssignedIdentityAuthInfo - The authentication info when authType is systemAssignedIdentity type SystemAssignedIdentityAuthInfo struct { // REQUIRED; The authentication type. AuthType *AuthType `json:"authType,omitempty"` + + // Indicates whether to clean up previous operation when Linker is updating or deleting + DeleteOrUpdateBehavior *DeleteOrUpdateBehavior `json:"deleteOrUpdateBehavior,omitempty"` + + // Optional, this value specifies the Azure role to be assigned + Roles []*string `json:"roles,omitempty"` + + // Username created in the database which is mapped to a user in AAD. + UserName *string `json:"userName,omitempty"` } // GetAuthInfoBase implements the AuthInfoBaseClassification interface for type SystemAssignedIdentityAuthInfo. @@ -502,7 +998,7 @@ type SystemData struct { // TargetServiceBaseClassification provides polymorphic access to related types. // Call the interface's GetTargetServiceBase() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *AzureResource, *ConfluentBootstrapServer, *ConfluentSchemaRegistry, *TargetServiceBase +// - *AzureResource, *ConfluentBootstrapServer, *ConfluentSchemaRegistry, *SelfHostedServer, *TargetServiceBase type TargetServiceBaseClassification interface { // GetTargetServiceBase returns the TargetServiceBase content of the underlying type. GetTargetServiceBase() *TargetServiceBase @@ -517,6 +1013,31 @@ type TargetServiceBase struct { // GetTargetServiceBase implements the TargetServiceBaseClassification interface for type TargetServiceBase. func (t *TargetServiceBase) GetTargetServiceBase() *TargetServiceBase { return t } +// UserAccountAuthInfo - The authentication info when authType is user account +type UserAccountAuthInfo struct { + // REQUIRED; The authentication type. + AuthType *AuthType `json:"authType,omitempty"` + + // Indicates whether to clean up previous operation when Linker is updating or deleting + DeleteOrUpdateBehavior *DeleteOrUpdateBehavior `json:"deleteOrUpdateBehavior,omitempty"` + + // Principal Id for user account. + PrincipalID *string `json:"principalId,omitempty"` + + // Optional, this value specifies the Azure roles to be assigned. Automatically + Roles []*string `json:"roles,omitempty"` + + // Username created in the database which is mapped to a user in AAD. + UserName *string `json:"userName,omitempty"` +} + +// GetAuthInfoBase implements the AuthInfoBaseClassification interface for type UserAccountAuthInfo. +func (u *UserAccountAuthInfo) GetAuthInfoBase() *AuthInfoBase { + return &AuthInfoBase{ + AuthType: u.AuthType, + } +} + // UserAssignedIdentityAuthInfo - The authentication info when authType is userAssignedIdentity type UserAssignedIdentityAuthInfo struct { // REQUIRED; The authentication type. @@ -525,8 +1046,17 @@ type UserAssignedIdentityAuthInfo struct { // Client Id for userAssignedIdentity. ClientID *string `json:"clientId,omitempty"` + // Indicates whether to clean up previous operation when Linker is updating or deleting + DeleteOrUpdateBehavior *DeleteOrUpdateBehavior `json:"deleteOrUpdateBehavior,omitempty"` + + // Optional, this value specifies the Azure role to be assigned + Roles []*string `json:"roles,omitempty"` + // Subscription id for userAssignedIdentity. SubscriptionID *string `json:"subscriptionId,omitempty"` + + // Username created in the database which is mapped to a user in AAD. + UserName *string `json:"userName,omitempty"` } // GetAuthInfoBase implements the AuthInfoBaseClassification interface for type UserAssignedIdentityAuthInfo. @@ -538,23 +1068,26 @@ func (u *UserAssignedIdentityAuthInfo) GetAuthInfoBase() *AuthInfoBase { // VNetSolution - The VNet solution for linker type VNetSolution struct { + // Indicates whether to clean up previous operation when Linker is updating or deleting + DeleteOrUpdateBehavior *DeleteOrUpdateBehavior `json:"deleteOrUpdateBehavior,omitempty"` + // Type of VNet solution. Type *VNetSolutionType `json:"type,omitempty"` } -// ValidateOperationResult - The validation operation result for a linker. +// ValidateOperationResult - The validation operation result for a Linker. type ValidateOperationResult struct { // The validation result detail. Properties *ValidateResult `json:"properties,omitempty"` - // Validated linker id. + // Validated Linker id. ResourceID *string `json:"resourceId,omitempty"` // Validation operation status. Status *string `json:"status,omitempty"` } -// ValidateResult - The validation result for a linker. +// ValidateResult - The validation result for a Linker. type ValidateResult struct { // The authentication type. AuthType *AuthType `json:"authType,omitempty"` @@ -571,7 +1104,7 @@ type ValidateResult struct { // The start time of the validation report. ReportStartTimeUTC *time.Time `json:"reportStartTimeUtc,omitempty"` - // The resource id of the linker source application. + // The resource id of the Linker source application. SourceID *string `json:"sourceId,omitempty"` // The resource Id of target service. @@ -581,7 +1114,7 @@ type ValidateResult struct { ValidationDetail []*ValidationResultItem `json:"validationDetail,omitempty"` } -// ValidationResultItem - The validation item for a linker. +// ValidationResultItem - The validation item for a Linker. type ValidationResultItem struct { // The display name of validation item Description *string `json:"description,omitempty"` diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/models_serde.go b/sdk/resourcemanager/servicelinker/armservicelinker/models_serde.go new file mode 100644 index 000000000000..246f35861273 --- /dev/null +++ b/sdk/resourcemanager/servicelinker/armservicelinker/models_serde.go @@ -0,0 +1,2174 @@ +//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 armservicelinker + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AccessKeyInfoBase. +func (a AccessKeyInfoBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["authType"] = AuthTypeAccessKey + populate(objectMap, "permissions", a.Permissions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessKeyInfoBase. +func (a *AccessKeyInfoBase) 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 "authType": + err = unpopulate(val, "AuthType", &a.AuthType) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, "Permissions", &a.Permissions) + 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 AuthInfoBase. +func (a AuthInfoBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["authType"] = a.AuthType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthInfoBase. +func (a *AuthInfoBase) 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 "authType": + err = unpopulate(val, "AuthType", &a.AuthType) + 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 AzureKeyVaultProperties. +func (a AzureKeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectAsKubernetesCsiDriver", a.ConnectAsKubernetesCsiDriver) + objectMap["type"] = AzureResourceTypeKeyVault + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureKeyVaultProperties. +func (a *AzureKeyVaultProperties) 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 "connectAsKubernetesCsiDriver": + err = unpopulate(val, "ConnectAsKubernetesCsiDriver", &a.ConnectAsKubernetesCsiDriver) + 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 AzureResource. +func (a AzureResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "resourceProperties", a.ResourceProperties) + objectMap["type"] = TargetServiceTypeAzureResource + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResource. +func (a *AzureResource) 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 "resourceProperties": + a.ResourceProperties, err = unmarshalAzureResourcePropertiesBaseClassification(val) + 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 AzureResourcePropertiesBase. +func (a AzureResourcePropertiesBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["type"] = a.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourcePropertiesBase. +func (a *AzureResourcePropertiesBase) 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 "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 BasicErrorDryrunPrerequisiteResult. +func (b BasicErrorDryrunPrerequisiteResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", b.Code) + populate(objectMap, "message", b.Message) + objectMap["type"] = DryrunPrerequisiteResultTypeBasicError + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BasicErrorDryrunPrerequisiteResult. +func (b *BasicErrorDryrunPrerequisiteResult) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &b.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &b.Message) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationInfo. +func (c ConfigurationInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", c.Action) + populate(objectMap, "additionalConfigurations", c.AdditionalConfigurations) + populate(objectMap, "customizedKeys", c.CustomizedKeys) + populate(objectMap, "daprProperties", c.DaprProperties) + populate(objectMap, "deleteOrUpdateBehavior", c.DeleteOrUpdateBehavior) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationInfo. +func (c *ConfigurationInfo) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &c.Action) + delete(rawMsg, key) + case "additionalConfigurations": + err = unpopulate(val, "AdditionalConfigurations", &c.AdditionalConfigurations) + delete(rawMsg, key) + case "customizedKeys": + err = unpopulate(val, "CustomizedKeys", &c.CustomizedKeys) + delete(rawMsg, key) + case "daprProperties": + err = unpopulate(val, "DaprProperties", &c.DaprProperties) + delete(rawMsg, key) + case "deleteOrUpdateBehavior": + err = unpopulate(val, "DeleteOrUpdateBehavior", &c.DeleteOrUpdateBehavior) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationName. +func (c ConfigurationName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", c.Description) + populate(objectMap, "required", c.Required) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationName. +func (c *ConfigurationName) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "required": + err = unpopulate(val, "Required", &c.Required) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationNameItem. +func (c ConfigurationNameItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationNameItem. +func (c *ConfigurationNameItem) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationNameResult. +func (c ConfigurationNameResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationNameResult. +func (c *ConfigurationNameResult) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationNames. +func (c ConfigurationNames) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authType", c.AuthType) + populate(objectMap, "clientType", c.ClientType) + populate(objectMap, "daprProperties", c.DaprProperties) + populate(objectMap, "names", c.Names) + populate(objectMap, "targetService", c.TargetService) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationNames. +func (c *ConfigurationNames) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authType": + err = unpopulate(val, "AuthType", &c.AuthType) + delete(rawMsg, key) + case "clientType": + err = unpopulate(val, "ClientType", &c.ClientType) + delete(rawMsg, key) + case "daprProperties": + err = unpopulate(val, "DaprProperties", &c.DaprProperties) + delete(rawMsg, key) + case "names": + err = unpopulate(val, "Names", &c.Names) + delete(rawMsg, key) + case "targetService": + err = unpopulate(val, "TargetService", &c.TargetService) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationResult. +func (c ConfigurationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configurations", c.Configurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationResult. +func (c *ConfigurationResult) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configurations": + err = unpopulate(val, "Configurations", &c.Configurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfluentBootstrapServer. +func (c ConfluentBootstrapServer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpoint", c.Endpoint) + objectMap["type"] = TargetServiceTypeConfluentBootstrapServer + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfluentBootstrapServer. +func (c *ConfluentBootstrapServer) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpoint": + err = unpopulate(val, "Endpoint", &c.Endpoint) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfluentSchemaRegistry. +func (c ConfluentSchemaRegistry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpoint", c.Endpoint) + objectMap["type"] = TargetServiceTypeConfluentSchemaRegistry + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfluentSchemaRegistry. +func (c *ConfluentSchemaRegistry) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpoint": + err = unpopulate(val, "Endpoint", &c.Endpoint) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CreateOrUpdateDryrunParameters. +func (c CreateOrUpdateDryrunParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["actionName"] = DryrunActionNameCreateOrUpdate + populate(objectMap, "authInfo", c.AuthInfo) + populate(objectMap, "clientType", c.ClientType) + populate(objectMap, "configurationInfo", c.ConfigurationInfo) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "publicNetworkSolution", c.PublicNetworkSolution) + populate(objectMap, "scope", c.Scope) + populate(objectMap, "secretStore", c.SecretStore) + populate(objectMap, "targetService", c.TargetService) + populate(objectMap, "vNetSolution", c.VNetSolution) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateOrUpdateDryrunParameters. +func (c *CreateOrUpdateDryrunParameters) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionName": + err = unpopulate(val, "ActionName", &c.ActionName) + delete(rawMsg, key) + case "authInfo": + c.AuthInfo, err = unmarshalAuthInfoBaseClassification(val) + delete(rawMsg, key) + case "clientType": + err = unpopulate(val, "ClientType", &c.ClientType) + delete(rawMsg, key) + case "configurationInfo": + err = unpopulate(val, "ConfigurationInfo", &c.ConfigurationInfo) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkSolution": + err = unpopulate(val, "PublicNetworkSolution", &c.PublicNetworkSolution) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &c.Scope) + delete(rawMsg, key) + case "secretStore": + err = unpopulate(val, "SecretStore", &c.SecretStore) + delete(rawMsg, key) + case "targetService": + c.TargetService, err = unmarshalTargetServiceBaseClassification(val) + delete(rawMsg, key) + case "vNetSolution": + err = unpopulate(val, "VNetSolution", &c.VNetSolution) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprMetadata. +func (d DaprMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", d.Name) + populate(objectMap, "secretRef", d.SecretRef) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprMetadata. +func (d *DaprMetadata) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "secretRef": + err = unpopulate(val, "SecretRef", &d.SecretRef) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DaprProperties. +func (d DaprProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "componentType", d.ComponentType) + populate(objectMap, "metadata", d.Metadata) + populate(objectMap, "scopes", d.Scopes) + populate(objectMap, "secretStoreComponent", d.SecretStoreComponent) + populate(objectMap, "version", d.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DaprProperties. +func (d *DaprProperties) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "componentType": + err = unpopulate(val, "ComponentType", &d.ComponentType) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &d.Metadata) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &d.Scopes) + delete(rawMsg, key) + case "secretStoreComponent": + err = unpopulate(val, "SecretStoreComponent", &d.SecretStoreComponent) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &d.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseAADAuthInfo. +func (d DatabaseAADAuthInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "userName", d.UserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAADAuthInfo. +func (d *DatabaseAADAuthInfo) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "userName": + err = unpopulate(val, "UserName", &d.UserName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DryrunList. +func (d DryrunList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DryrunList. +func (d *DryrunList) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DryrunOperationPreview. +func (d DryrunOperationPreview) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", d.Action) + populate(objectMap, "description", d.Description) + populate(objectMap, "name", d.Name) + populate(objectMap, "operationType", d.OperationType) + populate(objectMap, "scope", d.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DryrunOperationPreview. +func (d *DryrunOperationPreview) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &d.Action) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "operationType": + err = unpopulate(val, "OperationType", &d.OperationType) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &d.Scope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DryrunParameters. +func (d DryrunParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["actionName"] = d.ActionName + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DryrunParameters. +func (d *DryrunParameters) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionName": + err = unpopulate(val, "ActionName", &d.ActionName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DryrunPatch. +func (d DryrunPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", d.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DryrunPatch. +func (d *DryrunPatch) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DryrunPrerequisiteResult. +func (d DryrunPrerequisiteResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["type"] = d.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DryrunPrerequisiteResult. +func (d *DryrunPrerequisiteResult) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DryrunProperties. +func (d DryrunProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "operationPreviews", d.OperationPreviews) + populate(objectMap, "parameters", d.Parameters) + populate(objectMap, "prerequisiteResults", d.PrerequisiteResults) + populate(objectMap, "provisioningState", d.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DryrunProperties. +func (d *DryrunProperties) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operationPreviews": + err = unpopulate(val, "OperationPreviews", &d.OperationPreviews) + delete(rawMsg, key) + case "parameters": + d.Parameters, err = unmarshalDryrunParametersClassification(val) + delete(rawMsg, key) + case "prerequisiteResults": + d.PrerequisiteResults, err = unmarshalDryrunPrerequisiteResultClassificationArray(val) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DryrunResource. +func (d DryrunResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DryrunResource. +func (d *DryrunResource) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// 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]interface{}) + 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 FirewallRules. +func (f FirewallRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureServices", f.AzureServices) + populate(objectMap, "callerClientIP", f.CallerClientIP) + populate(objectMap, "ipRanges", f.IPRanges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRules. +func (f *FirewallRules) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureServices": + err = unpopulate(val, "AzureServices", &f.AzureServices) + delete(rawMsg, key) + case "callerClientIP": + err = unpopulate(val, "CallerClientIP", &f.CallerClientIP) + delete(rawMsg, key) + case "ipRanges": + err = unpopulate(val, "IPRanges", &f.IPRanges) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultSecretReferenceSecretInfo. +func (k KeyVaultSecretReferenceSecretInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", k.Name) + objectMap["secretType"] = SecretTypeKeyVaultSecretReference + populate(objectMap, "version", k.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultSecretReferenceSecretInfo. +func (k *KeyVaultSecretReferenceSecretInfo) 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 "secretType": + err = unpopulate(val, "SecretType", &k.SecretType) + 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 KeyVaultSecretURISecretInfo. +func (k KeyVaultSecretURISecretInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["secretType"] = SecretTypeKeyVaultSecretURI + populate(objectMap, "value", k.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultSecretURISecretInfo. +func (k *KeyVaultSecretURISecretInfo) 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 "secretType": + err = unpopulate(val, "SecretType", &k.SecretType) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &k.Value) + 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 LinkerPatch. +func (l LinkerPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", l.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinkerPatch. +func (l *LinkerPatch) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinkerProperties. +func (l LinkerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authInfo", l.AuthInfo) + populate(objectMap, "clientType", l.ClientType) + populate(objectMap, "configurationInfo", l.ConfigurationInfo) + populate(objectMap, "provisioningState", l.ProvisioningState) + populate(objectMap, "publicNetworkSolution", l.PublicNetworkSolution) + populate(objectMap, "scope", l.Scope) + populate(objectMap, "secretStore", l.SecretStore) + populate(objectMap, "targetService", l.TargetService) + populate(objectMap, "vNetSolution", l.VNetSolution) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinkerProperties. +func (l *LinkerProperties) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authInfo": + l.AuthInfo, err = unmarshalAuthInfoBaseClassification(val) + delete(rawMsg, key) + case "clientType": + err = unpopulate(val, "ClientType", &l.ClientType) + delete(rawMsg, key) + case "configurationInfo": + err = unpopulate(val, "ConfigurationInfo", &l.ConfigurationInfo) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkSolution": + err = unpopulate(val, "PublicNetworkSolution", &l.PublicNetworkSolution) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &l.Scope) + delete(rawMsg, key) + case "secretStore": + err = unpopulate(val, "SecretStore", &l.SecretStore) + delete(rawMsg, key) + case "targetService": + l.TargetService, err = unmarshalTargetServiceBaseClassification(val) + delete(rawMsg, key) + case "vNetSolution": + err = unpopulate(val, "VNetSolution", &l.VNetSolution) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinkerResource. +func (l LinkerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinkerResource. +func (l *LinkerResource) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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 PermissionsMissingDryrunPrerequisiteResult. +func (p PermissionsMissingDryrunPrerequisiteResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "permissions", p.Permissions) + populate(objectMap, "recommendedRole", p.RecommendedRole) + populate(objectMap, "scope", p.Scope) + objectMap["type"] = DryrunPrerequisiteResultTypePermissionsMissing + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PermissionsMissingDryrunPrerequisiteResult. +func (p *PermissionsMissingDryrunPrerequisiteResult) 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 "permissions": + err = unpopulate(val, "Permissions", &p.Permissions) + delete(rawMsg, key) + case "recommendedRole": + err = unpopulate(val, "RecommendedRole", &p.RecommendedRole) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &p.Scope) + 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 ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + 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 "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 PublicNetworkSolution. +func (p PublicNetworkSolution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", p.Action) + populate(objectMap, "deleteOrUpdateBehavior", p.DeleteOrUpdateBehavior) + populate(objectMap, "firewallRules", p.FirewallRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicNetworkSolution. +func (p *PublicNetworkSolution) 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 "action": + err = unpopulate(val, "Action", &p.Action) + delete(rawMsg, key) + case "deleteOrUpdateBehavior": + err = unpopulate(val, "DeleteOrUpdateBehavior", &p.DeleteOrUpdateBehavior) + delete(rawMsg, key) + case "firewallRules": + err = unpopulate(val, "FirewallRules", &p.FirewallRules) + 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]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + 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 "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + 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 ResourceList. +func (r ResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceList. +func (r *ResourceList) 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 "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + 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 SecretAuthInfo. +func (s SecretAuthInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["authType"] = AuthTypeSecret + populate(objectMap, "name", s.Name) + populate(objectMap, "secretInfo", s.SecretInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretAuthInfo. +func (s *SecretAuthInfo) 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 "authType": + err = unpopulate(val, "AuthType", &s.AuthType) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "secretInfo": + s.SecretInfo, err = unmarshalSecretInfoBaseClassification(val) + 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 SecretInfoBase. +func (s SecretInfoBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["secretType"] = s.SecretType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretInfoBase. +func (s *SecretInfoBase) 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 "secretType": + err = unpopulate(val, "SecretType", &s.SecretType) + 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 SecretStore. +func (s SecretStore) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyVaultId", s.KeyVaultID) + populate(objectMap, "keyVaultSecretName", s.KeyVaultSecretName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretStore. +func (s *SecretStore) 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 "keyVaultId": + err = unpopulate(val, "KeyVaultID", &s.KeyVaultID) + delete(rawMsg, key) + case "keyVaultSecretName": + err = unpopulate(val, "KeyVaultSecretName", &s.KeyVaultSecretName) + 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 SelfHostedServer. +func (s SelfHostedServer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpoint", s.Endpoint) + objectMap["type"] = TargetServiceTypeSelfHostedServer + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SelfHostedServer. +func (s *SelfHostedServer) 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 "endpoint": + err = unpopulate(val, "Endpoint", &s.Endpoint) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + 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 ServicePrincipalCertificateAuthInfo. +func (s ServicePrincipalCertificateAuthInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["authType"] = AuthTypeServicePrincipalCertificate + populate(objectMap, "certificate", s.Certificate) + populate(objectMap, "clientId", s.ClientID) + populate(objectMap, "deleteOrUpdateBehavior", s.DeleteOrUpdateBehavior) + populate(objectMap, "principalId", s.PrincipalID) + populate(objectMap, "roles", s.Roles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServicePrincipalCertificateAuthInfo. +func (s *ServicePrincipalCertificateAuthInfo) 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 "authType": + err = unpopulate(val, "AuthType", &s.AuthType) + delete(rawMsg, key) + case "certificate": + err = unpopulate(val, "Certificate", &s.Certificate) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &s.ClientID) + delete(rawMsg, key) + case "deleteOrUpdateBehavior": + err = unpopulate(val, "DeleteOrUpdateBehavior", &s.DeleteOrUpdateBehavior) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &s.PrincipalID) + delete(rawMsg, key) + case "roles": + err = unpopulate(val, "Roles", &s.Roles) + 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 ServicePrincipalSecretAuthInfo. +func (s ServicePrincipalSecretAuthInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["authType"] = AuthTypeServicePrincipalSecret + populate(objectMap, "clientId", s.ClientID) + populate(objectMap, "deleteOrUpdateBehavior", s.DeleteOrUpdateBehavior) + populate(objectMap, "principalId", s.PrincipalID) + populate(objectMap, "roles", s.Roles) + populate(objectMap, "secret", s.Secret) + populate(objectMap, "userName", s.UserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServicePrincipalSecretAuthInfo. +func (s *ServicePrincipalSecretAuthInfo) 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 "authType": + err = unpopulate(val, "AuthType", &s.AuthType) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &s.ClientID) + delete(rawMsg, key) + case "deleteOrUpdateBehavior": + err = unpopulate(val, "DeleteOrUpdateBehavior", &s.DeleteOrUpdateBehavior) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &s.PrincipalID) + delete(rawMsg, key) + case "roles": + err = unpopulate(val, "Roles", &s.Roles) + delete(rawMsg, key) + case "secret": + err = unpopulate(val, "Secret", &s.Secret) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &s.UserName) + 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 SourceConfiguration. +func (s SourceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceConfiguration. +func (s *SourceConfiguration) 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) + case "value": + err = unpopulate(val, "Value", &s.Value) + 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 SystemAssignedIdentityAuthInfo. +func (s SystemAssignedIdentityAuthInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["authType"] = AuthTypeSystemAssignedIdentity + populate(objectMap, "deleteOrUpdateBehavior", s.DeleteOrUpdateBehavior) + populate(objectMap, "roles", s.Roles) + populate(objectMap, "userName", s.UserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemAssignedIdentityAuthInfo. +func (s *SystemAssignedIdentityAuthInfo) 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 "authType": + err = unpopulate(val, "AuthType", &s.AuthType) + delete(rawMsg, key) + case "deleteOrUpdateBehavior": + err = unpopulate(val, "DeleteOrUpdateBehavior", &s.DeleteOrUpdateBehavior) + delete(rawMsg, key) + case "roles": + err = unpopulate(val, "Roles", &s.Roles) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &s.UserName) + 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]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 TargetServiceBase. +func (t TargetServiceBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["type"] = t.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetServiceBase. +func (t *TargetServiceBase) 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 "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 UserAccountAuthInfo. +func (u UserAccountAuthInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["authType"] = AuthTypeUserAccount + populate(objectMap, "deleteOrUpdateBehavior", u.DeleteOrUpdateBehavior) + populate(objectMap, "principalId", u.PrincipalID) + populate(objectMap, "roles", u.Roles) + populate(objectMap, "userName", u.UserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAccountAuthInfo. +func (u *UserAccountAuthInfo) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authType": + err = unpopulate(val, "AuthType", &u.AuthType) + delete(rawMsg, key) + case "deleteOrUpdateBehavior": + err = unpopulate(val, "DeleteOrUpdateBehavior", &u.DeleteOrUpdateBehavior) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + case "roles": + err = unpopulate(val, "Roles", &u.Roles) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &u.UserName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentityAuthInfo. +func (u UserAssignedIdentityAuthInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["authType"] = AuthTypeUserAssignedIdentity + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "deleteOrUpdateBehavior", u.DeleteOrUpdateBehavior) + populate(objectMap, "roles", u.Roles) + populate(objectMap, "subscriptionId", u.SubscriptionID) + populate(objectMap, "userName", u.UserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentityAuthInfo. +func (u *UserAssignedIdentityAuthInfo) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authType": + err = unpopulate(val, "AuthType", &u.AuthType) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "deleteOrUpdateBehavior": + err = unpopulate(val, "DeleteOrUpdateBehavior", &u.DeleteOrUpdateBehavior) + delete(rawMsg, key) + case "roles": + err = unpopulate(val, "Roles", &u.Roles) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &u.SubscriptionID) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &u.UserName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VNetSolution. +func (v VNetSolution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deleteOrUpdateBehavior", v.DeleteOrUpdateBehavior) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VNetSolution. +func (v *VNetSolution) 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 "deleteOrUpdateBehavior": + err = unpopulate(val, "DeleteOrUpdateBehavior", &v.DeleteOrUpdateBehavior) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + 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 ValidateOperationResult. +func (v ValidateOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "resourceId", v.ResourceID) + populate(objectMap, "status", v.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateOperationResult. +func (v *ValidateOperationResult) 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 "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &v.ResourceID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) + 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 ValidateResult. +func (v ValidateResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authType", v.AuthType) + populate(objectMap, "isConnectionAvailable", v.IsConnectionAvailable) + populate(objectMap, "linkerName", v.LinkerName) + populateTimeRFC3339(objectMap, "reportEndTimeUtc", v.ReportEndTimeUTC) + populateTimeRFC3339(objectMap, "reportStartTimeUtc", v.ReportStartTimeUTC) + populate(objectMap, "sourceId", v.SourceID) + populate(objectMap, "targetId", v.TargetID) + populate(objectMap, "validationDetail", v.ValidationDetail) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateResult. +func (v *ValidateResult) 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 "authType": + err = unpopulate(val, "AuthType", &v.AuthType) + delete(rawMsg, key) + case "isConnectionAvailable": + err = unpopulate(val, "IsConnectionAvailable", &v.IsConnectionAvailable) + delete(rawMsg, key) + case "linkerName": + err = unpopulate(val, "LinkerName", &v.LinkerName) + delete(rawMsg, key) + case "reportEndTimeUtc": + err = unpopulateTimeRFC3339(val, "ReportEndTimeUTC", &v.ReportEndTimeUTC) + delete(rawMsg, key) + case "reportStartTimeUtc": + err = unpopulateTimeRFC3339(val, "ReportStartTimeUTC", &v.ReportStartTimeUTC) + delete(rawMsg, key) + case "sourceId": + err = unpopulate(val, "SourceID", &v.SourceID) + delete(rawMsg, key) + case "targetId": + err = unpopulate(val, "TargetID", &v.TargetID) + delete(rawMsg, key) + case "validationDetail": + err = unpopulate(val, "ValidationDetail", &v.ValidationDetail) + 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 ValidationResultItem. +func (v ValidationResultItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", v.Description) + populate(objectMap, "errorCode", v.ErrorCode) + populate(objectMap, "errorMessage", v.ErrorMessage) + populate(objectMap, "name", v.Name) + populate(objectMap, "result", v.Result) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidationResultItem. +func (v *ValidationResultItem) 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 "description": + err = unpopulate(val, "Description", &v.Description) + delete(rawMsg, key) + case "errorCode": + err = unpopulate(val, "ErrorCode", &v.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &v.ErrorMessage) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "result": + err = unpopulate(val, "Result", &v.Result) + 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 ValueSecretInfo. +func (v ValueSecretInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["secretType"] = SecretTypeRawValue + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValueSecretInfo. +func (v *ValueSecretInfo) 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 "secretType": + err = unpopulate(val, "SecretType", &v.SecretType) + 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]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 +} diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_operations_client.go b/sdk/resourcemanager/servicelinker/armservicelinker/operations_client.go similarity index 96% rename from sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_operations_client.go rename to sdk/resourcemanager/servicelinker/armservicelinker/operations_client.go index fc3fda26c097..b7348bcbada8 100644 --- a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_operations_client.go +++ b/sdk/resourcemanager/servicelinker/armservicelinker/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 armservicelinker @@ -49,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists the available ServiceLinker REST API operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-11-01-preview // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/servicelinker/armservicelinker/polymorphic_helpers.go similarity index 60% rename from sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_polymorphic_helpers.go rename to sdk/resourcemanager/servicelinker/armservicelinker/polymorphic_helpers.go index 94ea80336605..79aba9b473fc 100644 --- a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/servicelinker/armservicelinker/polymorphic_helpers.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 armservicelinker @@ -20,6 +21,8 @@ func unmarshalAuthInfoBaseClassification(rawMsg json.RawMessage) (AuthInfoBaseCl } var b AuthInfoBaseClassification switch m["authType"] { + case string(AuthTypeAccessKey): + b = &AccessKeyInfoBase{} case string(AuthTypeSecret): b = &SecretAuthInfo{} case string(AuthTypeServicePrincipalCertificate): @@ -28,6 +31,8 @@ func unmarshalAuthInfoBaseClassification(rawMsg json.RawMessage) (AuthInfoBaseCl b = &ServicePrincipalSecretAuthInfo{} case string(AuthTypeSystemAssignedIdentity): b = &SystemAssignedIdentityAuthInfo{} + case string(AuthTypeUserAccount): + b = &UserAccountAuthInfo{} case string(AuthTypeUserAssignedIdentity): b = &UserAssignedIdentityAuthInfo{} default: @@ -54,6 +59,63 @@ func unmarshalAzureResourcePropertiesBaseClassification(rawMsg json.RawMessage) return b, json.Unmarshal(rawMsg, b) } +func unmarshalDryrunParametersClassification(rawMsg json.RawMessage) (DryrunParametersClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b DryrunParametersClassification + switch m["actionName"] { + case string(DryrunActionNameCreateOrUpdate): + b = &CreateOrUpdateDryrunParameters{} + default: + b = &DryrunParameters{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalDryrunPrerequisiteResultClassification(rawMsg json.RawMessage) (DryrunPrerequisiteResultClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b DryrunPrerequisiteResultClassification + switch m["type"] { + case string(DryrunPrerequisiteResultTypeBasicError): + b = &BasicErrorDryrunPrerequisiteResult{} + case string(DryrunPrerequisiteResultTypePermissionsMissing): + b = &PermissionsMissingDryrunPrerequisiteResult{} + default: + b = &DryrunPrerequisiteResult{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalDryrunPrerequisiteResultClassificationArray(rawMsg json.RawMessage) ([]DryrunPrerequisiteResultClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]DryrunPrerequisiteResultClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalDryrunPrerequisiteResultClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + func unmarshalSecretInfoBaseClassification(rawMsg json.RawMessage) (SecretInfoBaseClassification, error) { if rawMsg == nil { return nil, nil @@ -92,6 +154,8 @@ func unmarshalTargetServiceBaseClassification(rawMsg json.RawMessage) (TargetSer b = &ConfluentBootstrapServer{} case string(TargetServiceTypeConfluentSchemaRegistry): b = &ConfluentSchemaRegistry{} + case string(TargetServiceTypeSelfHostedServer): + b = &SelfHostedServer{} default: b = &TargetServiceBase{} } diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/response_types.go b/sdk/resourcemanager/servicelinker/armservicelinker/response_types.go new file mode 100644 index 000000000000..a66e14210e1a --- /dev/null +++ b/sdk/resourcemanager/servicelinker/armservicelinker/response_types.go @@ -0,0 +1,145 @@ +//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 armservicelinker + +// ConfigurationNamesClientListResponse contains the response from method ConfigurationNamesClient.List. +type ConfigurationNamesClientListResponse struct { + ConfigurationNameResult +} + +// ConnectorClientCreateDryrunResponse contains the response from method ConnectorClient.CreateDryrun. +type ConnectorClientCreateDryrunResponse struct { + DryrunResource +} + +// ConnectorClientCreateOrUpdateResponse contains the response from method ConnectorClient.CreateOrUpdate. +type ConnectorClientCreateOrUpdateResponse struct { + LinkerResource +} + +// ConnectorClientDeleteDryrunResponse contains the response from method ConnectorClient.DeleteDryrun. +type ConnectorClientDeleteDryrunResponse struct { + // placeholder for future response values +} + +// ConnectorClientDeleteResponse contains the response from method ConnectorClient.Delete. +type ConnectorClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectorClientGenerateConfigurationsResponse contains the response from method ConnectorClient.GenerateConfigurations. +type ConnectorClientGenerateConfigurationsResponse struct { + ConfigurationResult +} + +// ConnectorClientGetDryrunResponse contains the response from method ConnectorClient.GetDryrun. +type ConnectorClientGetDryrunResponse struct { + DryrunResource +} + +// ConnectorClientGetResponse contains the response from method ConnectorClient.Get. +type ConnectorClientGetResponse struct { + LinkerResource +} + +// ConnectorClientListDryrunResponse contains the response from method ConnectorClient.ListDryrun. +type ConnectorClientListDryrunResponse struct { + DryrunList +} + +// ConnectorClientListResponse contains the response from method ConnectorClient.List. +type ConnectorClientListResponse struct { + ResourceList +} + +// ConnectorClientUpdateDryrunResponse contains the response from method ConnectorClient.UpdateDryrun. +type ConnectorClientUpdateDryrunResponse struct { + DryrunResource +} + +// ConnectorClientUpdateResponse contains the response from method ConnectorClient.Update. +type ConnectorClientUpdateResponse struct { + LinkerResource +} + +// ConnectorClientValidateResponse contains the response from method ConnectorClient.Validate. +type ConnectorClientValidateResponse struct { + ValidateOperationResult +} + +// LinkerClientCreateOrUpdateResponse contains the response from method LinkerClient.CreateOrUpdate. +type LinkerClientCreateOrUpdateResponse struct { + LinkerResource +} + +// LinkerClientDeleteResponse contains the response from method LinkerClient.Delete. +type LinkerClientDeleteResponse struct { + // placeholder for future response values +} + +// LinkerClientGetResponse contains the response from method LinkerClient.Get. +type LinkerClientGetResponse struct { + LinkerResource +} + +// LinkerClientListConfigurationsResponse contains the response from method LinkerClient.ListConfigurations. +type LinkerClientListConfigurationsResponse struct { + ConfigurationResult +} + +// LinkerClientListResponse contains the response from method LinkerClient.List. +type LinkerClientListResponse struct { + ResourceList +} + +// LinkerClientUpdateResponse contains the response from method LinkerClient.Update. +type LinkerClientUpdateResponse struct { + LinkerResource +} + +// LinkerClientValidateResponse contains the response from method LinkerClient.Validate. +type LinkerClientValidateResponse struct { + ValidateOperationResult +} + +// LinkersClientCreateDryrunResponse contains the response from method LinkersClient.CreateDryrun. +type LinkersClientCreateDryrunResponse struct { + DryrunResource +} + +// LinkersClientDeleteDryrunResponse contains the response from method LinkersClient.DeleteDryrun. +type LinkersClientDeleteDryrunResponse struct { + // placeholder for future response values +} + +// LinkersClientGenerateConfigurationsResponse contains the response from method LinkersClient.GenerateConfigurations. +type LinkersClientGenerateConfigurationsResponse struct { + ConfigurationResult +} + +// LinkersClientGetDryrunResponse contains the response from method LinkersClient.GetDryrun. +type LinkersClientGetDryrunResponse struct { + DryrunResource +} + +// LinkersClientListDryrunResponse contains the response from method LinkersClient.ListDryrun. +type LinkersClientListDryrunResponse struct { + DryrunList +} + +// LinkersClientUpdateDryrunResponse contains the response from method LinkersClient.UpdateDryrun. +type LinkersClientUpdateDryrunResponse struct { + DryrunResource +} + +// OperationsClientListResponse contains the response from method OperationsClient.List. +type OperationsClientListResponse struct { + OperationListResult +} diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_time_rfc3339.go b/sdk/resourcemanager/servicelinker/armservicelinker/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/servicelinker/armservicelinker/time_rfc3339.go index edb565fe38d1..c7c0e007186f 100644 --- a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/servicelinker/armservicelinker/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 armservicelinker diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/ze_generated_example_linker_client_test.go b/sdk/resourcemanager/servicelinker/armservicelinker/ze_generated_example_linker_client_test.go deleted file mode 100644 index 4330afd2d9e2..000000000000 --- a/sdk/resourcemanager/servicelinker/armservicelinker/ze_generated_example_linker_client_test.go +++ /dev/null @@ -1,219 +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 armservicelinker_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/servicelinker/armservicelinker" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/LinkList.json -func ExampleLinkerClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armservicelinker.NewLinkerClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - 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/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/Link.json -func ExampleLinkerClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armservicelinker.NewLinkerClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - "linkName", - 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/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/PutLink.json -func ExampleLinkerClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armservicelinker.NewLinkerClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - "linkName", - armservicelinker.LinkerResource{ - Properties: &armservicelinker.LinkerProperties{ - AuthInfo: &armservicelinker.SecretAuthInfo{ - AuthType: to.Ptr(armservicelinker.AuthTypeSecret), - Name: to.Ptr("name"), - SecretInfo: &armservicelinker.ValueSecretInfo{ - SecretType: to.Ptr(armservicelinker.SecretTypeRawValue), - Value: to.Ptr("secret"), - }, - }, - TargetService: &armservicelinker.AzureResource{ - Type: to.Ptr(armservicelinker.TargetServiceTypeAzureResource), - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db"), - }, - }, - }, - 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/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/DeleteLink.json -func ExampleLinkerClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armservicelinker.NewLinkerClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - "linkName", - 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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/PatchLink.json -func ExampleLinkerClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armservicelinker.NewLinkerClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - "linkName", - armservicelinker.LinkerPatch{ - Properties: &armservicelinker.LinkerProperties{ - AuthInfo: &armservicelinker.ServicePrincipalSecretAuthInfo{ - AuthType: to.Ptr(armservicelinker.AuthTypeServicePrincipalSecret), - ClientID: to.Ptr("name"), - PrincipalID: to.Ptr("id"), - Secret: to.Ptr("secret"), - }, - TargetService: &armservicelinker.AzureResource{ - Type: to.Ptr(armservicelinker.TargetServiceTypeAzureResource), - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"), - }, - }, - }, - 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/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/ValidateLinkSuccess.json -func ExampleLinkerClient_BeginValidate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armservicelinker.NewLinkerClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginValidate(ctx, - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - "linkName", - 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/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/GetConfigurations.json -func ExampleLinkerClient_ListConfigurations() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armservicelinker.NewLinkerClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListConfigurations(ctx, - "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - "linkName", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/servicelinker/armservicelinker/ze_generated_example_operations_client_test.go deleted file mode 100644 index 0d17af596596..000000000000 --- a/sdk/resourcemanager/servicelinker/armservicelinker/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 armservicelinker_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicelinker/armservicelinker" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/OperationsList.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 := armservicelinker.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/servicelinker/armservicelinker/zz_generated_models_serde.go b/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_models_serde.go deleted file mode 100644 index 3ca32fb05739..000000000000 --- a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_models_serde.go +++ /dev/null @@ -1,582 +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 armservicelinker - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AzureKeyVaultProperties. -func (a AzureKeyVaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "connectAsKubernetesCsiDriver", a.ConnectAsKubernetesCsiDriver) - objectMap["type"] = AzureResourceTypeKeyVault - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureKeyVaultProperties. -func (a *AzureKeyVaultProperties) 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 "connectAsKubernetesCsiDriver": - err = unpopulate(val, "ConnectAsKubernetesCsiDriver", &a.ConnectAsKubernetesCsiDriver) - 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 AzureResource. -func (a AzureResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "resourceProperties", a.ResourceProperties) - objectMap["type"] = TargetServiceTypeAzureResource - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResource. -func (a *AzureResource) 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 "resourceProperties": - a.ResourceProperties, err = unmarshalAzureResourcePropertiesBaseClassification(val) - 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 ConfluentBootstrapServer. -func (c ConfluentBootstrapServer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "endpoint", c.Endpoint) - objectMap["type"] = TargetServiceTypeConfluentBootstrapServer - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConfluentBootstrapServer. -func (c *ConfluentBootstrapServer) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &c.Endpoint) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConfluentSchemaRegistry. -func (c ConfluentSchemaRegistry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "endpoint", c.Endpoint) - objectMap["type"] = TargetServiceTypeConfluentSchemaRegistry - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConfluentSchemaRegistry. -func (c *ConfluentSchemaRegistry) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &c.Endpoint) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type KeyVaultSecretReferenceSecretInfo. -func (k KeyVaultSecretReferenceSecretInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", k.Name) - objectMap["secretType"] = SecretTypeKeyVaultSecretReference - populate(objectMap, "version", k.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultSecretReferenceSecretInfo. -func (k *KeyVaultSecretReferenceSecretInfo) 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 "secretType": - err = unpopulate(val, "SecretType", &k.SecretType) - 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 KeyVaultSecretURISecretInfo. -func (k KeyVaultSecretURISecretInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["secretType"] = SecretTypeKeyVaultSecretURI - populate(objectMap, "value", k.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultSecretURISecretInfo. -func (k *KeyVaultSecretURISecretInfo) 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 "secretType": - err = unpopulate(val, "SecretType", &k.SecretType) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &k.Value) - 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 LinkerPatch. -func (l LinkerPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", l.Properties) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type LinkerProperties. -func (l LinkerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authInfo", l.AuthInfo) - populate(objectMap, "clientType", l.ClientType) - populate(objectMap, "provisioningState", l.ProvisioningState) - populate(objectMap, "scope", l.Scope) - populate(objectMap, "secretStore", l.SecretStore) - populate(objectMap, "targetService", l.TargetService) - populate(objectMap, "vNetSolution", l.VNetSolution) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LinkerProperties. -func (l *LinkerProperties) 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", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "authInfo": - l.AuthInfo, err = unmarshalAuthInfoBaseClassification(val) - delete(rawMsg, key) - case "clientType": - err = unpopulate(val, "ClientType", &l.ClientType) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &l.Scope) - delete(rawMsg, key) - case "secretStore": - err = unpopulate(val, "SecretStore", &l.SecretStore) - delete(rawMsg, key) - case "targetService": - l.TargetService, err = unmarshalTargetServiceBaseClassification(val) - delete(rawMsg, key) - case "vNetSolution": - err = unpopulate(val, "VNetSolution", &l.VNetSolution) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecretAuthInfo. -func (s SecretAuthInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["authType"] = AuthTypeSecret - populate(objectMap, "name", s.Name) - populate(objectMap, "secretInfo", s.SecretInfo) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecretAuthInfo. -func (s *SecretAuthInfo) 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 "authType": - err = unpopulate(val, "AuthType", &s.AuthType) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "secretInfo": - s.SecretInfo, err = unmarshalSecretInfoBaseClassification(val) - 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 ServicePrincipalCertificateAuthInfo. -func (s ServicePrincipalCertificateAuthInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["authType"] = AuthTypeServicePrincipalCertificate - populate(objectMap, "certificate", s.Certificate) - populate(objectMap, "clientId", s.ClientID) - populate(objectMap, "principalId", s.PrincipalID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServicePrincipalCertificateAuthInfo. -func (s *ServicePrincipalCertificateAuthInfo) 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 "authType": - err = unpopulate(val, "AuthType", &s.AuthType) - delete(rawMsg, key) - case "certificate": - err = unpopulate(val, "Certificate", &s.Certificate) - delete(rawMsg, key) - case "clientId": - err = unpopulate(val, "ClientID", &s.ClientID) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &s.PrincipalID) - 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 ServicePrincipalSecretAuthInfo. -func (s ServicePrincipalSecretAuthInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["authType"] = AuthTypeServicePrincipalSecret - populate(objectMap, "clientId", s.ClientID) - populate(objectMap, "principalId", s.PrincipalID) - populate(objectMap, "secret", s.Secret) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServicePrincipalSecretAuthInfo. -func (s *ServicePrincipalSecretAuthInfo) 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 "authType": - err = unpopulate(val, "AuthType", &s.AuthType) - delete(rawMsg, key) - case "clientId": - err = unpopulate(val, "ClientID", &s.ClientID) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &s.PrincipalID) - delete(rawMsg, key) - case "secret": - err = unpopulate(val, "Secret", &s.Secret) - 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 SystemAssignedIdentityAuthInfo. -func (s SystemAssignedIdentityAuthInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["authType"] = AuthTypeSystemAssignedIdentity - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemAssignedIdentityAuthInfo. -func (s *SystemAssignedIdentityAuthInfo) 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 "authType": - err = unpopulate(val, "AuthType", &s.AuthType) - 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]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 UserAssignedIdentityAuthInfo. -func (u UserAssignedIdentityAuthInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["authType"] = AuthTypeUserAssignedIdentity - populate(objectMap, "clientId", u.ClientID) - populate(objectMap, "subscriptionId", u.SubscriptionID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentityAuthInfo. -func (u *UserAssignedIdentityAuthInfo) 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", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "authType": - err = unpopulate(val, "AuthType", &u.AuthType) - delete(rawMsg, key) - case "clientId": - err = unpopulate(val, "ClientID", &u.ClientID) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &u.SubscriptionID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateResult. -func (v *ValidateResult) 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 "authType": - err = unpopulate(val, "AuthType", &v.AuthType) - delete(rawMsg, key) - case "isConnectionAvailable": - err = unpopulate(val, "IsConnectionAvailable", &v.IsConnectionAvailable) - delete(rawMsg, key) - case "linkerName": - err = unpopulate(val, "LinkerName", &v.LinkerName) - delete(rawMsg, key) - case "reportEndTimeUtc": - err = unpopulateTimeRFC3339(val, "ReportEndTimeUTC", &v.ReportEndTimeUTC) - delete(rawMsg, key) - case "reportStartTimeUtc": - err = unpopulateTimeRFC3339(val, "ReportStartTimeUTC", &v.ReportStartTimeUTC) - delete(rawMsg, key) - case "sourceId": - err = unpopulate(val, "SourceID", &v.SourceID) - delete(rawMsg, key) - case "targetId": - err = unpopulate(val, "TargetID", &v.TargetID) - delete(rawMsg, key) - case "validationDetail": - err = unpopulate(val, "ValidationDetail", &v.ValidationDetail) - 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 ValueSecretInfo. -func (v ValueSecretInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["secretType"] = SecretTypeRawValue - populate(objectMap, "value", v.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ValueSecretInfo. -func (v *ValueSecretInfo) 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 "secretType": - err = unpopulate(val, "SecretType", &v.SecretType) - 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]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 -} diff --git a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_response_types.go b/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_response_types.go deleted file mode 100644 index 4ebf1684f969..000000000000 --- a/sdk/resourcemanager/servicelinker/armservicelinker/zz_generated_response_types.go +++ /dev/null @@ -1,49 +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 armservicelinker - -// LinkerClientCreateOrUpdateResponse contains the response from method LinkerClient.CreateOrUpdate. -type LinkerClientCreateOrUpdateResponse struct { - LinkerResource -} - -// LinkerClientDeleteResponse contains the response from method LinkerClient.Delete. -type LinkerClientDeleteResponse struct { - // placeholder for future response values -} - -// LinkerClientGetResponse contains the response from method LinkerClient.Get. -type LinkerClientGetResponse struct { - LinkerResource -} - -// LinkerClientListConfigurationsResponse contains the response from method LinkerClient.ListConfigurations. -type LinkerClientListConfigurationsResponse struct { - SourceConfigurationResult -} - -// LinkerClientListResponse contains the response from method LinkerClient.List. -type LinkerClientListResponse struct { - LinkerList -} - -// LinkerClientUpdateResponse contains the response from method LinkerClient.Update. -type LinkerClientUpdateResponse struct { - LinkerResource -} - -// LinkerClientValidateResponse contains the response from method LinkerClient.Validate. -type LinkerClientValidateResponse struct { - ValidateOperationResult -} - -// OperationsClientListResponse contains the response from method OperationsClient.List. -type OperationsClientListResponse struct { - OperationListResult -}