From c6900b36aeab35a402eac2cbd4aaa4a9c67a86f6 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 18 Oct 2024 17:36:25 +0000 Subject: [PATCH] CodeGen from PR 29824 in Azure/azure-rest-api-specs Merge f50397232f4f6a149d6501387b2a91ed4af0e3ae into cfe318beba82c1e5bda6a600f91de32cba814364 --- .../armappconfiguration/CHANGELOG.md | 38 + .../armappconfiguration/autorest.md | 7 +- .../armappconfiguration/client_factory.go | 53 +- .../configurationstores_client.go | 190 +++- ...configurationstores_client_example_test.go | 896 ------------------ .../armappconfiguration/constants.go | 132 ++- .../fake/configurationstores_server.go | 86 ++ .../fake/server_factory.go | 5 + .../fake/snapshots_server.go | 166 ++++ .../armappconfiguration/fake/time_rfc3339.go | 42 +- .../armappconfiguration/go.mod | 2 +- .../armappconfiguration/interfaces.go | 18 + .../armappconfiguration/keyvalues_client.go | 27 +- .../keyvalues_client_example_test.go | 125 --- .../armappconfiguration/models.go | 252 ++++- .../armappconfiguration/models_serde.go | 598 +++++++++++- .../armappconfiguration/operations_client.go | 12 +- .../operations_client_example_test.go | 554 ----------- .../armappconfiguration/options.go | 23 + .../polymorphic_helpers.go | 34 + .../privateendpointconnections_client.go | 20 +- ...endpointconnections_client_example_test.go | 167 ---- .../privatelinkresources_client.go | 8 +- ...rivatelinkresources_client_example_test.go | 90 -- .../armappconfiguration/replicas_client.go | 20 +- .../replicas_client_example_test.go | 186 ---- .../{response_types.go => responses.go} | 25 + .../armappconfiguration/snapshots_client.go | 204 ++++ .../armappconfiguration/time_rfc3339.go | 42 +- 29 files changed, 1893 insertions(+), 2129 deletions(-) delete mode 100644 sdk/resourcemanager/appconfiguration/armappconfiguration/configurationstores_client_example_test.go create mode 100644 sdk/resourcemanager/appconfiguration/armappconfiguration/fake/snapshots_server.go create mode 100644 sdk/resourcemanager/appconfiguration/armappconfiguration/interfaces.go delete mode 100644 sdk/resourcemanager/appconfiguration/armappconfiguration/keyvalues_client_example_test.go delete mode 100644 sdk/resourcemanager/appconfiguration/armappconfiguration/operations_client_example_test.go create mode 100644 sdk/resourcemanager/appconfiguration/armappconfiguration/polymorphic_helpers.go delete mode 100644 sdk/resourcemanager/appconfiguration/armappconfiguration/privateendpointconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/appconfiguration/armappconfiguration/privatelinkresources_client_example_test.go delete mode 100644 sdk/resourcemanager/appconfiguration/armappconfiguration/replicas_client_example_test.go rename sdk/resourcemanager/appconfiguration/armappconfiguration/{response_types.go => responses.go} (88%) create mode 100644 sdk/resourcemanager/appconfiguration/armappconfiguration/snapshots_client.go diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/CHANGELOG.md b/sdk/resourcemanager/appconfiguration/armappconfiguration/CHANGELOG.md index 5fe6a7e2c40b..b17d722e7961 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/CHANGELOG.md +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/CHANGELOG.md @@ -1,5 +1,43 @@ # Release History +## 2.2.0-beta.1 (2024-10-18) +### Features Added + +- New enum type `AuthenticationMode` with values `AuthenticationModeLocal`, `AuthenticationModePassThrough` +- New enum type `CompositionType` with values `CompositionTypeKey`, `CompositionTypeKeyLabel` +- New enum type `PrivateLinkDelegation` with values `PrivateLinkDelegationDisabled`, `PrivateLinkDelegationEnabled` +- New enum type `ResourceType` with values `ResourceTypeKv`, `ResourceTypeSnapshot` +- New enum type `SasKind` with values `SasKindPrimary`, `SasKindSecondary` +- New enum type `SasStatus` with values `SasStatusDisabled`, `SasStatusEnabled` +- New enum type `SnapshotStatus` with values `SnapshotStatusArchived`, `SnapshotStatusFailed`, `SnapshotStatusProvisioning`, `SnapshotStatusReady` +- New function `*ClientFactory.NewSnapshotsClient() *SnapshotsClient` +- New function `*ConfigurationStoresClient.GenerateSasToken(context.Context, string, string, SasTokenGenerationParameters, *ConfigurationStoresClientGenerateSasTokenOptions) (ConfigurationStoresClientGenerateSasTokenResponse, error)` +- New function `*ConfigurationStoresClient.ResetSasKind(context.Context, string, string, ResetSasKindParameters, *ConfigurationStoresClientResetSasKindOptions) (ConfigurationStoresClientResetSasKindResponse, error)` +- New function `*KvSasTokenScope.GetSasTokenScope() *SasTokenScope` +- New function `*SasTokenScope.GetSasTokenScope() *SasTokenScope` +- New function `*SnapshotSasTokenScope.GetSasTokenScope() *SasTokenScope` +- New function `NewSnapshotsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SnapshotsClient, error)` +- New function `*SnapshotsClient.BeginCreate(context.Context, string, string, string, Snapshot, *SnapshotsClientBeginCreateOptions) (*runtime.Poller[SnapshotsClientCreateResponse], error)` +- New function `*SnapshotsClient.Get(context.Context, string, string, string, *SnapshotsClientGetOptions) (SnapshotsClientGetResponse, error)` +- New struct `DataPlaneProxyProperties` +- New struct `ErrorDetail` +- New struct `ErrorResponseAutoGenerated` +- New struct `ExperimentationProperties` +- New struct `KeyValueFilter` +- New struct `KvSasTokenScope` +- New struct `ResetSasKindParameters` +- New struct `SasKindInfo` +- New struct `SasProperties` +- New struct `SasTokenGenerationParameters` +- New struct `SasTokenGenerationResult` +- New struct `Snapshot` +- New struct `SnapshotProperties` +- New struct `SnapshotSasTokenScope` +- New struct `TelemetryProperties` +- New field `DataPlaneProxy`, `Experimentation`, `Sas`, `Telemetry` in struct `ConfigurationStoreProperties` +- New field `DataPlaneProxy`, `Experimentation`, `Sas`, `Telemetry` in struct `ConfigurationStorePropertiesUpdateParameters` + + ## 2.1.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/autorest.md b/sdk/resourcemanager/appconfiguration/armappconfiguration/autorest.md index ddf95b88acb3..feb359ab20c0 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/autorest.md +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/appconfiguration/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/appconfiguration/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.1.0 -tag: package-2023-03-01 +module-version: 2.2.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/client_factory.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/client_factory.go index 188d2ec1b310..c9b660ce88ac 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/client_factory.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/client_factory.go @@ -17,8 +17,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -27,48 +26,68 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewConfigurationStoresClient creates a new instance of ConfigurationStoresClient. func (c *ClientFactory) NewConfigurationStoresClient() *ConfigurationStoresClient { - subClient, _ := NewConfigurationStoresClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ConfigurationStoresClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewKeyValuesClient creates a new instance of KeyValuesClient. func (c *ClientFactory) NewKeyValuesClient() *KeyValuesClient { - subClient, _ := NewKeyValuesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &KeyValuesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &OperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewReplicasClient creates a new instance of ReplicasClient. func (c *ClientFactory) NewReplicasClient() *ReplicasClient { - subClient, _ := NewReplicasClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ReplicasClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewSnapshotsClient creates a new instance of SnapshotsClient. +func (c *ClientFactory) NewSnapshotsClient() *SnapshotsClient { + return &SnapshotsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/configurationstores_client.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/configurationstores_client.go index 07fa77b361e2..a9d219d77f8b 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/configurationstores_client.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/configurationstores_client.go @@ -46,7 +46,7 @@ func NewConfigurationStoresClient(subscriptionID string, credential azcore.Token // BeginCreate - Creates a configuration store with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - configStoreCreationParameters - The parameters for creating a configuration store. @@ -72,7 +72,7 @@ func (client *ConfigurationStoresClient) BeginCreate(ctx context.Context, resour // Create - Creates a configuration store with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview func (client *ConfigurationStoresClient) create(ctx context.Context, resourceGroupName string, configStoreName string, configStoreCreationParameters ConfigurationStore, options *ConfigurationStoresClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ConfigurationStoresClient.BeginCreate" @@ -114,7 +114,7 @@ func (client *ConfigurationStoresClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, configStoreCreationParameters); err != nil { @@ -126,7 +126,7 @@ func (client *ConfigurationStoresClient) createCreateRequest(ctx context.Context // BeginDelete - Deletes a configuration store. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - options - ConfigurationStoresClientBeginDeleteOptions contains the optional parameters for the ConfigurationStoresClient.BeginDelete @@ -151,7 +151,7 @@ func (client *ConfigurationStoresClient) BeginDelete(ctx context.Context, resour // Delete - Deletes a configuration store. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview func (client *ConfigurationStoresClient) deleteOperation(ctx context.Context, resourceGroupName string, configStoreName string, options *ConfigurationStoresClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ConfigurationStoresClient.BeginDelete" @@ -193,16 +193,85 @@ func (client *ConfigurationStoresClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } +// GenerateSasToken - Generates a SAS token for scoped, read-only access of the specified configuration store. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - configStoreName - The name of the configuration store. +// - sasTokenGenerationParameters - The object containing information for the SAS token generation request. +// - options - ConfigurationStoresClientGenerateSasTokenOptions contains the optional parameters for the ConfigurationStoresClient.GenerateSasToken +// method. +func (client *ConfigurationStoresClient) GenerateSasToken(ctx context.Context, resourceGroupName string, configStoreName string, sasTokenGenerationParameters SasTokenGenerationParameters, options *ConfigurationStoresClientGenerateSasTokenOptions) (ConfigurationStoresClientGenerateSasTokenResponse, error) { + var err error + const operationName = "ConfigurationStoresClient.GenerateSasToken" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generateSasTokenCreateRequest(ctx, resourceGroupName, configStoreName, sasTokenGenerationParameters, options) + if err != nil { + return ConfigurationStoresClientGenerateSasTokenResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConfigurationStoresClientGenerateSasTokenResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ConfigurationStoresClientGenerateSasTokenResponse{}, err + } + resp, err := client.generateSasTokenHandleResponse(httpResp) + return resp, err +} + +// generateSasTokenCreateRequest creates the GenerateSasToken request. +func (client *ConfigurationStoresClient) generateSasTokenCreateRequest(ctx context.Context, resourceGroupName string, configStoreName string, sasTokenGenerationParameters SasTokenGenerationParameters, options *ConfigurationStoresClientGenerateSasTokenOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/generateSasToken" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if configStoreName == "" { + return nil, errors.New("parameter configStoreName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configStoreName}", url.PathEscape(configStoreName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, sasTokenGenerationParameters); err != nil { + return nil, err + } + return req, nil +} + +// generateSasTokenHandleResponse handles the GenerateSasToken response. +func (client *ConfigurationStoresClient) generateSasTokenHandleResponse(resp *http.Response) (ConfigurationStoresClientGenerateSasTokenResponse, error) { + result := ConfigurationStoresClientGenerateSasTokenResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SasTokenGenerationResult); err != nil { + return ConfigurationStoresClientGenerateSasTokenResponse{}, err + } + return result, nil +} + // Get - Gets the properties of the specified configuration store. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - options - ConfigurationStoresClientGetOptions contains the optional parameters for the ConfigurationStoresClient.Get method. @@ -248,7 +317,7 @@ func (client *ConfigurationStoresClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +335,7 @@ func (client *ConfigurationStoresClient) getHandleResponse(resp *http.Response) // GetDeleted - Gets a deleted Azure app configuration store. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - location - The location in which uniqueness will be verified. // - configStoreName - The name of the configuration store. // - options - ConfigurationStoresClientGetDeletedOptions contains the optional parameters for the ConfigurationStoresClient.GetDeleted @@ -313,7 +382,7 @@ func (client *ConfigurationStoresClient) getDeletedCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +399,7 @@ func (client *ConfigurationStoresClient) getDeletedHandleResponse(resp *http.Res // NewListPager - Lists the configuration stores for a given subscription. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - options - ConfigurationStoresClientListOptions contains the optional parameters for the ConfigurationStoresClient.NewListPager // method. func (client *ConfigurationStoresClient) NewListPager(options *ConfigurationStoresClientListOptions) *runtime.Pager[ConfigurationStoresClientListResponse] { @@ -368,10 +437,10 @@ func (client *ConfigurationStoresClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -388,7 +457,7 @@ func (client *ConfigurationStoresClient) listHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Lists the configuration stores for a given resource group. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - options - ConfigurationStoresClientListByResourceGroupOptions contains the optional parameters for the ConfigurationStoresClient.NewListByResourceGroupPager // method. @@ -431,10 +500,10 @@ func (client *ConfigurationStoresClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -451,7 +520,7 @@ func (client *ConfigurationStoresClient) listByResourceGroupHandleResponse(resp // NewListDeletedPager - Gets information about the deleted configuration stores in a subscription. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - options - ConfigurationStoresClientListDeletedOptions contains the optional parameters for the ConfigurationStoresClient.NewListDeletedPager // method. func (client *ConfigurationStoresClient) NewListDeletedPager(options *ConfigurationStoresClientListDeletedOptions) *runtime.Pager[ConfigurationStoresClientListDeletedResponse] { @@ -489,7 +558,7 @@ func (client *ConfigurationStoresClient) listDeletedCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -506,7 +575,7 @@ func (client *ConfigurationStoresClient) listDeletedHandleResponse(resp *http.Re // NewListKeysPager - Lists the access key for the specified configuration store. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - options - ConfigurationStoresClientListKeysOptions contains the optional parameters for the ConfigurationStoresClient.NewListKeysPager @@ -554,10 +623,10 @@ func (client *ConfigurationStoresClient) listKeysCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -575,7 +644,7 @@ func (client *ConfigurationStoresClient) listKeysHandleResponse(resp *http.Respo // BeginPurgeDeleted - Permanently deletes the specified configuration store. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - location - The location in which uniqueness will be verified. // - configStoreName - The name of the configuration store. // - options - ConfigurationStoresClientBeginPurgeDeletedOptions contains the optional parameters for the ConfigurationStoresClient.BeginPurgeDeleted @@ -600,7 +669,7 @@ func (client *ConfigurationStoresClient) BeginPurgeDeleted(ctx context.Context, // PurgeDeleted - Permanently deletes the specified configuration store. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview func (client *ConfigurationStoresClient) purgeDeleted(ctx context.Context, location string, configStoreName string, options *ConfigurationStoresClientBeginPurgeDeletedOptions) (*http.Response, error) { var err error const operationName = "ConfigurationStoresClient.BeginPurgeDeleted" @@ -642,7 +711,7 @@ func (client *ConfigurationStoresClient) purgeDeletedCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -651,7 +720,7 @@ func (client *ConfigurationStoresClient) purgeDeletedCreateRequest(ctx context.C // RegenerateKey - Regenerates an access key for the specified configuration store. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - regenerateKeyParameters - The parameters for regenerating an access key. @@ -699,7 +768,7 @@ func (client *ConfigurationStoresClient) regenerateKeyCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, regenerateKeyParameters); err != nil { @@ -717,10 +786,79 @@ func (client *ConfigurationStoresClient) regenerateKeyHandleResponse(resp *http. return result, nil } +// ResetSasKind - Reset SAS kind to invalidate all previously generated SAS tokens of the specified kind. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - configStoreName - The name of the configuration store. +// - resetSasKindParameters - The object containing information for the SAS kind reset request. +// - options - ConfigurationStoresClientResetSasKindOptions contains the optional parameters for the ConfigurationStoresClient.ResetSasKind +// method. +func (client *ConfigurationStoresClient) ResetSasKind(ctx context.Context, resourceGroupName string, configStoreName string, resetSasKindParameters ResetSasKindParameters, options *ConfigurationStoresClientResetSasKindOptions) (ConfigurationStoresClientResetSasKindResponse, error) { + var err error + const operationName = "ConfigurationStoresClient.ResetSasKind" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.resetSasKindCreateRequest(ctx, resourceGroupName, configStoreName, resetSasKindParameters, options) + if err != nil { + return ConfigurationStoresClientResetSasKindResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConfigurationStoresClientResetSasKindResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ConfigurationStoresClientResetSasKindResponse{}, err + } + resp, err := client.resetSasKindHandleResponse(httpResp) + return resp, err +} + +// resetSasKindCreateRequest creates the ResetSasKind request. +func (client *ConfigurationStoresClient) resetSasKindCreateRequest(ctx context.Context, resourceGroupName string, configStoreName string, resetSasKindParameters ResetSasKindParameters, options *ConfigurationStoresClientResetSasKindOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/resetSasKind" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if configStoreName == "" { + return nil, errors.New("parameter configStoreName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configStoreName}", url.PathEscape(configStoreName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resetSasKindParameters); err != nil { + return nil, err + } + return req, nil +} + +// resetSasKindHandleResponse handles the ResetSasKind response. +func (client *ConfigurationStoresClient) resetSasKindHandleResponse(resp *http.Response) (ConfigurationStoresClientResetSasKindResponse, error) { + result := ConfigurationStoresClientResetSasKindResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationStore); err != nil { + return ConfigurationStoresClientResetSasKindResponse{}, err + } + return result, nil +} + // BeginUpdate - Updates a configuration store with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - configStoreUpdateParameters - The parameters for updating a configuration store. @@ -746,7 +884,7 @@ func (client *ConfigurationStoresClient) BeginUpdate(ctx context.Context, resour // Update - Updates a configuration store with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview func (client *ConfigurationStoresClient) update(ctx context.Context, resourceGroupName string, configStoreName string, configStoreUpdateParameters ConfigurationStoreUpdateParameters, options *ConfigurationStoresClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ConfigurationStoresClient.BeginUpdate" @@ -788,7 +926,7 @@ func (client *ConfigurationStoresClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, configStoreUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/configurationstores_client_example_test.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/configurationstores_client_example_test.go deleted file mode 100644 index 9e1d4a56fb22..000000000000 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/configurationstores_client_example_test.go +++ /dev/null @@ -1,896 +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. -// DO NOT EDIT. - -package armappconfiguration_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/appconfiguration/armappconfiguration/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresList.json -func ExampleConfigurationStoresClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConfigurationStoresClient().NewListPager(&armappconfiguration.ConfigurationStoresClientListOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ConfigurationStoreListResult = armappconfiguration.ConfigurationStoreListResult{ - // Value: []*armappconfiguration.ConfigurationStore{ - // { - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Identity: &armappconfiguration.ResourceIdentity{ - // Type: to.Ptr(armappconfiguration.IdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA"), - // TenantID: to.Ptr("BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB"), - // }, - // Properties: &armappconfiguration.ConfigurationStoreProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // Encryption: &armappconfiguration.EncryptionProperties{ - // KeyVaultProperties: &armappconfiguration.KeyVaultProperties{ - // }, - // }, - // Endpoint: to.Ptr("https://contoso.azconfig.io"), - // PrivateEndpointConnections: []*armappconfiguration.PrivateEndpointConnectionReference{ - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armappconfiguration.PublicNetworkAccessDisabled), - // }, - // SKU: &armappconfiguration.SKU{ - // Name: to.Ptr("Standard"), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("contoso2"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Identity: &armappconfiguration.ResourceIdentity{ - // Type: to.Ptr(armappconfiguration.IdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC"), - // TenantID: to.Ptr("BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB"), - // }, - // Properties: &armappconfiguration.ConfigurationStoreProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T23:06:59.000Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // Encryption: &armappconfiguration.EncryptionProperties{ - // KeyVaultProperties: &armappconfiguration.KeyVaultProperties{ - // }, - // }, - // Endpoint: to.Ptr("https://contoso2.azconfig.io"), - // PrivateEndpointConnections: []*armappconfiguration.PrivateEndpointConnectionReference{ - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armappconfiguration.PublicNetworkAccessDisabled), - // }, - // SKU: &armappconfiguration.SKU{ - // Name: to.Ptr("Standard"), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresListByResourceGroup.json -func ExampleConfigurationStoresClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConfigurationStoresClient().NewListByResourceGroupPager("myResourceGroup", &armappconfiguration.ConfigurationStoresClientListByResourceGroupOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ConfigurationStoreListResult = armappconfiguration.ConfigurationStoreListResult{ - // Value: []*armappconfiguration.ConfigurationStore{ - // { - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armappconfiguration.ConfigurationStoreProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // Encryption: &armappconfiguration.EncryptionProperties{ - // KeyVaultProperties: &armappconfiguration.KeyVaultProperties{ - // }, - // }, - // Endpoint: to.Ptr("https://contoso.azconfig.io"), - // PrivateEndpointConnections: []*armappconfiguration.PrivateEndpointConnectionReference{ - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armappconfiguration.PublicNetworkAccessDisabled), - // }, - // SKU: &armappconfiguration.SKU{ - // Name: to.Ptr("Standard"), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("contoso2"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armappconfiguration.ConfigurationStoreProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T23:06:59.000Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // Encryption: &armappconfiguration.EncryptionProperties{ - // KeyVaultProperties: &armappconfiguration.KeyVaultProperties{ - // }, - // }, - // Endpoint: to.Ptr("https://contoso2.azconfig.io"), - // PrivateEndpointConnections: []*armappconfiguration.PrivateEndpointConnectionReference{ - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armappconfiguration.PublicNetworkAccessDisabled), - // }, - // SKU: &armappconfiguration.SKU{ - // Name: to.Ptr("Standard"), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresGet.json -func ExampleConfigurationStoresClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConfigurationStoresClient().Get(ctx, "myResourceGroup", "contoso", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConfigurationStore = armappconfiguration.ConfigurationStore{ - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Identity: &armappconfiguration.ResourceIdentity{ - // Type: to.Ptr(armappconfiguration.IdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA"), - // TenantID: to.Ptr("BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB"), - // }, - // Properties: &armappconfiguration.ConfigurationStoreProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // Encryption: &armappconfiguration.EncryptionProperties{ - // KeyVaultProperties: &armappconfiguration.KeyVaultProperties{ - // }, - // }, - // Endpoint: to.Ptr("https://contoso.azconfig.io"), - // PrivateEndpointConnections: []*armappconfiguration.PrivateEndpointConnectionReference{ - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armappconfiguration.PublicNetworkAccessDisabled), - // }, - // SKU: &armappconfiguration.SKU{ - // Name: to.Ptr("Standard"), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresCreate.json -func ExampleConfigurationStoresClient_BeginCreate_configurationStoresCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationStoresClient().BeginCreate(ctx, "myResourceGroup", "contoso", armappconfiguration.ConfigurationStore{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "myTag": to.Ptr("myTagValue"), - }, - SKU: &armappconfiguration.SKU{ - Name: to.Ptr("Standard"), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConfigurationStore = armappconfiguration.ConfigurationStore{ - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag": to.Ptr("myTagValue"), - // }, - // Properties: &armappconfiguration.ConfigurationStoreProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // EnablePurgeProtection: to.Ptr(false), - // Encryption: &armappconfiguration.EncryptionProperties{ - // KeyVaultProperties: &armappconfiguration.KeyVaultProperties{ - // }, - // }, - // Endpoint: to.Ptr("https://contoso.azconfig.io"), - // PrivateEndpointConnections: []*armappconfiguration.PrivateEndpointConnectionReference{ - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // SoftDeleteRetentionInDays: to.Ptr[int32](30), - // }, - // SKU: &armappconfiguration.SKU{ - // Name: to.Ptr("Standard"), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresCreateWithIdentity.json -func ExampleConfigurationStoresClient_BeginCreate_configurationStoresCreateWithIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationStoresClient().BeginCreate(ctx, "myResourceGroup", "contoso", armappconfiguration.ConfigurationStore{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "myTag": to.Ptr("myTagValue"), - }, - Identity: &armappconfiguration.ResourceIdentity{ - Type: to.Ptr(armappconfiguration.IdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armappconfiguration.UserIdentity{ - "/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": {}, - }, - }, - SKU: &armappconfiguration.SKU{ - Name: to.Ptr("Standard"), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConfigurationStore = armappconfiguration.ConfigurationStore{ - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag": to.Ptr("myTagValue"), - // }, - // Identity: &armappconfiguration.ResourceIdentity{ - // Type: to.Ptr(armappconfiguration.IdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA"), - // TenantID: to.Ptr("BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB"), - // UserAssignedIdentities: map[string]*armappconfiguration.UserIdentity{ - // "/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": &armappconfiguration.UserIdentity{ - // ClientID: to.Ptr("CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC"), - // PrincipalID: to.Ptr("DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD"), - // }, - // }, - // }, - // Properties: &armappconfiguration.ConfigurationStoreProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // Encryption: &armappconfiguration.EncryptionProperties{ - // KeyVaultProperties: &armappconfiguration.KeyVaultProperties{ - // }, - // }, - // Endpoint: to.Ptr("https://contoso.azconfig.io"), - // PrivateEndpointConnections: []*armappconfiguration.PrivateEndpointConnectionReference{ - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // }, - // SKU: &armappconfiguration.SKU{ - // Name: to.Ptr("Standard"), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresCreateWithLocalAuthDisabled.json -func ExampleConfigurationStoresClient_BeginCreate_configurationStoresCreateWithLocalAuthDisabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationStoresClient().BeginCreate(ctx, "myResourceGroup", "contoso", armappconfiguration.ConfigurationStore{ - Location: to.Ptr("westus"), - Properties: &armappconfiguration.ConfigurationStoreProperties{ - DisableLocalAuth: to.Ptr(true), - }, - SKU: &armappconfiguration.SKU{ - Name: to.Ptr("Standard"), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConfigurationStore = armappconfiguration.ConfigurationStore{ - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armappconfiguration.ConfigurationStoreProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // DisableLocalAuth: to.Ptr(true), - // Encryption: &armappconfiguration.EncryptionProperties{ - // KeyVaultProperties: &armappconfiguration.KeyVaultProperties{ - // }, - // }, - // Endpoint: to.Ptr("https://contoso.azconfig.io"), - // PrivateEndpointConnections: []*armappconfiguration.PrivateEndpointConnectionReference{ - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // }, - // SKU: &armappconfiguration.SKU{ - // Name: to.Ptr("Standard"), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresDelete.json -func ExampleConfigurationStoresClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationStoresClient().BeginDelete(ctx, "myResourceGroup", "contoso", 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/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresUpdate.json -func ExampleConfigurationStoresClient_BeginUpdate_configurationStoresUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationStoresClient().BeginUpdate(ctx, "myResourceGroup", "contoso", armappconfiguration.ConfigurationStoreUpdateParameters{ - SKU: &armappconfiguration.SKU{ - Name: to.Ptr("Standard"), - }, - Tags: map[string]*string{ - "Category": to.Ptr("Marketing"), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConfigurationStore = armappconfiguration.ConfigurationStore{ - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Category": to.Ptr("Marketing"), - // }, - // Properties: &armappconfiguration.ConfigurationStoreProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // Encryption: &armappconfiguration.EncryptionProperties{ - // KeyVaultProperties: &armappconfiguration.KeyVaultProperties{ - // }, - // }, - // Endpoint: to.Ptr("https://contoso.azconfig.io"), - // PrivateEndpointConnections: []*armappconfiguration.PrivateEndpointConnectionReference{ - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armappconfiguration.PublicNetworkAccessDisabled), - // }, - // SKU: &armappconfiguration.SKU{ - // Name: to.Ptr("Standard"), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresUpdateDisableLocalAuth.json -func ExampleConfigurationStoresClient_BeginUpdate_configurationStoresUpdateDisableLocalAuth() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationStoresClient().BeginUpdate(ctx, "myResourceGroup", "contoso", armappconfiguration.ConfigurationStoreUpdateParameters{ - Properties: &armappconfiguration.ConfigurationStorePropertiesUpdateParameters{ - DisableLocalAuth: to.Ptr(true), - }, - SKU: &armappconfiguration.SKU{ - Name: to.Ptr("Standard"), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConfigurationStore = armappconfiguration.ConfigurationStore{ - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armappconfiguration.ConfigurationStoreProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // DisableLocalAuth: to.Ptr(true), - // Encryption: &armappconfiguration.EncryptionProperties{ - // KeyVaultProperties: &armappconfiguration.KeyVaultProperties{ - // }, - // }, - // Endpoint: to.Ptr("https://contoso.azconfig.io"), - // PrivateEndpointConnections: []*armappconfiguration.PrivateEndpointConnectionReference{ - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armappconfiguration.PublicNetworkAccessDisabled), - // }, - // SKU: &armappconfiguration.SKU{ - // Name: to.Ptr("Standard"), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresUpdateWithIdentity.json -func ExampleConfigurationStoresClient_BeginUpdate_configurationStoresUpdateWithIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationStoresClient().BeginUpdate(ctx, "myResourceGroup", "contoso", armappconfiguration.ConfigurationStoreUpdateParameters{ - Identity: &armappconfiguration.ResourceIdentity{ - Type: to.Ptr(armappconfiguration.IdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armappconfiguration.UserIdentity{ - "/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": {}, - }, - }, - SKU: &armappconfiguration.SKU{ - Name: to.Ptr("Standard"), - }, - Tags: map[string]*string{ - "Category": to.Ptr("Marketing"), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConfigurationStore = armappconfiguration.ConfigurationStore{ - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Category": to.Ptr("Marketing"), - // }, - // Identity: &armappconfiguration.ResourceIdentity{ - // Type: to.Ptr(armappconfiguration.IdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA"), - // TenantID: to.Ptr("BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB"), - // UserAssignedIdentities: map[string]*armappconfiguration.UserIdentity{ - // "/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": &armappconfiguration.UserIdentity{ - // ClientID: to.Ptr("CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC"), - // PrincipalID: to.Ptr("DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD"), - // }, - // }, - // }, - // Properties: &armappconfiguration.ConfigurationStoreProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // Encryption: &armappconfiguration.EncryptionProperties{ - // KeyVaultProperties: &armappconfiguration.KeyVaultProperties{ - // }, - // }, - // Endpoint: to.Ptr("https://contoso.azconfig.io"), - // PrivateEndpointConnections: []*armappconfiguration.PrivateEndpointConnectionReference{ - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armappconfiguration.PublicNetworkAccessDisabled), - // }, - // SKU: &armappconfiguration.SKU{ - // Name: to.Ptr("Standard"), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresListKeys.json -func ExampleConfigurationStoresClient_NewListKeysPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConfigurationStoresClient().NewListKeysPager("myResourceGroup", "contoso", &armappconfiguration.ConfigurationStoresClientListKeysOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.APIKeyListResult = armappconfiguration.APIKeyListResult{ - // Value: []*armappconfiguration.APIKey{ - // { - // Name: to.Ptr("Primary"), - // ConnectionString: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), - // ID: to.Ptr("439AD01B4BE67DB1"), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:54.000Z"); return t}()), - // ReadOnly: to.Ptr(false), - // Value: to.Ptr("000000000000000000000000000000000000000000000000000000"), - // }, - // { - // Name: to.Ptr("Secondary"), - // ConnectionString: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), - // ID: to.Ptr("CB45E100456857B9"), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:54.000Z"); return t}()), - // ReadOnly: to.Ptr(false), - // Value: to.Ptr("000000000000000000000000000000000000000000000000000000"), - // }, - // { - // Name: to.Ptr("Primary Read Only"), - // ConnectionString: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), - // ID: to.Ptr("B3AC55B7E71431A9"), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:54.000Z"); return t}()), - // ReadOnly: to.Ptr(true), - // Value: to.Ptr("000000000000000000000000000000000000000000000000000000"), - // }, - // { - // Name: to.Ptr("Secondary Read Only"), - // ConnectionString: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), - // ID: to.Ptr("E2AF6A9A89DCC177"), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:54.000Z"); return t}()), - // ReadOnly: to.Ptr(true), - // Value: to.Ptr("000000000000000000000000000000000000000000000000000000"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresRegenerateKey.json -func ExampleConfigurationStoresClient_RegenerateKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConfigurationStoresClient().RegenerateKey(ctx, "myResourceGroup", "contoso", armappconfiguration.RegenerateKeyParameters{ - ID: to.Ptr("439AD01B4BE67DB1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.APIKey = armappconfiguration.APIKey{ - // Name: to.Ptr("Primary"), - // ConnectionString: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), - // ID: to.Ptr("439AD01B4BE67DB1"), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-26T22:59:24.237Z"); return t}()), - // ReadOnly: to.Ptr(false), - // Value: to.Ptr("000000000000000000000000000000000000000000000000000000"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/DeletedConfigurationStoresList.json -func ExampleConfigurationStoresClient_NewListDeletedPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConfigurationStoresClient().NewListDeletedPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeletedConfigurationStoreListResult = armappconfiguration.DeletedConfigurationStoreListResult{ - // Value: []*armappconfiguration.DeletedConfigurationStore{ - // { - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.AppConfiguration/deletedConfigurationStores"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/providers/Microsoft.AppConfiguration/locations/westus/deletedConfigurationStores/contoso"), - // Properties: &armappconfiguration.DeletedConfigurationStoreProperties{ - // ConfigurationStoreID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso"), - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-01T00:00:59.000Z"); return t}()), - // Location: to.Ptr("westus"), - // PurgeProtectionEnabled: to.Ptr(true), - // ScheduledPurgeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-01T00:00:59.000Z"); return t}()), - // Tags: map[string]*string{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/DeletedConfigurationStoresGet.json -func ExampleConfigurationStoresClient_GetDeleted() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConfigurationStoresClient().GetDeleted(ctx, "westus", "contoso", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeletedConfigurationStore = armappconfiguration.DeletedConfigurationStore{ - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.AppConfiguration/deletedConfigurationStores"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/providers/Microsoft.AppConfiguration/locations/westus/deletedConfigurationStores/contoso"), - // Properties: &armappconfiguration.DeletedConfigurationStoreProperties{ - // ConfigurationStoreID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso"), - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-01T00:00:59.000Z"); return t}()), - // Location: to.Ptr("westus"), - // PurgeProtectionEnabled: to.Ptr(true), - // ScheduledPurgeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-01T00:00:59.000Z"); return t}()), - // Tags: map[string]*string{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/DeletedConfigurationStoresPurge.json -func ExampleConfigurationStoresClient_BeginPurgeDeleted() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationStoresClient().BeginPurgeDeleted(ctx, "westus", "contoso", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/constants.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/constants.go index f542ebf3aa26..b13cbbb0aaf1 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/constants.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/constants.go @@ -10,7 +10,7 @@ package armappconfiguration const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appconfiguration/armappconfiguration" - moduleVersion = "v2.1.0" + moduleVersion = "v2.2.0-beta.1" ) // ActionsRequired - Any action that is required beyond basic workflow (approve/ reject/ disconnect) @@ -29,6 +29,46 @@ func PossibleActionsRequiredValues() []ActionsRequired { } } +// AuthenticationMode - The data plane proxy authentication mode. This property manages the authentication mode of request +// to the data plane resources. +type AuthenticationMode string + +const ( + // AuthenticationModeLocal - The local authentication mode. Users are not required to have data plane permissions if local + // authentication is not disabled. + AuthenticationModeLocal AuthenticationMode = "Local" + // AuthenticationModePassThrough - The pass-through authentication mode. User identity will be passed through from Azure Resource + // Manager (ARM), requiring user to have data plane action permissions (Available via App Configuration Data Owner/ App Configuration + // Data Reader). + AuthenticationModePassThrough AuthenticationMode = "Pass-through" +) + +// PossibleAuthenticationModeValues returns the possible values for the AuthenticationMode const type. +func PossibleAuthenticationModeValues() []AuthenticationMode { + return []AuthenticationMode{ + AuthenticationModeLocal, + AuthenticationModePassThrough, + } +} + +// CompositionType - The composition type describes how the key-values within the snapshot are composed. The 'key' composition +// type ensures there are no two key-values containing the same key. The 'key_label' composition +// type ensures there are no two key-values containing the same key and label. +type CompositionType string + +const ( + CompositionTypeKey CompositionType = "Key" + CompositionTypeKeyLabel CompositionType = "Key_Label" +) + +// PossibleCompositionTypeValues returns the possible values for the CompositionType const type. +func PossibleCompositionTypeValues() []CompositionType { + return []CompositionType{ + CompositionTypeKey, + CompositionTypeKeyLabel, + } +} + // ConfigurationResourceType - The resource type to check for name availability. type ConfigurationResourceType string @@ -121,6 +161,26 @@ func PossibleIdentityTypeValues() []IdentityType { } } +// PrivateLinkDelegation - The data plane proxy private link delegation. This property manages if a request from delegated +// Azure Resource Manager (ARM) private link is allowed when the data plane resource requires private link. +type PrivateLinkDelegation string + +const ( + // PrivateLinkDelegationDisabled - Request is denied if the resource requires private link. + PrivateLinkDelegationDisabled PrivateLinkDelegation = "Disabled" + // PrivateLinkDelegationEnabled - Azure Resource Manager (ARM) private endpoint is required if the resource requires private + // link. + PrivateLinkDelegationEnabled PrivateLinkDelegation = "Enabled" +) + +// PossiblePrivateLinkDelegationValues returns the possible values for the PrivateLinkDelegation const type. +func PossiblePrivateLinkDelegationValues() []PrivateLinkDelegation { + return []PrivateLinkDelegation{ + PrivateLinkDelegationDisabled, + PrivateLinkDelegationEnabled, + } +} + // ProvisioningState - The provisioning state of the configuration store. type ProvisioningState string @@ -182,3 +242,73 @@ func PossibleReplicaProvisioningStateValues() []ReplicaProvisioningState { ReplicaProvisioningStateSucceeded, } } + +type ResourceType string + +const ( + ResourceTypeKv ResourceType = "Kv" + ResourceTypeSnapshot ResourceType = "Snapshot" +) + +// PossibleResourceTypeValues returns the possible values for the ResourceType const type. +func PossibleResourceTypeValues() []ResourceType { + return []ResourceType{ + ResourceTypeKv, + ResourceTypeSnapshot, + } +} + +// SasKind - The kind of the SAS token. +type SasKind string + +const ( + SasKindPrimary SasKind = "Primary" + SasKindSecondary SasKind = "Secondary" +) + +// PossibleSasKindValues returns the possible values for the SasKind const type. +func PossibleSasKindValues() []SasKind { + return []SasKind{ + SasKindPrimary, + SasKindSecondary, + } +} + +// SasStatus - The status of the SAS token authentication. This property manages if SAS token authentication is enabled or +// disabled. +type SasStatus string + +const ( + // SasStatusDisabled - SAS token authentication is disabled. + SasStatusDisabled SasStatus = "Disabled" + // SasStatusEnabled - SAS token authentication is enabled. + SasStatusEnabled SasStatus = "Enabled" +) + +// PossibleSasStatusValues returns the possible values for the SasStatus const type. +func PossibleSasStatusValues() []SasStatus { + return []SasStatus{ + SasStatusDisabled, + SasStatusEnabled, + } +} + +// SnapshotStatus - The current status of the snapshot. +type SnapshotStatus string + +const ( + SnapshotStatusArchived SnapshotStatus = "Archived" + SnapshotStatusFailed SnapshotStatus = "Failed" + SnapshotStatusProvisioning SnapshotStatus = "Provisioning" + SnapshotStatusReady SnapshotStatus = "Ready" +) + +// PossibleSnapshotStatusValues returns the possible values for the SnapshotStatus const type. +func PossibleSnapshotStatusValues() []SnapshotStatus { + return []SnapshotStatus{ + SnapshotStatusArchived, + SnapshotStatusFailed, + SnapshotStatusProvisioning, + SnapshotStatusReady, + } +} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/configurationstores_server.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/configurationstores_server.go index 744b0facb9ba..ef94a7571e81 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/configurationstores_server.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/configurationstores_server.go @@ -32,6 +32,10 @@ type ConfigurationStoresServer struct { // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, configStoreName string, options *armappconfiguration.ConfigurationStoresClientBeginDeleteOptions) (resp azfake.PollerResponder[armappconfiguration.ConfigurationStoresClientDeleteResponse], errResp azfake.ErrorResponder) + // GenerateSasToken is the fake for method ConfigurationStoresClient.GenerateSasToken + // HTTP status codes to indicate success: http.StatusOK + GenerateSasToken func(ctx context.Context, resourceGroupName string, configStoreName string, sasTokenGenerationParameters armappconfiguration.SasTokenGenerationParameters, options *armappconfiguration.ConfigurationStoresClientGenerateSasTokenOptions) (resp azfake.Responder[armappconfiguration.ConfigurationStoresClientGenerateSasTokenResponse], errResp azfake.ErrorResponder) + // Get is the fake for method ConfigurationStoresClient.Get // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, configStoreName string, options *armappconfiguration.ConfigurationStoresClientGetOptions) (resp azfake.Responder[armappconfiguration.ConfigurationStoresClientGetResponse], errResp azfake.ErrorResponder) @@ -64,6 +68,10 @@ type ConfigurationStoresServer struct { // HTTP status codes to indicate success: http.StatusOK RegenerateKey func(ctx context.Context, resourceGroupName string, configStoreName string, regenerateKeyParameters armappconfiguration.RegenerateKeyParameters, options *armappconfiguration.ConfigurationStoresClientRegenerateKeyOptions) (resp azfake.Responder[armappconfiguration.ConfigurationStoresClientRegenerateKeyResponse], errResp azfake.ErrorResponder) + // ResetSasKind is the fake for method ConfigurationStoresClient.ResetSasKind + // HTTP status codes to indicate success: http.StatusOK + ResetSasKind func(ctx context.Context, resourceGroupName string, configStoreName string, resetSasKindParameters armappconfiguration.ResetSasKindParameters, options *armappconfiguration.ConfigurationStoresClientResetSasKindOptions) (resp azfake.Responder[armappconfiguration.ConfigurationStoresClientResetSasKindResponse], errResp azfake.ErrorResponder) + // BeginUpdate is the fake for method ConfigurationStoresClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated BeginUpdate func(ctx context.Context, resourceGroupName string, configStoreName string, configStoreUpdateParameters armappconfiguration.ConfigurationStoreUpdateParameters, options *armappconfiguration.ConfigurationStoresClientBeginUpdateOptions) (resp azfake.PollerResponder[armappconfiguration.ConfigurationStoresClientUpdateResponse], errResp azfake.ErrorResponder) @@ -116,6 +124,8 @@ func (c *ConfigurationStoresServerTransport) Do(req *http.Request) (*http.Respon resp, err = c.dispatchBeginCreate(req) case "ConfigurationStoresClient.BeginDelete": resp, err = c.dispatchBeginDelete(req) + case "ConfigurationStoresClient.GenerateSasToken": + resp, err = c.dispatchGenerateSasToken(req) case "ConfigurationStoresClient.Get": resp, err = c.dispatchGet(req) case "ConfigurationStoresClient.GetDeleted": @@ -132,6 +142,8 @@ func (c *ConfigurationStoresServerTransport) Do(req *http.Request) (*http.Respon resp, err = c.dispatchBeginPurgeDeleted(req) case "ConfigurationStoresClient.RegenerateKey": resp, err = c.dispatchRegenerateKey(req) + case "ConfigurationStoresClient.ResetSasKind": + resp, err = c.dispatchResetSasKind(req) case "ConfigurationStoresClient.BeginUpdate": resp, err = c.dispatchBeginUpdate(req) default: @@ -237,6 +249,43 @@ func (c *ConfigurationStoresServerTransport) dispatchBeginDelete(req *http.Reque return resp, nil } +func (c *ConfigurationStoresServerTransport) dispatchGenerateSasToken(req *http.Request) (*http.Response, error) { + if c.srv.GenerateSasToken == nil { + return nil, &nonRetriableError{errors.New("fake for method GenerateSasToken not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AppConfiguration/configurationStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generateSasToken` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armappconfiguration.SasTokenGenerationParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + configStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.GenerateSasToken(req.Context(), resourceGroupNameParam, configStoreNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SasTokenGenerationResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (c *ConfigurationStoresServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if c.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} @@ -564,6 +613,43 @@ func (c *ConfigurationStoresServerTransport) dispatchRegenerateKey(req *http.Req return resp, nil } +func (c *ConfigurationStoresServerTransport) dispatchResetSasKind(req *http.Request) (*http.Response, error) { + if c.srv.ResetSasKind == nil { + return nil, &nonRetriableError{errors.New("fake for method ResetSasKind not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AppConfiguration/configurationStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resetSasKind` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armappconfiguration.ResetSasKindParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + configStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.ResetSasKind(req.Context(), resourceGroupNameParam, configStoreNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConfigurationStore, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (c *ConfigurationStoresServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { if c.srv.BeginUpdate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/server_factory.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/server_factory.go index af2118aa5a1b..7115d6c61fad 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/server_factory.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/server_factory.go @@ -25,6 +25,7 @@ type ServerFactory struct { PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer PrivateLinkResourcesServer PrivateLinkResourcesServer ReplicasServer ReplicasServer + SnapshotsServer SnapshotsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -47,6 +48,7 @@ type ServerFactoryTransport struct { trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport trReplicasServer *ReplicasServerTransport + trSnapshotsServer *SnapshotsServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -86,6 +88,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "ReplicasClient": initServer(s, &s.trReplicasServer, func() *ReplicasServerTransport { return NewReplicasServerTransport(&s.srv.ReplicasServer) }) resp, err = s.trReplicasServer.Do(req) + case "SnapshotsClient": + initServer(s, &s.trSnapshotsServer, func() *SnapshotsServerTransport { return NewSnapshotsServerTransport(&s.srv.SnapshotsServer) }) + resp, err = s.trSnapshotsServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/snapshots_server.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/snapshots_server.go new file mode 100644 index 000000000000..0abaabf7816c --- /dev/null +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/snapshots_server.go @@ -0,0 +1,166 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appconfiguration/armappconfiguration/v2" + "net/http" + "net/url" + "regexp" +) + +// SnapshotsServer is a fake server for instances of the armappconfiguration.SnapshotsClient type. +type SnapshotsServer struct { + // BeginCreate is the fake for method SnapshotsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, configStoreName string, snapshotName string, body armappconfiguration.Snapshot, options *armappconfiguration.SnapshotsClientBeginCreateOptions) (resp azfake.PollerResponder[armappconfiguration.SnapshotsClientCreateResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SnapshotsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, configStoreName string, snapshotName string, options *armappconfiguration.SnapshotsClientGetOptions) (resp azfake.Responder[armappconfiguration.SnapshotsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewSnapshotsServerTransport creates a new instance of SnapshotsServerTransport with the provided implementation. +// The returned SnapshotsServerTransport instance is connected to an instance of armappconfiguration.SnapshotsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSnapshotsServerTransport(srv *SnapshotsServer) *SnapshotsServerTransport { + return &SnapshotsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armappconfiguration.SnapshotsClientCreateResponse]](), + } +} + +// SnapshotsServerTransport connects instances of armappconfiguration.SnapshotsClient to instances of SnapshotsServer. +// Don't use this type directly, use NewSnapshotsServerTransport instead. +type SnapshotsServerTransport struct { + srv *SnapshotsServer + beginCreate *tracker[azfake.PollerResponder[armappconfiguration.SnapshotsClientCreateResponse]] +} + +// Do implements the policy.Transporter interface for SnapshotsServerTransport. +func (s *SnapshotsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SnapshotsClient.BeginCreate": + resp, err = s.dispatchBeginCreate(req) + case "SnapshotsClient.Get": + resp, err = s.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SnapshotsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := s.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AppConfiguration/configurationStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/snapshots/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armappconfiguration.Snapshot](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + configStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configStoreName")]) + if err != nil { + return nil, err + } + snapshotNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("snapshotName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreate(req.Context(), resourceGroupNameParam, configStoreNameParam, snapshotNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + s.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + s.beginCreate.remove(req) + } + + return resp, nil +} + +func (s *SnapshotsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AppConfiguration/configurationStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/snapshots/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + configStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configStoreName")]) + if err != nil { + return nil, err + } + snapshotNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("snapshotName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, configStoreNameParam, snapshotNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Snapshot, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/time_rfc3339.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/time_rfc3339.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/fake/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/go.mod b/sdk/resourcemanager/appconfiguration/armappconfiguration/go.mod index abe310dd491a..88c163ea18bb 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/go.mod +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/go.mod @@ -4,7 +4,6 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/interfaces.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/interfaces.go new file mode 100644 index 000000000000..8f406b3c4475 --- /dev/null +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/interfaces.go @@ -0,0 +1,18 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armappconfiguration + +// SasTokenScopeClassification provides polymorphic access to related types. +// Call the interface's GetSasTokenScope() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *KvSasTokenScope, *SasTokenScope, *SnapshotSasTokenScope +type SasTokenScopeClassification interface { + // GetSasTokenScope returns the SasTokenScope content of the underlying type. + GetSasTokenScope() *SasTokenScope +} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/keyvalues_client.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/keyvalues_client.go index 4749500d1600..02d3a3eca468 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/keyvalues_client.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/keyvalues_client.go @@ -43,10 +43,11 @@ func NewKeyValuesClient(subscriptionID string, credential azcore.TokenCredential return client, nil } -// CreateOrUpdate - Creates a key-value. +// CreateOrUpdate - Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For all other +// scenarios involving App Configuration key-values the data plane API should be used instead. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - keyValueName - Identifier of key and label combination. Key and label are joined by $ character. Label is optional. @@ -98,7 +99,7 @@ func (client *KeyValuesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.KeyValueParameters != nil { @@ -119,10 +120,11 @@ func (client *KeyValuesClient) createOrUpdateHandleResponse(resp *http.Response) return result, nil } -// BeginDelete - Deletes a key-value. +// BeginDelete - Deletes a key-value. NOTE: This operation is intended for use in ARM Template deployments. For all other +// scenarios involving App Configuration key-values the data plane API should be used instead. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - keyValueName - Identifier of key and label combination. Key and label are joined by $ character. Label is optional. @@ -144,10 +146,11 @@ func (client *KeyValuesClient) BeginDelete(ctx context.Context, resourceGroupNam } } -// Delete - Deletes a key-value. +// Delete - Deletes a key-value. NOTE: This operation is intended for use in ARM Template deployments. For all other scenarios +// involving App Configuration key-values the data plane API should be used instead. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview func (client *KeyValuesClient) deleteOperation(ctx context.Context, resourceGroupName string, configStoreName string, keyValueName string, options *KeyValuesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "KeyValuesClient.BeginDelete" @@ -193,16 +196,18 @@ func (client *KeyValuesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Get - Gets the properties of the specified key-value. +// Get - Gets the properties of the specified key-value. NOTE: This operation is intended for use in ARM Template deployments. +// For all other scenarios involving App Configuration key-values the data plane API +// should be used instead. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - keyValueName - Identifier of key and label combination. Key and label are joined by $ character. Label is optional. @@ -253,7 +258,7 @@ func (client *KeyValuesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/keyvalues_client_example_test.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/keyvalues_client_example_test.go deleted file mode 100644 index 788ef56d6a8c..000000000000 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/keyvalues_client_example_test.go +++ /dev/null @@ -1,125 +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. -// DO NOT EDIT. - -package armappconfiguration_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/appconfiguration/armappconfiguration/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresGetKeyValue.json -func ExampleKeyValuesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewKeyValuesClient().Get(ctx, "myResourceGroup", "contoso", "myKey$myLabel", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.KeyValue = armappconfiguration.KeyValue{ - // Name: to.Ptr("myKey$myLabel"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores/keyValues"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso/keyValues/myKey$myLabel"), - // Properties: &armappconfiguration.KeyValueProperties{ - // ContentType: to.Ptr(""), - // ETag: to.Ptr("IhDxoa8VkXxPsYsemBlxvV0d5fp"), - // Key: to.Ptr("myKey"), - // Label: to.Ptr("myLabel"), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-23T06:42:24.000Z"); return t}()), - // Locked: to.Ptr(false), - // Tags: map[string]*string{ - // "tag1": to.Ptr("tagValue1"), - // "tag2": to.Ptr("tagValue2"), - // }, - // Value: to.Ptr("myValue"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresCreateKeyValue.json -func ExampleKeyValuesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewKeyValuesClient().CreateOrUpdate(ctx, "myResourceGroup", "contoso", "myKey$myLabel", &armappconfiguration.KeyValuesClientCreateOrUpdateOptions{KeyValueParameters: &armappconfiguration.KeyValue{ - Properties: &armappconfiguration.KeyValueProperties{ - Tags: map[string]*string{ - "tag1": to.Ptr("tagValue1"), - "tag2": to.Ptr("tagValue2"), - }, - Value: to.Ptr("myValue"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.KeyValue = armappconfiguration.KeyValue{ - // Name: to.Ptr("myKey$myLabel"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores/keyValues"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso/keyValues/myKey$myLabel"), - // Properties: &armappconfiguration.KeyValueProperties{ - // ContentType: to.Ptr(""), - // ETag: to.Ptr("IhDxoa8VkXxPsYsemBlxvV0d5fp"), - // Key: to.Ptr("myKey"), - // Label: to.Ptr("myLabel"), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-23T06:42:24.000Z"); return t}()), - // Locked: to.Ptr(false), - // Tags: map[string]*string{ - // "tag1": to.Ptr("tagValue1"), - // "tag2": to.Ptr("tagValue2"), - // }, - // Value: to.Ptr("myValue"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresDeleteKeyValue.json -func ExampleKeyValuesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewKeyValuesClient().BeginDelete(ctx, "myResourceGroup", "contoso", "myKey$myLabel", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/models.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/models.go index 95e6f3fa29f0..65a2bad841eb 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/models.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/models.go @@ -94,7 +94,10 @@ type ConfigurationStoreProperties struct { // Indicates whether the configuration store need to be recovered. CreateMode *CreateMode - // Disables all authentication methods other than AAD authentication. + // Property specifying the configuration of data plane proxy for Azure Resource Manager (ARM). + DataPlaneProxy *DataPlaneProxyProperties + + // Disables access key authentication. DisableLocalAuth *bool // Property specifying whether protection against purge is enabled for this configuration store. @@ -103,12 +106,21 @@ type ConfigurationStoreProperties struct { // The encryption settings of the configuration store. Encryption *EncryptionProperties + // Property specifying the configuration of experimentation for this configuration store + Experimentation *ExperimentationProperties + // Control permission for data plane traffic coming from public networks while private endpoint is enabled. PublicNetworkAccess *PublicNetworkAccess + // The SAS authentication settings of the configuration store. + Sas *SasProperties + // The amount of time in days that the configuration store will be retained when it is soft deleted. SoftDeleteRetentionInDays *int32 + // Property specifying the configuration of telemetry for this configuration store + Telemetry *TelemetryProperties + // READ-ONLY; The creation date of configuration store. CreationDate *time.Time @@ -124,7 +136,10 @@ type ConfigurationStoreProperties struct { // ConfigurationStorePropertiesUpdateParameters - The properties for updating a configuration store. type ConfigurationStorePropertiesUpdateParameters struct { - // Disables all authentication methods other than AAD authentication. + // Property specifying the configuration of data plane proxy for Azure Resource Manager (ARM). + DataPlaneProxy *DataPlaneProxyProperties + + // Disables access key authentication. DisableLocalAuth *bool // Property specifying whether protection against purge is enabled for this configuration store. @@ -133,8 +148,17 @@ type ConfigurationStorePropertiesUpdateParameters struct { // The encryption settings of the configuration store. Encryption *EncryptionProperties + // Property specifying the configuration of experimentation to update for this configuration store + Experimentation *ExperimentationProperties + // Control permission for data plane traffic coming from public networks while private endpoint is enabled. PublicNetworkAccess *PublicNetworkAccess + + // The SAS authentication settings of the configuration store. + Sas *SasProperties + + // Property specifying the configuration of telemetry to update for this configuration store + Telemetry *TelemetryProperties } // ConfigurationStoreUpdateParameters - The parameters for updating a configuration store. @@ -152,6 +176,16 @@ type ConfigurationStoreUpdateParameters struct { Tags map[string]*string } +// DataPlaneProxyProperties - The data plane proxy settings for a configuration store. +type DataPlaneProxyProperties struct { + // The data plane proxy authentication mode. This property manages the authentication mode of request to the data plane resources. + AuthenticationMode *AuthenticationMode + + // The data plane proxy private link delegation. This property manages if a request from delegated Azure Resource Manager + // (ARM) private link is allowed when the data plane resource requires private link. + PrivateLinkDelegation *PrivateLinkDelegation +} + // DeletedConfigurationStore - Deleted configuration store information with extended details. type DeletedConfigurationStore struct { // Properties of the deleted configuration store @@ -212,6 +246,24 @@ type ErrorAdditionalInfo struct { Type *string } +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + // ErrorDetails - The details of the error. type ErrorDetails struct { // READ-ONLY; The error additional info. @@ -231,6 +283,22 @@ type ErrorResponse struct { Error *ErrorDetails } +// ErrorResponseAutoGenerated - Common error response for all Azure Resource Manager APIs to return error details for failed +// operations. (This also follows the OData error response format.). +type ErrorResponseAutoGenerated struct { + // The error object. + Error *ErrorDetail +} + +// ExperimentationProperties - Experimentation settings +type ExperimentationProperties struct { + // The data plane endpoint of the Split experimentation workspace resource where experimentation data can be retrieved + DataPlaneEndpoint *string + + // Resource ID of a resource enabling experimentation + ResourceID *string +} + // KeyValue - The key-value resource along with all resource properties. type KeyValue struct { // All key-value properties. @@ -246,6 +314,15 @@ type KeyValue struct { Type *string } +// KeyValueFilter - Enables filtering of key-values. +type KeyValueFilter struct { + // REQUIRED; Filters key-values by their key field. + Key *string + + // Filters key-values by their label field. + Label *string +} + // KeyValueListResult - The result of a request to list key-values. type KeyValueListResult struct { // The URI that can be used to request the next set of paged results. @@ -292,6 +369,28 @@ type KeyVaultProperties struct { KeyIdentifier *string } +// KvSasTokenScope - The key value resource scope that the SAS token is authorized to access. +type KvSasTokenScope struct { + // REQUIRED + ResourceType *ResourceType + + // A filter used to match keys. Syntax reference: https://aka.ms/azconfig/docs/keyvaluefiltering. + Key *string + + // A filter used to match labels. Syntax reference: https://aka.ms/azconfig/docs/keyvaluefiltering. + Label *string + + // An array of tag filters used to match tags. + Tags []*string +} + +// GetSasTokenScope implements the SasTokenScopeClassification interface for type KvSasTokenScope. +func (k *KvSasTokenScope) GetSasTokenScope() *SasTokenScope { + return &SasTokenScope{ + ResourceType: k.ResourceType, + } +} + // LogSpecification - Specifications of the Log for Azure Monitoring type LogSpecification struct { // Blob duration of the log @@ -553,6 +652,12 @@ type ReplicaProperties struct { ProvisioningState *ReplicaProvisioningState } +// ResetSasKindParameters - Parameters used for resetting SAS kind. +type ResetSasKindParameters struct { + // REQUIRED; The kind of the SAS token. + Name *SasKind +} + // 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} @@ -591,6 +696,72 @@ type SKU struct { Name *string } +// SasKindInfo - Information about a specific kind of SAS token. +type SasKindInfo struct { + // READ-ONLY; The last reset time of all tokens of the specified SAS kind. + LastModifiedAt *time.Time + + // READ-ONLY; The kind of the SAS token. + Name *SasKind +} + +// SasProperties - The SAS authentication settings of the configuration store. +type SasProperties struct { + // The status of the SAS token authentication. This property manages if SAS token authentication is enabled or disabled. + Status *SasStatus + + // READ-ONLY; Information about different kinds of SAS token. + Kinds []*SasKindInfo +} + +// SasTokenGenerationParameters - Parameters used for generating SAS token. +type SasTokenGenerationParameters struct { + // REQUIRED; The time that the SAS token expires in the Universal ISO 8601 DateTime format. Max allowed expiration is 1 year + // from the time of token creation. + Expires *time.Time + + // REQUIRED; The kind of the SAS token. + Kind *SasKind + + // REQUIRED; The data plane resource scope that the SAS token is authorized to access. + SasTokenScope SasTokenScopeClassification + + // Time (in seconds) for which the data plane response may be cached by clients. App Configuration sets the Cache-Control + // response header max-age to the value that's specified on the SAS token. See + // rfc9111 [https://www.rfc-editor.org/rfc/rfc9111#name-max-age-2] for more details. + CacheControlMaxAge *float32 +} + +// SasTokenGenerationResult - The result of a request to generate a SAS token. +type SasTokenGenerationResult struct { + // READ-ONLY; Time (in seconds) for which the data plane response may be cached by clients. App Configuration sets the Cache-Control + // response header max-age to the value that's specified on the SAS token. See + // rfc9111 [https://www.rfc-editor.org/rfc/rfc9111#name-max-age-2] for more details. + CacheControlMaxAge *float32 + + // READ-ONLY; The time that the SAS token expires in the Universal ISO 8601 DateTime format. Max allowed expiration is 1 year + // from the time of token creation. + Expires *time.Time + + // READ-ONLY; The kind of the SAS token. + Kind *SasKind + + // READ-ONLY; The data plane resource scope that the SAS token is authorized to access. + SasTokenScope SasTokenScopeClassification + + // READ-ONLY; The value of the SAS token. + Value *string +} + +// SasTokenScope - The data plane resource scope that the SAS token is authorized to access. +type SasTokenScope struct { + // REQUIRED + ResourceType *ResourceType +} + +// GetSasTokenScope implements the SasTokenScopeClassification interface for type SasTokenScope. +func (s *SasTokenScope) GetSasTokenScope() *SasTokenScope { return s } + // ServiceSpecification - Service specification payload type ServiceSpecification struct { // Specifications of the Log for Azure Monitoring @@ -600,6 +771,77 @@ type ServiceSpecification struct { MetricSpecifications []*MetricSpecification } +// Snapshot - The snapshot resource. +type Snapshot struct { + // All snapshot properties. + Properties *SnapshotProperties + + // READ-ONLY; The resource ID. + ID *string + + // READ-ONLY; The name of the snapshot. + Name *string + + // READ-ONLY; The type of the resource. + Type *string +} + +// SnapshotProperties - All snapshot properties. +type SnapshotProperties struct { + // REQUIRED; A list of filters used to filter the key-values included in the snapshot. + Filters []*KeyValueFilter + + // The composition type describes how the key-values within the snapshot are composed. The 'key' composition type ensures + // there are no two key-values containing the same key. The 'key_label' composition + // type ensures there are no two key-values containing the same key and label. + CompositionType *CompositionType + + // The amount of time, in seconds, that a snapshot will remain in the archived state before expiring. This property is only + // writable during the creation of a snapshot. If not specified, the default + // lifetime of key-value revisions will be used. + RetentionPeriod *int64 + + // The tags of the snapshot. NOTE: These are data plane tags, not Azure Resource Manager (ARM) tags. + Tags map[string]*string + + // READ-ONLY; The time that the snapshot was created. + Created *time.Time + + // READ-ONLY; A value representing the current state of the snapshot. + Etag *string + + // READ-ONLY; The time that the snapshot will expire. + Expires *time.Time + + // READ-ONLY; The amount of key-values in the snapshot. + ItemsCount *int64 + + // READ-ONLY; The provisioning state of the snapshot. + ProvisioningState *ProvisioningState + + // READ-ONLY; The size in bytes of the snapshot. + Size *int64 + + // READ-ONLY; The current status of the snapshot. + Status *SnapshotStatus +} + +// SnapshotSasTokenScope - The snapshot resource scope that the SAS token is authorized to access. +type SnapshotSasTokenScope struct { + // REQUIRED; The name of the snapshot. + Name *string + + // REQUIRED + ResourceType *ResourceType +} + +// GetSasTokenScope implements the SasTokenScopeClassification interface for type SnapshotSasTokenScope. +func (s *SnapshotSasTokenScope) GetSasTokenScope() *SasTokenScope { + return &SasTokenScope{ + ResourceType: s.ResourceType, + } +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -621,6 +863,12 @@ type SystemData struct { LastModifiedByType *CreatedByType } +// TelemetryProperties - Telemetry settings +type TelemetryProperties struct { + // Resource ID of a resource enabling telemetry collection + ResourceID *string +} + // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/models_serde.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/models_serde.go index d05546922439..5d4c60504d40 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/models_serde.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/models_serde.go @@ -219,14 +219,18 @@ func (c ConfigurationStoreProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "createMode", c.CreateMode) populateDateTimeRFC3339(objectMap, "creationDate", c.CreationDate) + populate(objectMap, "dataPlaneProxy", c.DataPlaneProxy) populate(objectMap, "disableLocalAuth", c.DisableLocalAuth) populate(objectMap, "enablePurgeProtection", c.EnablePurgeProtection) populate(objectMap, "encryption", c.Encryption) populate(objectMap, "endpoint", c.Endpoint) + populate(objectMap, "experimentation", c.Experimentation) populate(objectMap, "privateEndpointConnections", c.PrivateEndpointConnections) populate(objectMap, "provisioningState", c.ProvisioningState) populate(objectMap, "publicNetworkAccess", c.PublicNetworkAccess) + populate(objectMap, "sas", c.Sas) populate(objectMap, "softDeleteRetentionInDays", c.SoftDeleteRetentionInDays) + populate(objectMap, "telemetry", c.Telemetry) return json.Marshal(objectMap) } @@ -245,6 +249,9 @@ func (c *ConfigurationStoreProperties) UnmarshalJSON(data []byte) error { case "creationDate": err = unpopulateDateTimeRFC3339(val, "CreationDate", &c.CreationDate) delete(rawMsg, key) + case "dataPlaneProxy": + err = unpopulate(val, "DataPlaneProxy", &c.DataPlaneProxy) + delete(rawMsg, key) case "disableLocalAuth": err = unpopulate(val, "DisableLocalAuth", &c.DisableLocalAuth) delete(rawMsg, key) @@ -257,6 +264,9 @@ func (c *ConfigurationStoreProperties) UnmarshalJSON(data []byte) error { case "endpoint": err = unpopulate(val, "Endpoint", &c.Endpoint) delete(rawMsg, key) + case "experimentation": + err = unpopulate(val, "Experimentation", &c.Experimentation) + delete(rawMsg, key) case "privateEndpointConnections": err = unpopulate(val, "PrivateEndpointConnections", &c.PrivateEndpointConnections) delete(rawMsg, key) @@ -266,9 +276,15 @@ func (c *ConfigurationStoreProperties) UnmarshalJSON(data []byte) error { case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &c.PublicNetworkAccess) delete(rawMsg, key) + case "sas": + err = unpopulate(val, "Sas", &c.Sas) + delete(rawMsg, key) case "softDeleteRetentionInDays": err = unpopulate(val, "SoftDeleteRetentionInDays", &c.SoftDeleteRetentionInDays) delete(rawMsg, key) + case "telemetry": + err = unpopulate(val, "Telemetry", &c.Telemetry) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -280,10 +296,14 @@ func (c *ConfigurationStoreProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ConfigurationStorePropertiesUpdateParameters. func (c ConfigurationStorePropertiesUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "dataPlaneProxy", c.DataPlaneProxy) populate(objectMap, "disableLocalAuth", c.DisableLocalAuth) populate(objectMap, "enablePurgeProtection", c.EnablePurgeProtection) populate(objectMap, "encryption", c.Encryption) + populate(objectMap, "experimentation", c.Experimentation) populate(objectMap, "publicNetworkAccess", c.PublicNetworkAccess) + populate(objectMap, "sas", c.Sas) + populate(objectMap, "telemetry", c.Telemetry) return json.Marshal(objectMap) } @@ -296,6 +316,9 @@ func (c *ConfigurationStorePropertiesUpdateParameters) UnmarshalJSON(data []byte for key, val := range rawMsg { var err error switch key { + case "dataPlaneProxy": + err = unpopulate(val, "DataPlaneProxy", &c.DataPlaneProxy) + delete(rawMsg, key) case "disableLocalAuth": err = unpopulate(val, "DisableLocalAuth", &c.DisableLocalAuth) delete(rawMsg, key) @@ -305,9 +328,18 @@ func (c *ConfigurationStorePropertiesUpdateParameters) UnmarshalJSON(data []byte case "encryption": err = unpopulate(val, "Encryption", &c.Encryption) delete(rawMsg, key) + case "experimentation": + err = unpopulate(val, "Experimentation", &c.Experimentation) + delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &c.PublicNetworkAccess) delete(rawMsg, key) + case "sas": + err = unpopulate(val, "Sas", &c.Sas) + delete(rawMsg, key) + case "telemetry": + err = unpopulate(val, "Telemetry", &c.Telemetry) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -355,6 +387,37 @@ func (c *ConfigurationStoreUpdateParameters) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DataPlaneProxyProperties. +func (d DataPlaneProxyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationMode", d.AuthenticationMode) + populate(objectMap, "privateLinkDelegation", d.PrivateLinkDelegation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataPlaneProxyProperties. +func (d *DataPlaneProxyProperties) 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 "authenticationMode": + err = unpopulate(val, "AuthenticationMode", &d.AuthenticationMode) + delete(rawMsg, key) + case "privateLinkDelegation": + err = unpopulate(val, "PrivateLinkDelegation", &d.PrivateLinkDelegation) + 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 DeletedConfigurationStore. func (d DeletedConfigurationStore) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -530,6 +593,49 @@ func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorDetails. func (e ErrorDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -592,6 +698,64 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. +func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. +func (e *ErrorResponseAutoGenerated) 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 ExperimentationProperties. +func (e ExperimentationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataPlaneEndpoint", e.DataPlaneEndpoint) + populate(objectMap, "resourceId", e.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentationProperties. +func (e *ExperimentationProperties) 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 "dataPlaneEndpoint": + err = unpopulate(val, "DataPlaneEndpoint", &e.DataPlaneEndpoint) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &e.ResourceID) + 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 KeyValue. func (k KeyValue) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -631,6 +795,37 @@ func (k *KeyValue) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type KeyValueFilter. +func (k KeyValueFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", k.Key) + populate(objectMap, "label", k.Label) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyValueFilter. +func (k *KeyValueFilter) 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 "key": + err = unpopulate(val, "Key", &k.Key) + delete(rawMsg, key) + case "label": + err = unpopulate(val, "Label", &k.Label) + 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 KeyValueListResult. func (k KeyValueListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -748,6 +943,45 @@ func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type KvSasTokenScope. +func (k KvSasTokenScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", k.Key) + populate(objectMap, "label", k.Label) + objectMap["resourceType"] = ResourceTypeKv + populate(objectMap, "tags", k.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KvSasTokenScope. +func (k *KvSasTokenScope) 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 "key": + err = unpopulate(val, "Key", &k.Key) + delete(rawMsg, key) + case "label": + err = unpopulate(val, "Label", &k.Label) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &k.ResourceType) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &k.Tags) + 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 LogSpecification. func (l LogSpecification) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1495,6 +1729,33 @@ func (r *ReplicaProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ResetSasKindParameters. +func (r ResetSasKindParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResetSasKindParameters. +func (r *ResetSasKindParameters) 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 "name": + err = unpopulate(val, "Name", &r.Name) + 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 Resource. func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1596,6 +1857,177 @@ func (s *SKU) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SasKindInfo. +func (s SasKindInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "name", s.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SasKindInfo. +func (s *SasKindInfo) 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 "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SasProperties. +func (s SasProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kinds", s.Kinds) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SasProperties. +func (s *SasProperties) 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 "kinds": + err = unpopulate(val, "Kinds", &s.Kinds) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + 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 SasTokenGenerationParameters. +func (s SasTokenGenerationParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cacheControlMaxAge", s.CacheControlMaxAge) + populateDateTimeRFC3339(objectMap, "expires", s.Expires) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "sasTokenScope", s.SasTokenScope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SasTokenGenerationParameters. +func (s *SasTokenGenerationParameters) 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 "cacheControlMaxAge": + err = unpopulate(val, "CacheControlMaxAge", &s.CacheControlMaxAge) + delete(rawMsg, key) + case "expires": + err = unpopulateDateTimeRFC3339(val, "Expires", &s.Expires) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "sasTokenScope": + s.SasTokenScope, err = unmarshalSasTokenScopeClassification(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 SasTokenGenerationResult. +func (s SasTokenGenerationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cacheControlMaxAge", s.CacheControlMaxAge) + populateDateTimeRFC3339(objectMap, "expires", s.Expires) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "sasTokenScope", s.SasTokenScope) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SasTokenGenerationResult. +func (s *SasTokenGenerationResult) 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 "cacheControlMaxAge": + err = unpopulate(val, "CacheControlMaxAge", &s.CacheControlMaxAge) + delete(rawMsg, key) + case "expires": + err = unpopulateDateTimeRFC3339(val, "Expires", &s.Expires) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "sasTokenScope": + s.SasTokenScope, err = unmarshalSasTokenScopeClassification(val) + 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 SasTokenScope. +func (s SasTokenScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["resourceType"] = s.ResourceType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SasTokenScope. +func (s *SasTokenScope) 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 "resourceType": + err = unpopulate(val, "ResourceType", &s.ResourceType) + 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 ServiceSpecification. func (s ServiceSpecification) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1627,6 +2059,143 @@ func (s *ServiceSpecification) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Snapshot. +func (s Snapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Snapshot. +func (s *Snapshot) 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 "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + 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 SnapshotProperties. +func (s SnapshotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "compositionType", s.CompositionType) + populateDateTimeRFC3339(objectMap, "created", s.Created) + populate(objectMap, "etag", s.Etag) + populateDateTimeRFC3339(objectMap, "expires", s.Expires) + populate(objectMap, "filters", s.Filters) + populate(objectMap, "itemsCount", s.ItemsCount) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "retentionPeriod", s.RetentionPeriod) + populate(objectMap, "size", s.Size) + populate(objectMap, "status", s.Status) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotProperties. +func (s *SnapshotProperties) 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 "compositionType": + err = unpopulate(val, "CompositionType", &s.CompositionType) + delete(rawMsg, key) + case "created": + err = unpopulateDateTimeRFC3339(val, "Created", &s.Created) + delete(rawMsg, key) + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "expires": + err = unpopulateDateTimeRFC3339(val, "Expires", &s.Expires) + delete(rawMsg, key) + case "filters": + err = unpopulate(val, "Filters", &s.Filters) + delete(rawMsg, key) + case "itemsCount": + err = unpopulate(val, "ItemsCount", &s.ItemsCount) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "retentionPeriod": + err = unpopulate(val, "RetentionPeriod", &s.RetentionPeriod) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &s.Size) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + 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 SnapshotSasTokenScope. +func (s SnapshotSasTokenScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + objectMap["resourceType"] = ResourceTypeSnapshot + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotSasTokenScope. +func (s *SnapshotSasTokenScope) 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 "resourceType": + err = unpopulate(val, "ResourceType", &s.ResourceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1674,6 +2243,33 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TelemetryProperties. +func (t TelemetryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceId", t.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TelemetryProperties. +func (t *TelemetryProperties) 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 "resourceId": + err = unpopulate(val, "ResourceID", &t.ResourceID) + 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 TrackedResource. func (t TrackedResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1769,7 +2365,7 @@ func populateAny(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/operations_client.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/operations_client.go index 400cf50ce7e7..20aa0299cf7c 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/operations_client.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/operations_client.go @@ -46,7 +46,7 @@ func NewOperationsClient(subscriptionID string, credential azcore.TokenCredentia // CheckNameAvailability - Checks whether the configuration store name is available for use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - checkNameAvailabilityParameters - The object containing information for the availability request. // - options - OperationsClientCheckNameAvailabilityOptions contains the optional parameters for the OperationsClient.CheckNameAvailability // method. @@ -84,7 +84,7 @@ func (client *OperationsClient) checkNameAvailabilityCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, checkNameAvailabilityParameters); err != nil { @@ -104,7 +104,7 @@ func (client *OperationsClient) checkNameAvailabilityHandleResponse(resp *http.R // NewListPager - Lists the operations available from this provider. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -137,10 +137,10 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -158,7 +158,7 @@ func (client *OperationsClient) listHandleResponse(resp *http.Response) (Operati // RegionalCheckNameAvailability - Checks whether the configuration store name is available for use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - location - The location in which uniqueness will be verified. // - checkNameAvailabilityParameters - The object containing information for the availability request. // - options - OperationsClientRegionalCheckNameAvailabilityOptions contains the optional parameters for the OperationsClient.RegionalCheckNameAvailability @@ -201,7 +201,7 @@ func (client *OperationsClient) regionalCheckNameAvailabilityCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, checkNameAvailabilityParameters); err != nil { diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/operations_client_example_test.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/operations_client_example_test.go deleted file mode 100644 index 2ca815cb8000..000000000000 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/operations_client_example_test.go +++ /dev/null @@ -1,554 +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. -// DO NOT EDIT. - -package armappconfiguration_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/appconfiguration/armappconfiguration/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/CheckNameAvailable.json -func ExampleOperationsClient_CheckNameAvailability_configurationStoresCheckNameAvailable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationsClient().CheckNameAvailability(ctx, armappconfiguration.CheckNameAvailabilityParameters{ - Name: to.Ptr("contoso"), - Type: to.Ptr(armappconfiguration.ConfigurationResourceTypeMicrosoftAppConfigurationConfigurationStores), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NameAvailabilityStatus = armappconfiguration.NameAvailabilityStatus{ - // Message: to.Ptr("The specified name is available."), - // NameAvailable: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/CheckNameNotAvailable.json -func ExampleOperationsClient_CheckNameAvailability_configurationStoresCheckNameNotAvailable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationsClient().CheckNameAvailability(ctx, armappconfiguration.CheckNameAvailabilityParameters{ - Name: to.Ptr("contoso"), - Type: to.Ptr(armappconfiguration.ConfigurationResourceTypeMicrosoftAppConfigurationConfigurationStores), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NameAvailabilityStatus = armappconfiguration.NameAvailabilityStatus{ - // Message: to.Ptr("The specified name is already in use."), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr("AlreadyExists"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-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() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(&armappconfiguration.OperationsClientListOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationDefinitionListResult = armappconfiguration.OperationDefinitionListResult{ - // Value: []*armappconfiguration.OperationDefinition{ - // { - // Name: to.Ptr("Microsoft.AppConfiguration/operations/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Lists all of the operations supported by Microsoft App Configuration."), - // Operation: to.Ptr("List Operations"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Operation"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/register/action"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Registers a subscription to use Microsoft App Configuration."), - // Operation: to.Ptr("Register for Microsoft App Configuration"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Microsoft App Configuration"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/unregister/action"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Unregisters a subscription from using Microsoft App Configuration."), - // Operation: to.Ptr("Unregister for Microsoft App Configuration"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Microsoft App Configuration"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/locations/operationsStatus/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Get the status of an operation."), - // Operation: to.Ptr("Get Operation Status"), - // Provider: to.Ptr("Microsoft App Configuration"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/checkNameAvailability/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Check whether the resource name is available for use."), - // Operation: to.Ptr("Check Name Availability"), - // Provider: to.Ptr("Microsoft App Configuration"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/locations/checkNameAvailability/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Check whether the resource name is available for use."), - // Operation: to.Ptr("Check Name Availability"), - // Provider: to.Ptr("Microsoft App Configuration"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Gets the properties of the specified configuration store or lists all the configuration stores under the specified resource group or subscription."), - // Operation: to.Ptr("Get Configuration Store or List Configuration Stores"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Configuration Store"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/write"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Create or update a configuration store with the specified parameters."), - // Operation: to.Ptr("Create or Update Configuration Store"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Configuration Store"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/delete"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Deletes a configuration store."), - // Operation: to.Ptr("Delete Configuration Store"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Configuration Store"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/ListKeys/action"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Lists the API keys for the specified configuration store."), - // Operation: to.Ptr("List Configuration Store API Keys"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Configuration Store"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/RegenerateKey/action"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Regenerates of the API key's for the specified configuration store."), - // Operation: to.Ptr("Regenerate Configuration Store API Key"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Configuration Store"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/ListKeyValue/action"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Lists a key-value for the specified configuration store."), - // Operation: to.Ptr("List Configuration Store Key-Value"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Configuration Store"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/eventGridFilters/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Gets the properties of the specified configuration store event grid filter or lists all the configuration store event grid filters under the specified configuration store."), - // Operation: to.Ptr("Get Configuration Store Event Grid Filter or List Configuration Store Event Grid Filters"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Configuration Store Event Grid Filter"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/eventGridFilters/write"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Create or update a configuration store event grid filter with the specified parameters."), - // Operation: to.Ptr("Create or Update Configuration Store Event Grid Filter"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Configuration Store Event Grid Filter"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/eventGridFilters/delete"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Deletes a configuration store event grid filter."), - // Operation: to.Ptr("Delete Configuration Store Event Grid Filter"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Configuration Store Event Grid Filter"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/providers/Microsoft.Insights/metricDefinitions/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Retrieve all metric definitions for Microsoft App Configuration."), - // Operation: to.Ptr("Read Configuration Store Metric Definitions"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Microsoft App Configuration Metric Definition."), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("System"), - // Properties: &armappconfiguration.OperationProperties{ - // ServiceSpecification: &armappconfiguration.ServiceSpecification{ - // MetricSpecifications: []*armappconfiguration.MetricSpecification{ - // { - // Name: to.Ptr("HttpIncomingRequestCount"), - // AggregationType: to.Ptr("Count"), - // Dimensions: []*armappconfiguration.MetricDimension{ - // { - // Name: to.Ptr("StatusCode"), - // DisplayName: to.Ptr("HttpStatusCode"), - // InternalName: to.Ptr("StatusCode"), - // }, - // { - // Name: to.Ptr("Authentication"), - // DisplayName: to.Ptr("AuthenticationScheme"), - // InternalName: to.Ptr("Authentication"), - // }}, - // DisplayDescription: to.Ptr("Total number of incoming http requests."), - // DisplayName: to.Ptr("HttpIncomingRequestCount"), - // FillGapWithZero: to.Ptr(true), - // InternalMetricName: to.Ptr("HttpIncomingRequestCount"), - // Unit: to.Ptr("Count"), - // }, - // { - // Name: to.Ptr("HttpIncomingRequestDuration"), - // AggregationType: to.Ptr("Average"), - // Dimensions: []*armappconfiguration.MetricDimension{ - // { - // Name: to.Ptr("StatusCode"), - // DisplayName: to.Ptr("HttpStatusCode"), - // InternalName: to.Ptr("StatusCode"), - // }, - // { - // Name: to.Ptr("Authentication"), - // DisplayName: to.Ptr("AuthenticationScheme"), - // InternalName: to.Ptr("Authentication"), - // }}, - // DisplayDescription: to.Ptr("Latency on an http request."), - // DisplayName: to.Ptr("HttpIncomingRequestDuration"), - // FillGapWithZero: to.Ptr(true), - // InternalMetricName: to.Ptr("HttpIncomingRequestDuration"), - // Unit: to.Ptr("Count"), - // }, - // { - // Name: to.Ptr("ThrottledHttpRequestCount"), - // AggregationType: to.Ptr("Count"), - // DisplayDescription: to.Ptr("Throttled http requests."), - // DisplayName: to.Ptr("ThrottledHttpRequestCount"), - // FillGapWithZero: to.Ptr(true), - // InternalMetricName: to.Ptr("ThrottledHttpRequestCount"), - // Unit: to.Ptr("Count"), - // }}, - // }, - // }, - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/providers/Microsoft.Insights/diagnosticSettings/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Read all Diagnostic Settings values for a Configuration Store."), - // Operation: to.Ptr("Read Configuration Store Diagnostic Settings"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Configuration Store"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("System"), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/providers/Microsoft.Insights/diagnosticSettings/write"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Write/Overwrite Diagnostic Settings for Microsoft App Configuration."), - // Operation: to.Ptr("Write Configuration Store Diagnostic Settings"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Configuration Store"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("System"), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/providers/Microsoft.Insights/logDefinitions/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Retrieve all log definitions for Microsoft App Configuration."), - // Operation: to.Ptr("Read Configuration Store Log Definitions"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Microsoft App Configuration Log Definition."), - // }, - // IsDataAction: to.Ptr(false), - // Properties: &armappconfiguration.OperationProperties{ - // ServiceSpecification: &armappconfiguration.ServiceSpecification{ - // LogSpecifications: []*armappconfiguration.LogSpecification{ - // { - // Name: to.Ptr("HttpRequest"), - // DisplayName: to.Ptr("HTTP Requests"), - // }, - // { - // Name: to.Ptr("Audit"), - // DisplayName: to.Ptr("Audit"), - // }}, - // }, - // }, - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/privateEndpointConnectionProxies/validate/action"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Validate a private endpoint connection proxy under the specified configuration store."), - // Operation: to.Ptr("Validate Private Endpoint Connection Proxy"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Private Endpoint Connection Proxy"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/privateEndpointConnectionProxies/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Get a private endpoint connection proxy under the specified configuration store."), - // Operation: to.Ptr("Get Private Endpoint Connection Proxy"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Private Endpoint Connection Proxy"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/privateEndpointConnectionProxies/write"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Create or update a private endpoint connection proxy under the specified configuration store."), - // Operation: to.Ptr("Create or Update Private Endpoint Connection Proxy"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Private Endpoint Connection Proxy"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/privateEndpointConnectionProxies/delete"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Delete a private endpoint connection proxy under the specified configuration store."), - // Operation: to.Ptr("Delete Private Endpoint Connection Proxy"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Private Endpoint Connection Proxy"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/privateEndpointConnections/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Get a private endpoint connection or list private endpoint connections under the specified configuration store."), - // Operation: to.Ptr("Get Private Endpoint Connection or List Private Endpoint Connections"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Private Endpoint Connection"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/privateEndpointConnections/write"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Approve or reject a private endpoint connection under the specified configuration store."), - // Operation: to.Ptr("Approve or Reject Private Endpoint Connection"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Private Endpoint Connection"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/privateEndpointConnections/delete"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Delete a private endpoint connection under the specified configuration store."), - // Operation: to.Ptr("Delete Private Endpoint Connection"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Private Endpoint Connection"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/PrivateEndpointConnectionsApproval/action"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Auto-Approve a private endpoint connection under the specified configuration store."), - // Operation: to.Ptr("Auto-Approve Private Endpoint Connection"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Private Endpoint Connection"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/privateLinkResources/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Lists all the private link resources under the specified configuration store."), - // Operation: to.Ptr("List Private Link"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Private Link"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/keyValues/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Reads a key-value from the configuration store."), - // Operation: to.Ptr("Read Key-Value"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Key-Value"), - // }, - // IsDataAction: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/keyValues/write"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Creates or updates a key-value in the configuration store."), - // Operation: to.Ptr("Write Key-Value"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Key-Value"), - // }, - // IsDataAction: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/configurationStores/keyValues/delete"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Deletes an existing key-value from the configuration store."), - // Operation: to.Ptr("Delete Key-Value"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Key-Value"), - // }, - // IsDataAction: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/locations/deletedConfigurationStores/read"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Gets the properties of the specified deleted configuration store or lists all the deleted configuration stores under the specified subscription."), - // Operation: to.Ptr("Get Deleted Configuration Store or List Deleted Configuration Stores"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Deleted Configuration Store"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AppConfiguration/locations/deletedConfigurationStores/purge/action"), - // Display: &armappconfiguration.OperationDefinitionDisplay{ - // Description: to.Ptr("Purge the specified deleted configuration store."), - // Operation: to.Ptr("Purge Deleted Configuration Store"), - // Provider: to.Ptr("Microsoft App Configuration"), - // Resource: to.Ptr("Deleted Configuration Store"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/RegionalCheckNameAvailable.json -func ExampleOperationsClient_RegionalCheckNameAvailability_configurationStoresCheckNameAvailable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationsClient().RegionalCheckNameAvailability(ctx, "westus", armappconfiguration.CheckNameAvailabilityParameters{ - Name: to.Ptr("contoso"), - Type: to.Ptr(armappconfiguration.ConfigurationResourceTypeMicrosoftAppConfigurationConfigurationStores), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NameAvailabilityStatus = armappconfiguration.NameAvailabilityStatus{ - // Message: to.Ptr("The specified name is available."), - // NameAvailable: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/RegionalCheckNameNotAvailable.json -func ExampleOperationsClient_RegionalCheckNameAvailability_configurationStoresCheckNameNotAvailable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationsClient().RegionalCheckNameAvailability(ctx, "westus", armappconfiguration.CheckNameAvailabilityParameters{ - Name: to.Ptr("contoso"), - Type: to.Ptr(armappconfiguration.ConfigurationResourceTypeMicrosoftAppConfigurationConfigurationStores), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NameAvailabilityStatus = armappconfiguration.NameAvailabilityStatus{ - // Message: to.Ptr("The specified name is already in use."), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr("AlreadyExists"), - // } -} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/options.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/options.go index e02066ffb2a6..2c93f5c91fbd 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/options.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/options.go @@ -36,6 +36,12 @@ type ConfigurationStoresClientBeginUpdateOptions struct { ResumeToken string } +// ConfigurationStoresClientGenerateSasTokenOptions contains the optional parameters for the ConfigurationStoresClient.GenerateSasToken +// method. +type ConfigurationStoresClientGenerateSasTokenOptions struct { + // placeholder for future optional parameters +} + // ConfigurationStoresClientGetDeletedOptions contains the optional parameters for the ConfigurationStoresClient.GetDeleted // method. type ConfigurationStoresClientGetDeletedOptions struct { @@ -85,6 +91,12 @@ type ConfigurationStoresClientRegenerateKeyOptions struct { // placeholder for future optional parameters } +// ConfigurationStoresClientResetSasKindOptions contains the optional parameters for the ConfigurationStoresClient.ResetSasKind +// method. +type ConfigurationStoresClientResetSasKindOptions struct { + // placeholder for future optional parameters +} + // KeyValuesClientBeginDeleteOptions contains the optional parameters for the KeyValuesClient.BeginDelete method. type KeyValuesClientBeginDeleteOptions struct { // Resumes the LRO from the provided token. @@ -184,3 +196,14 @@ type ReplicasClientListByConfigurationStoreOptions struct { // skipToken parameter that specifies a starting point to use for subsequent calls. SkipToken *string } + +// SnapshotsClientBeginCreateOptions contains the optional parameters for the SnapshotsClient.BeginCreate method. +type SnapshotsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SnapshotsClientGetOptions contains the optional parameters for the SnapshotsClient.Get method. +type SnapshotsClientGetOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/polymorphic_helpers.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/polymorphic_helpers.go new file mode 100644 index 000000000000..a2f625174217 --- /dev/null +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/polymorphic_helpers.go @@ -0,0 +1,34 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armappconfiguration + +import "encoding/json" + +func unmarshalSasTokenScopeClassification(rawMsg json.RawMessage) (SasTokenScopeClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b SasTokenScopeClassification + switch m["resourceType"] { + case string(ResourceTypeKv): + b = &KvSasTokenScope{} + case string(ResourceTypeSnapshot): + b = &SnapshotSasTokenScope{} + default: + b = &SasTokenScope{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/privateendpointconnections_client.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/privateendpointconnections_client.go index 757d4f768e8f..00b0b1fc42bf 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/privateendpointconnections_client.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/privateendpointconnections_client.go @@ -48,7 +48,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // connections must be created with the Network resource provider. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - privateEndpointConnectionName - Private endpoint connection name @@ -77,7 +77,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // connections must be created with the Network resource provider. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, configStoreName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" @@ -123,7 +123,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, privateEndpointConnection); err != nil { @@ -135,7 +135,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - privateEndpointConnectionName - Private endpoint connection name @@ -161,7 +161,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, configStoreName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -207,7 +207,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -216,7 +216,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets the specified private endpoint connection associated with the configuration store. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - privateEndpointConnectionName - Private endpoint connection name @@ -268,7 +268,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -285,7 +285,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByConfigurationStorePager - Lists all private endpoint connections for a configuration store. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - options - PrivateEndpointConnectionsClientListByConfigurationStoreOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByConfigurationStorePager @@ -333,7 +333,7 @@ func (client *PrivateEndpointConnectionsClient) listByConfigurationStoreCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/privateendpointconnections_client_example_test.go deleted file mode 100644 index 51f00a025d67..000000000000 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,167 +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. -// DO NOT EDIT. - -package armappconfiguration_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/appconfiguration/armappconfiguration/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresListPrivateEndpointConnections.json -func ExamplePrivateEndpointConnectionsClient_NewListByConfigurationStorePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByConfigurationStorePager("myResourceGroup", "contoso", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armappconfiguration.PrivateEndpointConnectionListResult{ - // Value: []*armappconfiguration.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myConnection"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso/privateEndpointConnections/myConnection"), - // Properties: &armappconfiguration.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armappconfiguration.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/peexample01"), - // }, - // PrivateLinkServiceConnectionState: &armappconfiguration.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr(armappconfiguration.ActionsRequiredNone), - // Status: to.Ptr(armappconfiguration.ConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresGetPrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "myResourceGroup", "contoso", "myConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armappconfiguration.PrivateEndpointConnection{ - // Name: to.Ptr("myConnection"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso/privateEndpointConnections/myConnection"), - // Properties: &armappconfiguration.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armappconfiguration.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/peexample01"), - // }, - // PrivateLinkServiceConnectionState: &armappconfiguration.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr(armappconfiguration.ActionsRequiredNone), - // Status: to.Ptr(armappconfiguration.ConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresUpdatePrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "contoso", "myConnection", armappconfiguration.PrivateEndpointConnection{ - Properties: &armappconfiguration.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armappconfiguration.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Auto-Approved"), - Status: to.Ptr(armappconfiguration.ConnectionStatusApproved), - }, - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armappconfiguration.PrivateEndpointConnection{ - // Name: to.Ptr("myConnection"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso/privateEndpointConnections/myConnection"), - // Properties: &armappconfiguration.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armappconfiguration.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/peexample01"), - // }, - // PrivateLinkServiceConnectionState: &armappconfiguration.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr(armappconfiguration.ActionsRequiredNone), - // Status: to.Ptr(armappconfiguration.ConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armappconfiguration.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresDeletePrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "myResourceGroup", "contoso", "myConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/privatelinkresources_client.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/privatelinkresources_client.go index bd9c05ac587c..e6c7a715129f 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/privatelinkresources_client.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/privatelinkresources_client.go @@ -46,7 +46,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Gets a private link resource that need to be created for a configuration store. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - groupName - The name of the private link resource group. @@ -98,7 +98,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +115,7 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // NewListByConfigurationStorePager - Gets the private link resources that need to be created for a configuration store. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - options - PrivateLinkResourcesClientListByConfigurationStoreOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByConfigurationStorePager @@ -163,7 +163,7 @@ func (client *PrivateLinkResourcesClient) listByConfigurationStoreCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/privatelinkresources_client_example_test.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/privatelinkresources_client_example_test.go deleted file mode 100644 index 93e4fb32a0fc..000000000000 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,90 +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. -// DO NOT EDIT. - -package armappconfiguration_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appconfiguration/armappconfiguration/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/PrivateLinkResourcesListByConfigurationStore.json -func ExamplePrivateLinkResourcesClient_NewListByConfigurationStorePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkResourcesClient().NewListByConfigurationStorePager("myResourceGroup", "contoso", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkResourceListResult = armappconfiguration.PrivateLinkResourceListResult{ - // Value: []*armappconfiguration.PrivateLinkResource{ - // { - // Name: to.Ptr("configurationStores"), - // Type: to.Ptr("Microsoft.AppConfiguraiton/configurationStores/privateLinkResources"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso/privateLinkResources/configurationStores"), - // Properties: &armappconfiguration.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("configurationStores"), - // RequiredMembers: []*string{ - // to.Ptr("configurationStores")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.azconfig.io")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/PrivateLinkResourceGet.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "myResourceGroup", "contoso", "configurationStores", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResource = armappconfiguration.PrivateLinkResource{ - // Name: to.Ptr("configurationStores"), - // Type: to.Ptr("Microsoft.AppConfiguraiton/configurationStores/privateLinkResources"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso/privateLinkResources/configurationStores"), - // Properties: &armappconfiguration.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("configurationStores"), - // RequiredMembers: []*string{ - // to.Ptr("configurationStores")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.azconfig.io")}, - // }, - // } -} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/replicas_client.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/replicas_client.go index 73bb24390abe..ebca89d40260 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/replicas_client.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/replicas_client.go @@ -46,7 +46,7 @@ func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Creates a replica with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - replicaName - The name of the replica. @@ -73,7 +73,7 @@ func (client *ReplicasClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Creates a replica with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview func (client *ReplicasClient) create(ctx context.Context, resourceGroupName string, configStoreName string, replicaName string, replicaCreationParameters Replica, options *ReplicasClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ReplicasClient.BeginCreate" @@ -119,7 +119,7 @@ func (client *ReplicasClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, replicaCreationParameters); err != nil { @@ -131,7 +131,7 @@ func (client *ReplicasClient) createCreateRequest(ctx context.Context, resourceG // BeginDelete - Deletes a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - replicaName - The name of the replica. @@ -157,7 +157,7 @@ func (client *ReplicasClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview func (client *ReplicasClient) deleteOperation(ctx context.Context, resourceGroupName string, configStoreName string, replicaName string, options *ReplicasClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ReplicasClient.BeginDelete" @@ -203,7 +203,7 @@ func (client *ReplicasClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +212,7 @@ func (client *ReplicasClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Gets the properties of the specified replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - replicaName - The name of the replica. @@ -263,7 +263,7 @@ func (client *ReplicasClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +280,7 @@ func (client *ReplicasClient) getHandleResponse(resp *http.Response) (ReplicasCl // NewListByConfigurationStorePager - Lists the replicas for a given configuration store. // -// Generated from API version 2023-03-01 +// Generated from API version 2024-06-01-preview // - resourceGroupName - The name of the resource group to which the container registry belongs. // - configStoreName - The name of the configuration store. // - options - ReplicasClientListByConfigurationStoreOptions contains the optional parameters for the ReplicasClient.NewListByConfigurationStorePager @@ -328,10 +328,10 @@ func (client *ReplicasClient) listByConfigurationStoreCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01") if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } + reqQP.Set("api-version", "2024-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/replicas_client_example_test.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/replicas_client_example_test.go deleted file mode 100644 index 29ecacce0cd6..000000000000 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/replicas_client_example_test.go +++ /dev/null @@ -1,186 +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. -// DO NOT EDIT. - -package armappconfiguration_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/appconfiguration/armappconfiguration/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresListReplicas.json -func ExampleReplicasClient_NewListByConfigurationStorePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReplicasClient().NewListByConfigurationStorePager("myResourceGroup", "contoso", &armappconfiguration.ReplicasClientListByConfigurationStoreOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ReplicaListResult = armappconfiguration.ReplicaListResult{ - // Value: []*armappconfiguration.Replica{ - // { - // Name: to.Ptr("myReplicaEus"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores/replicas"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso/replicas/myReplicaEus"), - // Location: to.Ptr("eastus"), - // Properties: &armappconfiguration.ReplicaProperties{ - // Endpoint: to.Ptr("https://contoso-myreplicaeus.azconfig.io"), - // ProvisioningState: to.Ptr(armappconfiguration.ReplicaProvisioningStateSucceeded), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("myReplicaWestEurope"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores/replicas"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso/replicas/myReplicaWestEurope"), - // Location: to.Ptr("westeurope"), - // Properties: &armappconfiguration.ReplicaProperties{ - // Endpoint: to.Ptr("https://contoso-myreplicawesteurope.azconfig.io"), - // ProvisioningState: to.Ptr(armappconfiguration.ReplicaProvisioningStateSucceeded), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresGetReplica.json -func ExampleReplicasClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReplicasClient().Get(ctx, "myResourceGroup", "contoso", "myReplicaEus", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Replica = armappconfiguration.Replica{ - // Name: to.Ptr("myReplicaEus"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores/replicas"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso/replicas/myReplicaEus"), - // Location: to.Ptr("eastus"), - // Properties: &armappconfiguration.ReplicaProperties{ - // Endpoint: to.Ptr("https://contoso-myreplicaeus.azconfig.io"), - // ProvisioningState: to.Ptr(armappconfiguration.ReplicaProvisioningStateSucceeded), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresCreateReplica.json -func ExampleReplicasClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReplicasClient().BeginCreate(ctx, "myResourceGroup", "contoso", "myReplicaEus", armappconfiguration.Replica{ - Location: to.Ptr("eastus"), - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Replica = armappconfiguration.Replica{ - // Name: to.Ptr("myReplicaEus"), - // Type: to.Ptr("Microsoft.AppConfiguration/configurationStores/replicas"), - // ID: to.Ptr("/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/Microsoft.AppConfiguration/configurationStores/contoso/replicas/myReplicaEus"), - // Location: to.Ptr("eastus"), - // Properties: &armappconfiguration.ReplicaProperties{ - // Endpoint: to.Ptr("https://contoso-myreplicaeus.azconfig.io"), - // ProvisioningState: to.Ptr(armappconfiguration.ReplicaProvisioningStateSucceeded), - // }, - // SystemData: &armappconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // CreatedBy: to.Ptr("foo@contoso.com"), - // CreatedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-24T16:30:55.000Z"); return t}()), - // LastModifiedBy: to.Ptr("foo@contoso.com"), - // LastModifiedByType: to.Ptr(armappconfiguration.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresDeleteReplica.json -func ExampleReplicasClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReplicasClient().BeginDelete(ctx, "myResourceGroup", "contoso", "myReplicaEus", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/response_types.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/responses.go similarity index 88% rename from sdk/resourcemanager/appconfiguration/armappconfiguration/response_types.go rename to sdk/resourcemanager/appconfiguration/armappconfiguration/responses.go index 84daa055dddd..f5a83a3342d8 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/response_types.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/responses.go @@ -20,6 +20,12 @@ type ConfigurationStoresClientDeleteResponse struct { // placeholder for future response values } +// ConfigurationStoresClientGenerateSasTokenResponse contains the response from method ConfigurationStoresClient.GenerateSasToken. +type ConfigurationStoresClientGenerateSasTokenResponse struct { + // The result of a request to generate a SAS token. + SasTokenGenerationResult +} + // ConfigurationStoresClientGetDeletedResponse contains the response from method ConfigurationStoresClient.GetDeleted. type ConfigurationStoresClientGetDeletedResponse struct { // Deleted configuration store information with extended details. @@ -68,6 +74,13 @@ type ConfigurationStoresClientRegenerateKeyResponse struct { APIKey } +// ConfigurationStoresClientResetSasKindResponse contains the response from method ConfigurationStoresClient.ResetSasKind. +type ConfigurationStoresClientResetSasKindResponse struct { + // The configuration store along with all resource properties. The Configuration Store will have all information to begin + // utilizing it. + ConfigurationStore +} + // ConfigurationStoresClientUpdateResponse contains the response from method ConfigurationStoresClient.BeginUpdate. type ConfigurationStoresClientUpdateResponse struct { // The configuration store along with all resource properties. The Configuration Store will have all information to begin @@ -167,3 +180,15 @@ type ReplicasClientListByConfigurationStoreResponse struct { // The result of a request to list replicas. ReplicaListResult } + +// SnapshotsClientCreateResponse contains the response from method SnapshotsClient.BeginCreate. +type SnapshotsClientCreateResponse struct { + // The snapshot resource. + Snapshot +} + +// SnapshotsClientGetResponse contains the response from method SnapshotsClient.Get. +type SnapshotsClientGetResponse struct { + // The snapshot resource. + Snapshot +} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/snapshots_client.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/snapshots_client.go new file mode 100644 index 000000000000..37214e370a7d --- /dev/null +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/snapshots_client.go @@ -0,0 +1,204 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armappconfiguration + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "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" +) + +// SnapshotsClient contains the methods for the Snapshots group. +// Don't use this type directly, use NewSnapshotsClient() instead. +type SnapshotsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSnapshotsClient creates a new instance of SnapshotsClient with the specified values. +// - subscriptionID - The Microsoft Azure subscription ID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSnapshotsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SnapshotsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SnapshotsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a snapshot. NOTE: This operation is intended for use in Azure Resource Manager (ARM) Template deployments. +// For all other scenarios involving App Configuration snapshots the data plane API +// should be used instead. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - configStoreName - The name of the configuration store. +// - snapshotName - The name of the snapshot. +// - body - The parameters for creating a snapshot. +// - options - SnapshotsClientBeginCreateOptions contains the optional parameters for the SnapshotsClient.BeginCreate method. +func (client *SnapshotsClient) BeginCreate(ctx context.Context, resourceGroupName string, configStoreName string, snapshotName string, body Snapshot, options *SnapshotsClientBeginCreateOptions) (*runtime.Poller[SnapshotsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, configStoreName, snapshotName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SnapshotsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SnapshotsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a snapshot. NOTE: This operation is intended for use in Azure Resource Manager (ARM) Template deployments. +// For all other scenarios involving App Configuration snapshots the data plane API +// should be used instead. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +func (client *SnapshotsClient) create(ctx context.Context, resourceGroupName string, configStoreName string, snapshotName string, body Snapshot, options *SnapshotsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "SnapshotsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, configStoreName, snapshotName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *SnapshotsClient) createCreateRequest(ctx context.Context, resourceGroupName string, configStoreName string, snapshotName string, body Snapshot, options *SnapshotsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/snapshots/{snapshotName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if configStoreName == "" { + return nil, errors.New("parameter configStoreName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configStoreName}", url.PathEscape(configStoreName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Get - Gets the properties of the specified snapshot. NOTE: This operation is intended for use in Azure Resource Manager +// (ARM) Template deployments. For all other scenarios involving App Configuration +// snapshots the data plane API should be used instead. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - configStoreName - The name of the configuration store. +// - snapshotName - The name of the snapshot. +// - options - SnapshotsClientGetOptions contains the optional parameters for the SnapshotsClient.Get method. +func (client *SnapshotsClient) Get(ctx context.Context, resourceGroupName string, configStoreName string, snapshotName string, options *SnapshotsClientGetOptions) (SnapshotsClientGetResponse, error) { + var err error + const operationName = "SnapshotsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, configStoreName, snapshotName, options) + if err != nil { + return SnapshotsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SnapshotsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SnapshotsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGroupName string, configStoreName string, snapshotName string, options *SnapshotsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/snapshots/{snapshotName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if configStoreName == "" { + return nil, errors.New("parameter configStoreName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configStoreName}", url.PathEscape(configStoreName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-06-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 *SnapshotsClient) getHandleResponse(resp *http.Response) (SnapshotsClientGetResponse, error) { + result := SnapshotsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Snapshot); err != nil { + return SnapshotsClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/appconfiguration/armappconfiguration/time_rfc3339.go b/sdk/resourcemanager/appconfiguration/armappconfiguration/time_rfc3339.go index 4b9501654a73..512e656c1828 100644 --- a/sdk/resourcemanager/appconfiguration/armappconfiguration/time_rfc3339.go +++ b/sdk/resourcemanager/appconfiguration/armappconfiguration/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339