diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/CHANGELOG.md b/sdk/resourcemanager/connectedcache/armconnectedcache/CHANGELOG.md new file mode 100644 index 000000000000..04b0ce1c62da --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-20) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/LICENSE.txt b/sdk/resourcemanager/connectedcache/armconnectedcache/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/README.md b/sdk/resourcemanager/connectedcache/armconnectedcache/README.md new file mode 100644 index 000000000000..f691c1ec8db6 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/README.md @@ -0,0 +1,90 @@ +# Azure Connected Cache Module for Go + +The `armconnectedcache` module provides operations for working with Azure Connected Cache. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/connectedcache/armconnectedcache) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Connected Cache module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Connected Cache. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Connected Cache module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armconnectedcache.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armconnectedcache.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewCacheNodesOperationsClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Connected Cache` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client.go new file mode 100644 index 000000000000..5152cfdc05ff --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client.go @@ -0,0 +1,426 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +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" +) + +// CacheNodesOperationsClient contains the methods for the CacheNodesOperations group. +// Don't use this type directly, use NewCacheNodesOperationsClient() instead. +type CacheNodesOperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCacheNodesOperationsClient creates a new instance of CacheNodesOperationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCacheNodesOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CacheNodesOperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CacheNodesOperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateorUpdate - Creates a cacheNodes with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - resource - Resource create parameters. +// - options - CacheNodesOperationsClientBeginCreateorUpdateOptions contains the optional parameters for the CacheNodesOperationsClient.BeginCreateorUpdate +// method. +func (client *CacheNodesOperationsClient) BeginCreateorUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource CacheNodePreviewResource, options *CacheNodesOperationsClientBeginCreateorUpdateOptions) (*runtime.Poller[CacheNodesOperationsClientCreateorUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createorUpdate(ctx, resourceGroupName, customerResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CacheNodesOperationsClientCreateorUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CacheNodesOperationsClientCreateorUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateorUpdate - Creates a cacheNodes with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *CacheNodesOperationsClient) createorUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource CacheNodePreviewResource, options *CacheNodesOperationsClientBeginCreateorUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CacheNodesOperationsClient.BeginCreateorUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createorUpdateCreateRequest(ctx, resourceGroupName, customerResourceName, resource, 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 +} + +// createorUpdateCreateRequest creates the CreateorUpdate request. +func (client *CacheNodesOperationsClient) createorUpdateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, resource CacheNodePreviewResource, _ *CacheNodesOperationsClientBeginCreateorUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/cacheNodes/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Deletes an existing cache Node +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - CacheNodesOperationsClientDeleteOptions contains the optional parameters for the CacheNodesOperationsClient.Delete +// method. +func (client *CacheNodesOperationsClient) Delete(ctx context.Context, resourceGroupName string, customerResourceName string, options *CacheNodesOperationsClientDeleteOptions) (CacheNodesOperationsClientDeleteResponse, error) { + var err error + const operationName = "CacheNodesOperationsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, customerResourceName, options) + if err != nil { + return CacheNodesOperationsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CacheNodesOperationsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return CacheNodesOperationsClientDeleteResponse{}, err + } + return CacheNodesOperationsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CacheNodesOperationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *CacheNodesOperationsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/cacheNodes/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the properties of a cacheNodes +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - CacheNodesOperationsClientGetOptions contains the optional parameters for the CacheNodesOperationsClient.Get +// method. +func (client *CacheNodesOperationsClient) Get(ctx context.Context, resourceGroupName string, customerResourceName string, options *CacheNodesOperationsClientGetOptions) (CacheNodesOperationsClientGetResponse, error) { + var err error + const operationName = "CacheNodesOperationsClient.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, customerResourceName, options) + if err != nil { + return CacheNodesOperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CacheNodesOperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CacheNodesOperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CacheNodesOperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *CacheNodesOperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/cacheNodes/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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", "2023-05-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 *CacheNodesOperationsClient) getHandleResponse(resp *http.Response) (CacheNodesOperationsClientGetResponse, error) { + result := CacheNodesOperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CacheNodePreviewResource); err != nil { + return CacheNodesOperationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Retrieves the properties of all ConnectedCache +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - CacheNodesOperationsClientListByResourceGroupOptions contains the optional parameters for the CacheNodesOperationsClient.NewListByResourceGroupPager +// method. +func (client *CacheNodesOperationsClient) NewListByResourceGroupPager(resourceGroupName string, options *CacheNodesOperationsClientListByResourceGroupOptions) *runtime.Pager[CacheNodesOperationsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[CacheNodesOperationsClientListByResourceGroupResponse]{ + More: func(page CacheNodesOperationsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CacheNodesOperationsClientListByResourceGroupResponse) (CacheNodesOperationsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CacheNodesOperationsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return CacheNodesOperationsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *CacheNodesOperationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *CacheNodesOperationsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/cacheNodes" + 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)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *CacheNodesOperationsClient) listByResourceGroupHandleResponse(resp *http.Response) (CacheNodesOperationsClientListByResourceGroupResponse, error) { + result := CacheNodesOperationsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CacheNodePreviewResourceListResult); err != nil { + return CacheNodesOperationsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Retrieves the properties of all ConnectedCaches +// +// Generated from API version 2023-05-01-preview +// - options - CacheNodesOperationsClientListBySubscriptionOptions contains the optional parameters for the CacheNodesOperationsClient.NewListBySubscriptionPager +// method. +func (client *CacheNodesOperationsClient) NewListBySubscriptionPager(options *CacheNodesOperationsClientListBySubscriptionOptions) *runtime.Pager[CacheNodesOperationsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[CacheNodesOperationsClientListBySubscriptionResponse]{ + More: func(page CacheNodesOperationsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CacheNodesOperationsClientListBySubscriptionResponse) (CacheNodesOperationsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CacheNodesOperationsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return CacheNodesOperationsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *CacheNodesOperationsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *CacheNodesOperationsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedCache/cacheNodes" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *CacheNodesOperationsClient) listBySubscriptionHandleResponse(resp *http.Response) (CacheNodesOperationsClientListBySubscriptionResponse, error) { + result := CacheNodesOperationsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CacheNodePreviewResourceListResult); err != nil { + return CacheNodesOperationsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - updates an existing Cache Node +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - properties - The resource properties to be updated. +// - options - CacheNodesOperationsClientUpdateOptions contains the optional parameters for the CacheNodesOperationsClient.Update +// method. +func (client *CacheNodesOperationsClient) Update(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, options *CacheNodesOperationsClientUpdateOptions) (CacheNodesOperationsClientUpdateResponse, error) { + var err error + const operationName = "CacheNodesOperationsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, customerResourceName, properties, options) + if err != nil { + return CacheNodesOperationsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CacheNodesOperationsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CacheNodesOperationsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *CacheNodesOperationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, _ *CacheNodesOperationsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/cacheNodes/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *CacheNodesOperationsClient) updateHandleResponse(resp *http.Response) (CacheNodesOperationsClientUpdateResponse, error) { + result := CacheNodesOperationsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CacheNodePreviewResource); err != nil { + return CacheNodesOperationsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client_example_test.go new file mode 100644 index 000000000000..cea4ab844d63 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client_example_test.go @@ -0,0 +1,394 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "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/connectedcache/armconnectedcache" + "log" +) + +// Generated from example definition: 2023-05-01-preview/CacheNodesOperations_CreateorUpdate_MaximumSet_Gen.json +func ExampleCacheNodesOperationsClient_BeginCreateorUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCacheNodesOperationsClient().BeginCreateorUpdate(ctx, "rgConnectedCache", "lwrsyhvfpcfrwrim", armconnectedcache.CacheNodePreviewResource{ + Location: to.Ptr("westus"), + Properties: &armconnectedcache.CacheNodeOldResponse{ + StatusCode: to.Ptr("movtzupooyhdqk"), + StatusText: to.Ptr("bjnsrpzaofjntleoesjwammgbi"), + StatusDetails: to.Ptr("quuziibkwtgf"), + Error: &armconnectedcache.ErrorDetail{}, + }, + Tags: map[string]*string{ + "key8256": to.Ptr("oreqiywrjkmate"), + }, + }, 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 = armconnectedcache.CacheNodesOperationsClientCreateorUpdateResponse{ + // CacheNodePreviewResource: &armconnectedcache.CacheNodePreviewResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("movtzupooyhdqk"), + // StatusText: to.Ptr("bjnsrpzaofjntleoesjwammgbi"), + // StatusDetails: to.Ptr("quuziibkwtgf"), + // Status: to.Ptr("vxwmuwtqimapfw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dzxbdigdjbdbdclvxkxmfutgcbjf"), + // Message: to.Ptr("ifabxmzinicoximnsjkmhdpdgkw"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key8256": to.Ptr("oreqiywrjkmate"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("yqwxlhphavoggkcwg"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-31T00:19:33.838Z"); return t}()), + // LastModifiedBy: to.Ptr("knekx"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-31T00:19:33.838Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/CacheNodesOperations_Delete_MaximumSet_Gen.json +func ExampleCacheNodesOperationsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCacheNodesOperationsClient().Delete(ctx, "rgConnectedCache", "otvtvhmovthjwzjzbsqkbnmpcmmeianpqxmmaspvdczmrenquxigrtuarmlcmvsnaclhcbw", 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 = armconnectedcache.CacheNodesOperationsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2023-05-01-preview/CacheNodesOperations_Get_MaximumSet_Gen.json +func ExampleCacheNodesOperationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCacheNodesOperationsClient().Get(ctx, "rgConnectedCache", "nqoxkgorhuzbhjwcegymzqbeydzjupemekt", 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 = armconnectedcache.CacheNodesOperationsClientGetResponse{ + // CacheNodePreviewResource: &armconnectedcache.CacheNodePreviewResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("movtzupooyhdqk"), + // StatusText: to.Ptr("bjnsrpzaofjntleoesjwammgbi"), + // StatusDetails: to.Ptr("quuziibkwtgf"), + // Status: to.Ptr("vxwmuwtqimapfw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dzxbdigdjbdbdclvxkxmfutgcbjf"), + // Message: to.Ptr("ifabxmzinicoximnsjkmhdpdgkw"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key8256": to.Ptr("oreqiywrjkmate"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("yqwxlhphavoggkcwg"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-31T00:19:33.838Z"); return t}()), + // LastModifiedBy: to.Ptr("knekx"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-31T00:19:33.838Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/CacheNodesOperations_ListByResourceGroup_MaximumSet_Gen.json +func ExampleCacheNodesOperationsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewCacheNodesOperationsClient().NewListByResourceGroupPager("rgConnectedCache", 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 = armconnectedcache.CacheNodesOperationsClientListByResourceGroupResponse{ + // CacheNodePreviewResourceListResult: armconnectedcache.CacheNodePreviewResourceListResult{ + // Value: []*armconnectedcache.CacheNodePreviewResource{ + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4711": to.Ptr("zfrkvxymuupxgxrkkmbm"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest1"), + // Name: to.Ptr("MCCTPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("gtqfmwgkfp"), + // StatusText: to.Ptr("ztbgggsdeihkputd"), + // StatusDetails: to.Ptr("odhpdelbuqrfkiaolqrrzpdaokctz"), + // Status: to.Ptr("mobullauhrxnpyocr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key8585": to.Ptr("jgoeqypqcf"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/CacheNodesOperations_ListBySubscription_MaximumSet_Gen.json +func ExampleCacheNodesOperationsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewCacheNodesOperationsClient().NewListBySubscriptionPager(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 = armconnectedcache.CacheNodesOperationsClientListBySubscriptionResponse{ + // CacheNodePreviewResourceListResult: armconnectedcache.CacheNodePreviewResourceListResult{ + // Value: []*armconnectedcache.CacheNodePreviewResource{ + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4711": to.Ptr("zfrkvxymuupxgxrkkmbm"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest1"), + // Name: to.Ptr("MCCTPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("gtqfmwgkfp"), + // StatusText: to.Ptr("ztbgggsdeihkputd"), + // StatusDetails: to.Ptr("odhpdelbuqrfkiaolqrrzpdaokctz"), + // Status: to.Ptr("mobullauhrxnpyocr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key8585": to.Ptr("jgoeqypqcf"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/CacheNodesOperations_Update_MaximumSet_Gen.json +func ExampleCacheNodesOperationsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCacheNodesOperationsClient().Update(ctx, "rgConnectedCache", "wlrwpdbcv", armconnectedcache.PatchResource{ + Tags: map[string]*string{ + "key5032": to.Ptr("esiuyjbpcwkpqriqiqztxuocv"), + }, + }, 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 = armconnectedcache.CacheNodesOperationsClientUpdateResponse{ + // CacheNodePreviewResource: &armconnectedcache.CacheNodePreviewResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("movtzupooyhdqk"), + // StatusText: to.Ptr("bjnsrpzaofjntleoesjwammgbi"), + // StatusDetails: to.Ptr("quuziibkwtgf"), + // Status: to.Ptr("vxwmuwtqimapfw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dzxbdigdjbdbdclvxkxmfutgcbjf"), + // Message: to.Ptr("ifabxmzinicoximnsjkmhdpdgkw"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key8256": to.Ptr("oreqiywrjkmate"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("yqwxlhphavoggkcwg"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-31T00:19:33.838Z"); return t}()), + // LastModifiedBy: to.Ptr("knekx"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-31T00:19:33.838Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/ci.yml b/sdk/resourcemanager/connectedcache/armconnectedcache/ci.yml new file mode 100644 index 000000000000..e15ca009167c --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/connectedcache/armconnectedcache/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/connectedcache/armconnectedcache/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/connectedcache/armconnectedcache' diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/client_factory.go b/sdk/resourcemanager/connectedcache/armconnectedcache/client_factory.go new file mode 100644 index 000000000000..f565046ada09 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/client_factory.go @@ -0,0 +1,88 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - 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) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewCacheNodesOperationsClient creates a new instance of CacheNodesOperationsClient. +func (c *ClientFactory) NewCacheNodesOperationsClient() *CacheNodesOperationsClient { + return &CacheNodesOperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewEnterpriseCustomerOperationsClient creates a new instance of EnterpriseCustomerOperationsClient. +func (c *ClientFactory) NewEnterpriseCustomerOperationsClient() *EnterpriseCustomerOperationsClient { + return &EnterpriseCustomerOperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewEnterpriseMccCacheNodesOperationsClient creates a new instance of EnterpriseMccCacheNodesOperationsClient. +func (c *ClientFactory) NewEnterpriseMccCacheNodesOperationsClient() *EnterpriseMccCacheNodesOperationsClient { + return &EnterpriseMccCacheNodesOperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewEnterpriseMccCustomersClient creates a new instance of EnterpriseMccCustomersClient. +func (c *ClientFactory) NewEnterpriseMccCustomersClient() *EnterpriseMccCustomersClient { + return &EnterpriseMccCustomersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewIspCacheNodesOperationsClient creates a new instance of IspCacheNodesOperationsClient. +func (c *ClientFactory) NewIspCacheNodesOperationsClient() *IspCacheNodesOperationsClient { + return &IspCacheNodesOperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewIspCustomersClient creates a new instance of IspCustomersClient. +func (c *ClientFactory) NewIspCustomersClient() *IspCustomersClient { + return &IspCustomersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/constants.go b/sdk/resourcemanager/connectedcache/armconnectedcache/constants.go new file mode 100644 index 000000000000..9a67cde6c50a --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/constants.go @@ -0,0 +1,248 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache" + moduleVersion = "v0.1.0" +) + +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + // ActionTypeInternal - Actions are for internal-only APIs. + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// AutoUpdateRingType - Auto update Ring type +type AutoUpdateRingType string + +const ( + // AutoUpdateRingTypeFast - customer selection of fast / auto update to install mcc on their physical vm + AutoUpdateRingTypeFast AutoUpdateRingType = "Fast" + // AutoUpdateRingTypePreview - customer selection of preview update install mcc on their physical vm + AutoUpdateRingTypePreview AutoUpdateRingType = "Preview" + // AutoUpdateRingTypeSlow - customer selection of slow update to install mcc on their physical vm + AutoUpdateRingTypeSlow AutoUpdateRingType = "Slow" +) + +// PossibleAutoUpdateRingTypeValues returns the possible values for the AutoUpdateRingType const type. +func PossibleAutoUpdateRingTypeValues() []AutoUpdateRingType { + return []AutoUpdateRingType{ + AutoUpdateRingTypeFast, + AutoUpdateRingTypePreview, + AutoUpdateRingTypeSlow, + } +} + +// BgpReviewStateEnum - Cache node resource Bgp review state as integer +type BgpReviewStateEnum string + +const ( + // BgpReviewStateEnumApproved - bgp is in Approved state + BgpReviewStateEnumApproved BgpReviewStateEnum = "Approved" + // BgpReviewStateEnumAttentionRequired - bgp is setup need an attention for more troubleshoot + BgpReviewStateEnumAttentionRequired BgpReviewStateEnum = "AttentionRequired" + // BgpReviewStateEnumInReview - bgp is in review state + BgpReviewStateEnumInReview BgpReviewStateEnum = "InReview" + // BgpReviewStateEnumNotConfigured - bgp not configured + BgpReviewStateEnumNotConfigured BgpReviewStateEnum = "NotConfigured" +) + +// PossibleBgpReviewStateEnumValues returns the possible values for the BgpReviewStateEnum const type. +func PossibleBgpReviewStateEnumValues() []BgpReviewStateEnum { + return []BgpReviewStateEnum{ + BgpReviewStateEnumApproved, + BgpReviewStateEnumAttentionRequired, + BgpReviewStateEnumInReview, + BgpReviewStateEnumNotConfigured, + } +} + +// ConfigurationState - Cache node configuration setup state +type ConfigurationState string + +const ( + // ConfigurationStateConfigured - connected cache setup configured + ConfigurationStateConfigured ConfigurationState = "Configured" + // ConfigurationStateNotConfiguredIP - connected cache setup not configured + ConfigurationStateNotConfiguredIP ConfigurationState = "NotConfigured_Ip" +) + +// PossibleConfigurationStateValues returns the possible values for the ConfigurationState const type. +func PossibleConfigurationStateValues() []ConfigurationState { + return []ConfigurationState{ + ConfigurationStateConfigured, + ConfigurationStateNotConfiguredIP, + } +} + +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string + +const ( + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// CustomerTransitState - Customer resource transit states +type CustomerTransitState string + +const ( + // CustomerTransitStateCombinedTransit - transit provider and have own subscribers + CustomerTransitStateCombinedTransit CustomerTransitState = "CombinedTransit" + // CustomerTransitStateNoTransit - do not have transit + CustomerTransitStateNoTransit CustomerTransitState = "NoTransit" + // CustomerTransitStateTransitOnly - pure transit provider or network service provider + CustomerTransitStateTransitOnly CustomerTransitState = "TransitOnly" +) + +// PossibleCustomerTransitStateValues returns the possible values for the CustomerTransitState const type. +func PossibleCustomerTransitStateValues() []CustomerTransitState { + return []CustomerTransitState{ + CustomerTransitStateCombinedTransit, + CustomerTransitStateNoTransit, + CustomerTransitStateTransitOnly, + } +} + +// CycleType - Update Cycle type +type CycleType string + +const ( + // CycleTypeFast - customer selection of fast / auto update to install mcc on their physical vm + CycleTypeFast CycleType = "Fast" + // CycleTypePreview - customer selection of preview update install mcc on their physical vm + CycleTypePreview CycleType = "Preview" + // CycleTypeSlow - customer selection of slow update to install mcc on their physical vm + CycleTypeSlow CycleType = "Slow" +) + +// PossibleCycleTypeValues returns the possible values for the CycleType const type. +func PossibleCycleTypeValues() []CycleType { + return []CycleType{ + CycleTypeFast, + CycleTypePreview, + CycleTypeSlow, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// OsType - Operating System of the cache node +type OsType string + +const ( + // OsTypeEflow - cache node installs on Azure Eflow + OsTypeEflow OsType = "Eflow" + // OsTypeLinux - cache node installs on Linux Operating system + OsTypeLinux OsType = "Linux" + // OsTypeWindows - cache node installs on windows operating system + OsTypeWindows OsType = "Windows" +) + +// PossibleOsTypeValues returns the possible values for the OsType const type. +func PossibleOsTypeValues() []OsType { + return []OsType{ + OsTypeEflow, + OsTypeLinux, + OsTypeWindows, + } +} + +// ProvisioningState - provisioning state of the resource +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - Accepted state of the provisioning state during the Async Operations + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - Deleting state of the provisioning state + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUnknown - unknown state of the provisioning state + ProvisioningStateUnknown ProvisioningState = "Unknown" + // ProvisioningStateUpgrading - Upgrading state of the provisioning state + ProvisioningStateUpgrading ProvisioningState = "Upgrading" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + ProvisioningStateUnknown, + ProvisioningStateUpgrading, + } +} + +// ProxyRequired - Proxy details enum +type ProxyRequired string + +const ( + // ProxyRequiredNone - Proxy is not required in setup + ProxyRequiredNone ProxyRequired = "None" + // ProxyRequiredRequired - proxy is required in setup + ProxyRequiredRequired ProxyRequired = "Required" +) + +// PossibleProxyRequiredValues returns the possible values for the ProxyRequired const type. +func PossibleProxyRequiredValues() []ProxyRequired { + return []ProxyRequired{ + ProxyRequiredNone, + ProxyRequiredRequired, + } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client.go new file mode 100644 index 000000000000..467e33af5a78 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client.go @@ -0,0 +1,426 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +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" +) + +// EnterpriseCustomerOperationsClient contains the methods for the EnterpriseCustomerOperations group. +// Don't use this type directly, use NewEnterpriseCustomerOperationsClient() instead. +type EnterpriseCustomerOperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEnterpriseCustomerOperationsClient creates a new instance of EnterpriseCustomerOperationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEnterpriseCustomerOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EnterpriseCustomerOperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EnterpriseCustomerOperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a cacheNodes with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - resource - Resource create parameters. +// - options - EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.BeginCreateOrUpdate +// method. +func (client *EnterpriseCustomerOperationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource EnterprisePreviewResource, options *EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[EnterpriseCustomerOperationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, customerResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EnterpriseCustomerOperationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EnterpriseCustomerOperationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates a cacheNodes with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *EnterpriseCustomerOperationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource EnterprisePreviewResource, options *EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EnterpriseCustomerOperationsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, customerResourceName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *EnterpriseCustomerOperationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, resource EnterprisePreviewResource, _ *EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Deletes an existing customer Enterprise resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - EnterpriseCustomerOperationsClientDeleteOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.Delete +// method. +func (client *EnterpriseCustomerOperationsClient) Delete(ctx context.Context, resourceGroupName string, customerResourceName string, options *EnterpriseCustomerOperationsClientDeleteOptions) (EnterpriseCustomerOperationsClientDeleteResponse, error) { + var err error + const operationName = "EnterpriseCustomerOperationsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, customerResourceName, options) + if err != nil { + return EnterpriseCustomerOperationsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseCustomerOperationsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return EnterpriseCustomerOperationsClientDeleteResponse{}, err + } + return EnterpriseCustomerOperationsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *EnterpriseCustomerOperationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *EnterpriseCustomerOperationsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the properties of a Enterprise customer +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - EnterpriseCustomerOperationsClientGetOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.Get +// method. +func (client *EnterpriseCustomerOperationsClient) Get(ctx context.Context, resourceGroupName string, customerResourceName string, options *EnterpriseCustomerOperationsClientGetOptions) (EnterpriseCustomerOperationsClientGetResponse, error) { + var err error + const operationName = "EnterpriseCustomerOperationsClient.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, customerResourceName, options) + if err != nil { + return EnterpriseCustomerOperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseCustomerOperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseCustomerOperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EnterpriseCustomerOperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *EnterpriseCustomerOperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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", "2023-05-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 *EnterpriseCustomerOperationsClient) getHandleResponse(resp *http.Response) (EnterpriseCustomerOperationsClientGetResponse, error) { + result := EnterpriseCustomerOperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterprisePreviewResource); err != nil { + return EnterpriseCustomerOperationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Retrieves the properties of all ConnectedCache enterpriseCustomers +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - EnterpriseCustomerOperationsClientListByResourceGroupOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.NewListByResourceGroupPager +// method. +func (client *EnterpriseCustomerOperationsClient) NewListByResourceGroupPager(resourceGroupName string, options *EnterpriseCustomerOperationsClientListByResourceGroupOptions) *runtime.Pager[EnterpriseCustomerOperationsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[EnterpriseCustomerOperationsClientListByResourceGroupResponse]{ + More: func(page EnterpriseCustomerOperationsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EnterpriseCustomerOperationsClientListByResourceGroupResponse) (EnterpriseCustomerOperationsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EnterpriseCustomerOperationsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return EnterpriseCustomerOperationsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *EnterpriseCustomerOperationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *EnterpriseCustomerOperationsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseCustomers" + 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)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *EnterpriseCustomerOperationsClient) listByResourceGroupHandleResponse(resp *http.Response) (EnterpriseCustomerOperationsClientListByResourceGroupResponse, error) { + result := EnterpriseCustomerOperationsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterprisePreviewResourceListResult); err != nil { + return EnterpriseCustomerOperationsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Retrieves the properties of all ConnectedCaches +// +// Generated from API version 2023-05-01-preview +// - options - EnterpriseCustomerOperationsClientListBySubscriptionOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.NewListBySubscriptionPager +// method. +func (client *EnterpriseCustomerOperationsClient) NewListBySubscriptionPager(options *EnterpriseCustomerOperationsClientListBySubscriptionOptions) *runtime.Pager[EnterpriseCustomerOperationsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[EnterpriseCustomerOperationsClientListBySubscriptionResponse]{ + More: func(page EnterpriseCustomerOperationsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EnterpriseCustomerOperationsClientListBySubscriptionResponse) (EnterpriseCustomerOperationsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EnterpriseCustomerOperationsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return EnterpriseCustomerOperationsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *EnterpriseCustomerOperationsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *EnterpriseCustomerOperationsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedCache/enterpriseCustomers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *EnterpriseCustomerOperationsClient) listBySubscriptionHandleResponse(resp *http.Response) (EnterpriseCustomerOperationsClientListBySubscriptionResponse, error) { + result := EnterpriseCustomerOperationsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterprisePreviewResourceListResult); err != nil { + return EnterpriseCustomerOperationsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - updates an existing enterpriseCustomers +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - properties - The resource properties to be updated. +// - options - EnterpriseCustomerOperationsClientUpdateOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.Update +// method. +func (client *EnterpriseCustomerOperationsClient) Update(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, options *EnterpriseCustomerOperationsClientUpdateOptions) (EnterpriseCustomerOperationsClientUpdateResponse, error) { + var err error + const operationName = "EnterpriseCustomerOperationsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, customerResourceName, properties, options) + if err != nil { + return EnterpriseCustomerOperationsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseCustomerOperationsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseCustomerOperationsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *EnterpriseCustomerOperationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, _ *EnterpriseCustomerOperationsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *EnterpriseCustomerOperationsClient) updateHandleResponse(resp *http.Response) (EnterpriseCustomerOperationsClientUpdateResponse, error) { + result := EnterpriseCustomerOperationsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterprisePreviewResource); err != nil { + return EnterpriseCustomerOperationsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client_example_test.go new file mode 100644 index 000000000000..e5afac622ea2 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client_example_test.go @@ -0,0 +1,334 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "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/connectedcache/armconnectedcache" + "log" +) + +// Generated from example definition: 2023-05-01-preview/EnterpriseCustomerOperations_CreateOrUpdate_MaximumSet_Gen.json +func ExampleEnterpriseCustomerOperationsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEnterpriseCustomerOperationsClient().BeginCreateOrUpdate(ctx, "rgConnectedCache", "l", armconnectedcache.EnterprisePreviewResource{ + Properties: &armconnectedcache.CacheNodeOldResponse{ + StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + StatusText: to.Ptr("bs"), + StatusDetails: to.Ptr("lhwvcz"), + Error: &armconnectedcache.ErrorDetail{}, + }, + Tags: map[string]*string{ + "key4215": to.Ptr("zjbszvlzf"), + }, + Location: to.Ptr("zdzhhkjyogrqxwihkifnmeyhwpujbr"), + }, 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 = armconnectedcache.EnterpriseCustomerOperationsClientCreateOrUpdateResponse{ + // EnterprisePreviewResource: &armconnectedcache.EnterprisePreviewResource{ + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4215": to.Ptr("zjbszvlzf"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseCustomers"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseCustomerOperations_Delete_MaximumSet_Gen.json +func ExampleEnterpriseCustomerOperationsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseCustomerOperationsClient().Delete(ctx, "rgConnectedCache", "jeubxmhiaihcusgnahblvvckbdcetacvqgwbohlrqucodtlwuyefpejskvamgrdnwgucziodcfpjhqy", 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 = armconnectedcache.EnterpriseCustomerOperationsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseCustomerOperations_Get_MaximumSet_Gen.json +func ExampleEnterpriseCustomerOperationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseCustomerOperationsClient().Get(ctx, "rgConnectedCache", "MCCTPTest2", 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 = armconnectedcache.EnterpriseCustomerOperationsClientGetResponse{ + // EnterprisePreviewResource: &armconnectedcache.EnterprisePreviewResource{ + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4215": to.Ptr("zjbszvlzf"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseCustomers"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseCustomerOperations_ListByResourceGroup_MaximumSet_Gen.json +func ExampleEnterpriseCustomerOperationsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEnterpriseCustomerOperationsClient().NewListByResourceGroupPager("rgConnectedCache", 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 = armconnectedcache.EnterpriseCustomerOperationsClientListByResourceGroupResponse{ + // EnterprisePreviewResourceListResult: armconnectedcache.EnterprisePreviewResourceListResult{ + // Value: []*armconnectedcache.EnterprisePreviewResource{ + // { + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4215": to.Ptr("zjbszvlzf"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseCustomers"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseCustomerOperations_ListBySubscription_MaximumSet_Gen.json +func ExampleEnterpriseCustomerOperationsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEnterpriseCustomerOperationsClient().NewListBySubscriptionPager(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 = armconnectedcache.EnterpriseCustomerOperationsClientListBySubscriptionResponse{ + // EnterprisePreviewResourceListResult: armconnectedcache.EnterprisePreviewResourceListResult{ + // Value: []*armconnectedcache.EnterprisePreviewResource{ + // { + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4215": to.Ptr("zjbszvlzf"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseCustomers"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseCustomerOperations_Update_MaximumSet_Gen.json +func ExampleEnterpriseCustomerOperationsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseCustomerOperationsClient().Update(ctx, "rgConnectedCache", "MCCTPTest2", armconnectedcache.PatchResource{ + Tags: map[string]*string{ + "key1653": to.Ptr("nzjczrhclhkndesgy"), + }, + }, 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 = armconnectedcache.EnterpriseCustomerOperationsClientUpdateResponse{ + // EnterprisePreviewResource: &armconnectedcache.EnterprisePreviewResource{ + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4215": to.Ptr("zjbszvlzf"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseCustomers"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client.go new file mode 100644 index 000000000000..ddde3de711f9 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client.go @@ -0,0 +1,488 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +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" +) + +// EnterpriseMccCacheNodesOperationsClient contains the methods for the EnterpriseMccCacheNodesOperations group. +// Don't use this type directly, use NewEnterpriseMccCacheNodesOperationsClient() instead. +type EnterpriseMccCacheNodesOperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEnterpriseMccCacheNodesOperationsClient creates a new instance of EnterpriseMccCacheNodesOperationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEnterpriseMccCacheNodesOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EnterpriseMccCacheNodesOperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EnterpriseMccCacheNodesOperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - This api creates an ispCacheNode with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - resource - Resource create parameters. +// - options - EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.BeginCreateOrUpdate +// method. +func (client *EnterpriseMccCacheNodesOperationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource EnterpriseMccCacheNodeResource, options *EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - This api creates an ispCacheNode with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *EnterpriseMccCacheNodesOperationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource EnterpriseMccCacheNodeResource, options *EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EnterpriseMccCacheNodesOperationsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *EnterpriseMccCacheNodesOperationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource EnterpriseMccCacheNodeResource, _ *EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}/enterpriseMccCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - This api deletes an existing ispCacheNode resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.BeginDelete +// method. +func (client *EnterpriseMccCacheNodesOperationsClient) BeginDelete(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions) (*runtime.Poller[EnterpriseMccCacheNodesOperationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EnterpriseMccCacheNodesOperationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EnterpriseMccCacheNodesOperationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - This api deletes an existing ispCacheNode resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *EnterpriseMccCacheNodesOperationsClient) deleteOperation(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "EnterpriseMccCacheNodesOperationsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *EnterpriseMccCacheNodesOperationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}/enterpriseMccCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - This api gets ispCacheNode resource information +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - EnterpriseMccCacheNodesOperationsClientGetOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.Get +// method. +func (client *EnterpriseMccCacheNodesOperationsClient) Get(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *EnterpriseMccCacheNodesOperationsClientGetOptions) (EnterpriseMccCacheNodesOperationsClientGetResponse, error) { + var err error + const operationName = "EnterpriseMccCacheNodesOperationsClient.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, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseMccCacheNodesOperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EnterpriseMccCacheNodesOperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *EnterpriseMccCacheNodesOperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}/enterpriseMccCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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", "2023-05-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 *EnterpriseMccCacheNodesOperationsClient) getHandleResponse(resp *http.Response) (EnterpriseMccCacheNodesOperationsClientGetResponse, error) { + result := EnterpriseMccCacheNodesOperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCacheNodeResource); err != nil { + return EnterpriseMccCacheNodesOperationsClientGetResponse{}, err + } + return result, nil +} + +// GetCacheNodeInstallDetails - This api gets secrets of the ispCacheNode resource install details +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions contains the optional parameters for +// the EnterpriseMccCacheNodesOperationsClient.GetCacheNodeInstallDetails method. +func (client *EnterpriseMccCacheNodesOperationsClient) GetCacheNodeInstallDetails(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions) (EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse, error) { + var err error + const operationName = "EnterpriseMccCacheNodesOperationsClient.GetCacheNodeInstallDetails" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCacheNodeInstallDetailsCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + resp, err := client.getCacheNodeInstallDetailsHandleResponse(httpResp) + return resp, err +} + +// getCacheNodeInstallDetailsCreateRequest creates the GetCacheNodeInstallDetails request. +func (client *EnterpriseMccCacheNodesOperationsClient) getCacheNodeInstallDetailsCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}/enterpriseMccCacheNodes/{cacheNodeResourceName}/getCacheNodeInstallDetails" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCacheNodeInstallDetailsHandleResponse handles the GetCacheNodeInstallDetails response. +func (client *EnterpriseMccCacheNodesOperationsClient) getCacheNodeInstallDetailsHandleResponse(resp *http.Response) (EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse, error) { + result := EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MccCacheNodeInstallDetails); err != nil { + return EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + return result, nil +} + +// NewListByEnterpriseMccCustomerResourcePager - This api retrieves information about all ispCacheNode resources under the +// given subscription and resource group +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceOptions contains the optional parameters +// for the EnterpriseMccCacheNodesOperationsClient.NewListByEnterpriseMccCustomerResourcePager method. +func (client *EnterpriseMccCacheNodesOperationsClient) NewListByEnterpriseMccCustomerResourcePager(resourceGroupName string, customerResourceName string, options *EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceOptions) *runtime.Pager[EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse] { + return runtime.NewPager(runtime.PagingHandler[EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse]{ + More: func(page EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse) (EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EnterpriseMccCacheNodesOperationsClient.NewListByEnterpriseMccCustomerResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByEnterpriseMccCustomerResourceCreateRequest(ctx, resourceGroupName, customerResourceName, options) + }, nil) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse{}, err + } + return client.listByEnterpriseMccCustomerResourceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByEnterpriseMccCustomerResourceCreateRequest creates the ListByEnterpriseMccCustomerResource request. +func (client *EnterpriseMccCacheNodesOperationsClient) listByEnterpriseMccCustomerResourceCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}/enterpriseMccCacheNodes" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByEnterpriseMccCustomerResourceHandleResponse handles the ListByEnterpriseMccCustomerResource response. +func (client *EnterpriseMccCacheNodesOperationsClient) listByEnterpriseMccCustomerResourceHandleResponse(resp *http.Response) (EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse, error) { + result := EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCacheNodeResourceListResult); err != nil { + return EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse{}, err + } + return result, nil +} + +// Update - This api updates an existing ispCacheNode resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - properties - The resource properties to be updated. +// - options - EnterpriseMccCacheNodesOperationsClientUpdateOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.Update +// method. +func (client *EnterpriseMccCacheNodesOperationsClient) Update(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, properties PatchResource, options *EnterpriseMccCacheNodesOperationsClientUpdateOptions) (EnterpriseMccCacheNodesOperationsClientUpdateResponse, error) { + var err error + const operationName = "EnterpriseMccCacheNodesOperationsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, properties, options) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseMccCacheNodesOperationsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *EnterpriseMccCacheNodesOperationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, properties PatchResource, _ *EnterpriseMccCacheNodesOperationsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}/enterpriseMccCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *EnterpriseMccCacheNodesOperationsClient) updateHandleResponse(resp *http.Response) (EnterpriseMccCacheNodesOperationsClientUpdateResponse, error) { + result := EnterpriseMccCacheNodesOperationsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCacheNodeResource); err != nil { + return EnterpriseMccCacheNodesOperationsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client_example_test.go new file mode 100644 index 000000000000..e682e439e575 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client_example_test.go @@ -0,0 +1,684 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "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/connectedcache/armconnectedcache" + "log" +) + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCacheNodesOperations_CreateOrUpdate_MaximumSet_Gen.json +func ExampleEnterpriseMccCacheNodesOperationsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEnterpriseMccCacheNodesOperationsClient().BeginCreateOrUpdate(ctx, "rgConnectedCache", "nhdkvstdrrtsxxuz", "fgduqdovidpemlnmhelomffuafdrbgaasqznvrdkbvspfzsnrhncdtqquhijhdpwyzwleukqldpceyxqhqlftqrr", armconnectedcache.EnterpriseMccCacheNodeResource{ + Location: to.Ptr("westus"), + Properties: &armconnectedcache.CacheNodeProperty{ + CacheNode: &armconnectedcache.CacheNodeEntity{ + FullyQualifiedResourceID: to.Ptr("yeinlleavzbehelhsucb"), + CustomerName: to.Ptr("zsklcocjfjhkcpmzyefzkwamdzc"), + IPAddress: to.Ptr("gbfkdhloyphnpnhemwrcrxlk"), + CustomerIndex: to.Ptr("vafvezmelfgmjsrccjukrhppljvipg"), + CacheNodeID: to.Ptr("fmrjefyddfn"), + CacheNodeName: to.Ptr("qppvqxliajjfoalzjbgmxggr"), + CustomerAsn: to.Ptr[int32](25), + IsEnabled: to.Ptr(true), + MaxAllowableEgressInMbps: to.Ptr[int32](27), + IsEnterpriseManaged: to.Ptr(true), + CidrCSV: []*string{ + to.Ptr("nlqlvrthafvvljuupcbcw"), + }, + ShouldMigrate: to.Ptr(true), + CidrSelectionType: to.Ptr[int32](11), + }, + StatusCode: to.Ptr("1"), + StatusText: to.Ptr("Success"), + StatusDetails: to.Ptr("lgljxmyyoakw"), + AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + CacheNodePropertiesDetailsIssuesList: []*string{ + to.Ptr("ennbzfpuszgalzpawmwicaofqcwcj"), + }, + DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + { + PhysicalPath: to.Ptr("pcbkezoofhamkycot"), + SizeInGb: to.Ptr[int32](14), + CacheNumber: to.Ptr[int32](11), + NginxMapping: to.Ptr("cirlpkpuxg"), + }, + }, + BgpConfiguration: &armconnectedcache.BgpConfiguration{ + AsnToIPAddressMapping: to.Ptr("fjbggfvumrn"), + }, + ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + ProxyURL: to.Ptr("hplstyg"), + }, + ProxyURL: to.Ptr("ihkzxlzvpcywtzrogupqozkdud"), + OptionalProperty1: to.Ptr("ph"), + OptionalProperty2: to.Ptr("soqqgpgcbhb"), + OptionalProperty3: to.Ptr("fpnycrbagptsujiotnjfuhlm"), + OptionalProperty4: to.Ptr("gesqugrxvhxlxxyvatgrautxwlmxsf"), + OptionalProperty5: to.Ptr("zknjgzpaqtvdqjydd"), + }, + Error: &armconnectedcache.ErrorDetail{}, + }, + Tags: map[string]*string{ + "key259": to.Ptr("qbkixjuyjkoj"), + }, + }, 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 = armconnectedcache.EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse{ + // EnterpriseMccCacheNodeResource: &armconnectedcache.EnterpriseMccCacheNodeResource{ + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DOTest/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1/enterpriseMccCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers/enterpriseMccCacheNodes"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("yeinlleavzbehelhsucb"), + // CustomerID: to.Ptr("xjjgcknmsakfawcmwbdufdxktysp"), + // CustomerName: to.Ptr("zsklcocjfjhkcpmzyefzkwamdzc"), + // IPAddress: to.Ptr("gbfkdhloyphnpnhemwrcrxlk"), + // CustomerIndex: to.Ptr("vafvezmelfgmjsrccjukrhppljvipg"), + // CacheNodeID: to.Ptr("fmrjefyddfn"), + // CacheNodeName: to.Ptr("qppvqxliajjfoalzjbgmxggr"), + // CustomerAsn: to.Ptr[int32](25), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](27), + // MaxAllowableProbability: to.Ptr[float32](12), + // XCid: to.Ptr("ooyrhuockukmsrqsevwaaqglhf"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("tvmivvnpisuboggoqgbobugld"), + // ClientTenantID: to.Ptr("iwrpakllacxvtqygpaimlpxvqrjz"), + // Category: to.Ptr("utfjefejkrpxcmrgygzawa"), + // ReleaseVersion: to.Ptr[int32](29), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](4), + // ContainerConfigurations: to.Ptr("dyvefvbvrtsmdrdmiuphzh"), + // CidrCSV: []*string{ + // to.Ptr("nlqlvrthafvvljuupcbcw"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpReviewStateText: to.Ptr("khtriksrqrjieouoz"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("bc"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](23), + // BgpNumberOfRecords: to.Ptr[int32](25), + // BgpCidrBlocksCount: to.Ptr[int32](28), + // BgpAddressSpace: to.Ptr[int32](30), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](26), + // CidrSelectionType: to.Ptr[int32](11), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](2), + // ReviewStateText: to.Ptr("xubwhyrdtramrmoldbxqwauyusymqu"), + // ReviewFeedback: to.Ptr("zowuztcnybt"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("okbofqwtzcsju"), + // AddressSpace: to.Ptr[int32](1), + // WorkerConnections: to.Ptr[int32](19), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](23), + // ImageURI: to.Ptr("wkowdrixfxvjmdcsy"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("lgljxmyyoakw"), + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ennbzfpuszgalzpawmwicaofqcwcj"), + // }, + // AggregatedStatusDetails: to.Ptr("nztcstlyjhmllbnrrluhzusmoa"), + // AggregatedStatusText: to.Ptr("ofiedyvzpbijnfghnrrigqaws"), + // AggregatedStatusCode: to.Ptr[int32](25), + // ProductVersion: to.Ptr("hfbuukpxoerpkziym"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("onckp"), + // CacheNodeStateShortText: to.Ptr("yxkwlubqlzhkmemzjzlxksho"), + // CacheNodeState: to.Ptr[int32](30), + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("pcbkezoofhamkycot"), + // SizeInGb: to.Ptr[int32](14), + // CacheNumber: to.Ptr[int32](11), + // NginxMapping: to.Ptr("cirlpkpuxg"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("fjbggfvumrn"), + // }, + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("ihkzxlzvpcywtzrogupqozkdud"), + // OptionalProperty1: to.Ptr("ph"), + // OptionalProperty2: to.Ptr("soqqgpgcbhb"), + // OptionalProperty3: to.Ptr("fpnycrbagptsujiotnjfuhlm"), + // OptionalProperty4: to.Ptr("gesqugrxvhxlxxyvatgrautxwlmxsf"), + // OptionalProperty5: to.Ptr("zknjgzpaqtvdqjydd"), + // }, + // Status: to.Ptr("utgrdjsw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key259": to.Ptr("qbkixjuyjkoj"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCacheNodesOperations_Delete_MaximumSet_Gen.json +func ExampleEnterpriseMccCacheNodesOperationsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEnterpriseMccCacheNodesOperationsClient().BeginDelete(ctx, "rgConnectedCache", "hsincngmssuzeyispnufqwinpopadvhsbsemisguxgovwdjwviqexocelijvuyr", "vwtrhdoxvkrunpliwcao", 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: 2023-05-01-preview/EnterpriseMccCacheNodesOperations_Get_MaximumSet_Gen.json +func ExampleEnterpriseMccCacheNodesOperationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseMccCacheNodesOperationsClient().Get(ctx, "rgConnectedCache", "cygqjgtcetihsajgyqwwrbclssqsvhgltrboemcqqtpoxdbhykqxblaihmrumyhbsx", "fqxfadsultwjfzdwlqkvneakfsbyhratytmssmiukpbnus", 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 = armconnectedcache.EnterpriseMccCacheNodesOperationsClientGetResponse{ + // EnterpriseMccCacheNodeResource: &armconnectedcache.EnterpriseMccCacheNodeResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DOTest/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1/enterpriseMccCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers/enterpriseMccCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("yeinlleavzbehelhsucb"), + // CustomerID: to.Ptr("xjjgcknmsakfawcmwbdufdxktysp"), + // CustomerName: to.Ptr("zsklcocjfjhkcpmzyefzkwamdzc"), + // IPAddress: to.Ptr("gbfkdhloyphnpnhemwrcrxlk"), + // CustomerIndex: to.Ptr("vafvezmelfgmjsrccjukrhppljvipg"), + // CacheNodeID: to.Ptr("fmrjefyddfn"), + // CacheNodeName: to.Ptr("qppvqxliajjfoalzjbgmxggr"), + // CustomerAsn: to.Ptr[int32](25), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](27), + // MaxAllowableProbability: to.Ptr[float32](12), + // XCid: to.Ptr("ooyrhuockukmsrqsevwaaqglhf"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("tvmivvnpisuboggoqgbobugld"), + // ClientTenantID: to.Ptr("iwrpakllacxvtqygpaimlpxvqrjz"), + // Category: to.Ptr("utfjefejkrpxcmrgygzawa"), + // ReleaseVersion: to.Ptr[int32](29), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](4), + // ContainerConfigurations: to.Ptr("dyvefvbvrtsmdrdmiuphzh"), + // CidrCSV: []*string{ + // to.Ptr("kaynxstxqsoreorwh"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpReviewStateText: to.Ptr("khtriksrqrjieouoz"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("bc"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](23), + // BgpNumberOfRecords: to.Ptr[int32](25), + // BgpCidrBlocksCount: to.Ptr[int32](28), + // BgpAddressSpace: to.Ptr[int32](30), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](26), + // CidrSelectionType: to.Ptr[int32](11), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](2), + // ReviewStateText: to.Ptr("xubwhyrdtramrmoldbxqwauyusymqu"), + // ReviewFeedback: to.Ptr("zowuztcnybt"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("okbofqwtzcsju"), + // AddressSpace: to.Ptr[int32](1), + // WorkerConnections: to.Ptr[int32](19), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](23), + // ImageURI: to.Ptr("wkowdrixfxvjmdcsy"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("lgljxmyyoakw"), + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ennbzfpuszgalzpawmwicaofqcwcj"), + // }, + // AggregatedStatusDetails: to.Ptr("nztcstlyjhmllbnrrluhzusmoa"), + // AggregatedStatusText: to.Ptr("ofiedyvzpbijnfghnrrigqaws"), + // AggregatedStatusCode: to.Ptr[int32](25), + // ProductVersion: to.Ptr("hfbuukpxoerpkziym"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("onckp"), + // CacheNodeStateShortText: to.Ptr("yxkwlubqlzhkmemzjzlxksho"), + // CacheNodeState: to.Ptr[int32](30), + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("pcbkezoofhamkycot"), + // SizeInGb: to.Ptr[int32](14), + // CacheNumber: to.Ptr[int32](11), + // NginxMapping: to.Ptr("cirlpkpuxg"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("fjbggfvumrn"), + // }, + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("ihkzxlzvpcywtzrogupqozkdud"), + // OptionalProperty1: to.Ptr("ph"), + // OptionalProperty2: to.Ptr("soqqgpgcbhb"), + // OptionalProperty3: to.Ptr("fpnycrbagptsujiotnjfuhlm"), + // OptionalProperty4: to.Ptr("gesqugrxvhxlxxyvatgrautxwlmxsf"), + // OptionalProperty5: to.Ptr("zknjgzpaqtvdqjydd"), + // }, + // Status: to.Ptr("utgrdjsw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key259": to.Ptr("qbkixjuyjkoj"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCacheNodesOperations_GetCacheNodeInstallDetails_MaximumSet_Gen.json +func ExampleEnterpriseMccCacheNodesOperationsClient_GetCacheNodeInstallDetails() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseMccCacheNodesOperationsClient().GetCacheNodeInstallDetails(ctx, "rgConnectedCache", "fzwxcjmdpxxzayecabqqlh", "ccexmqqttritxvtctivraso", 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 = armconnectedcache.EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{ + // MccCacheNodeInstallDetails: &armconnectedcache.MccCacheNodeInstallDetails{ + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1/enterpriseMccCacheNodes/MCCCachenode1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers/enterpriseMccCacheNodes"), + // Properties: &armconnectedcache.CacheNodeInstallProperties{ + // CustomerID: to.Ptr("eqklliuswn"), + // CacheNodeID: to.Ptr("zirahqqohbaju"), + // PrimaryAccountKey: to.Ptr("mzfvziehrsbxidhj"), + // SecondaryAccountKey: to.Ptr("dq"), + // RegistrationKey: to.Ptr("tnwkmorctwsgajewcoutombm"), + // }, + // Tags: map[string]*string{ + // "key5811": to.Ptr("betoafcoprgfcuscoew"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCacheNodesOperations_ListByEnterpriseMccCustomerResource_MaximumSet_Gen.json +func ExampleEnterpriseMccCacheNodesOperationsClient_NewListByEnterpriseMccCustomerResourcePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEnterpriseMccCacheNodesOperationsClient().NewListByEnterpriseMccCustomerResourcePager("rgConnectedCache", "syjjjzk", 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 = armconnectedcache.EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse{ + // EnterpriseMccCacheNodeResourceListResult: armconnectedcache.EnterpriseMccCacheNodeResourceListResult{ + // Value: []*armconnectedcache.EnterpriseMccCacheNodeResource{ + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1/enterpriseMccCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers/enterpriseMccCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("yeinlleavzbehelhsucb"), + // CustomerID: to.Ptr("xjjgcknmsakfawcmwbdufdxktysp"), + // CustomerName: to.Ptr("zsklcocjfjhkcpmzyefzkwamdzc"), + // IPAddress: to.Ptr("gbfkdhloyphnpnhemwrcrxlk"), + // CustomerIndex: to.Ptr("vafvezmelfgmjsrccjukrhppljvipg"), + // CacheNodeID: to.Ptr("fmrjefyddfn"), + // CacheNodeName: to.Ptr("qppvqxliajjfoalzjbgmxggr"), + // CustomerAsn: to.Ptr[int32](25), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](27), + // MaxAllowableProbability: to.Ptr[float32](12), + // XCid: to.Ptr("ooyrhuockukmsrqsevwaaqglhf"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("tvmivvnpisuboggoqgbobugld"), + // ClientTenantID: to.Ptr("iwrpakllacxvtqygpaimlpxvqrjz"), + // Category: to.Ptr("utfjefejkrpxcmrgygzawa"), + // ReleaseVersion: to.Ptr[int32](29), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](4), + // ContainerConfigurations: to.Ptr("dyvefvbvrtsmdrdmiuphzh"), + // CidrCSV: []*string{ + // to.Ptr("kaynxstxqsoreorwh"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpReviewStateText: to.Ptr("khtriksrqrjieouoz"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("bc"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](23), + // BgpNumberOfRecords: to.Ptr[int32](25), + // BgpCidrBlocksCount: to.Ptr[int32](28), + // BgpAddressSpace: to.Ptr[int32](30), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](26), + // CidrSelectionType: to.Ptr[int32](11), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](2), + // ReviewStateText: to.Ptr("xubwhyrdtramrmoldbxqwauyusymqu"), + // ReviewFeedback: to.Ptr("zowuztcnybt"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("okbofqwtzcsju"), + // AddressSpace: to.Ptr[int32](1), + // WorkerConnections: to.Ptr[int32](19), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](23), + // ImageURI: to.Ptr("wkowdrixfxvjmdcsy"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("lgljxmyyoakw"), + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ennbzfpuszgalzpawmwicaofqcwcj"), + // }, + // AggregatedStatusDetails: to.Ptr("nztcstlyjhmllbnrrluhzusmoa"), + // AggregatedStatusText: to.Ptr("ofiedyvzpbijnfghnrrigqaws"), + // AggregatedStatusCode: to.Ptr[int32](25), + // ProductVersion: to.Ptr("hfbuukpxoerpkziym"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("onckp"), + // CacheNodeStateShortText: to.Ptr("yxkwlubqlzhkmemzjzlxksho"), + // CacheNodeState: to.Ptr[int32](30), + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("pcbkezoofhamkycot"), + // SizeInGb: to.Ptr[int32](14), + // CacheNumber: to.Ptr[int32](11), + // NginxMapping: to.Ptr("cirlpkpuxg"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("fjbggfvumrn"), + // }, + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("ihkzxlzvpcywtzrogupqozkdud"), + // OptionalProperty1: to.Ptr("ph"), + // OptionalProperty2: to.Ptr("soqqgpgcbhb"), + // OptionalProperty3: to.Ptr("fpnycrbagptsujiotnjfuhlm"), + // OptionalProperty4: to.Ptr("gesqugrxvhxlxxyvatgrautxwlmxsf"), + // OptionalProperty5: to.Ptr("zknjgzpaqtvdqjydd"), + // }, + // Status: to.Ptr("utgrdjsw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key259": to.Ptr("qbkixjuyjkoj"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCacheNodesOperations_Update_MaximumSet_Gen.json +func ExampleEnterpriseMccCacheNodesOperationsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseMccCacheNodesOperationsClient().Update(ctx, "rgConnectedCache", "qanjqtvrxzjkljdysdjvdiqcxkttskpdzykzuefhbhz", "kllmlvazrcxmfjfozulzqnsgvspgwmhogcafvauchunlgfr", armconnectedcache.PatchResource{ + Tags: map[string]*string{ + "key1653": to.Ptr("nzjczrhclhkndesgy"), + }, + }, 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 = armconnectedcache.EnterpriseMccCacheNodesOperationsClientUpdateResponse{ + // EnterpriseMccCacheNodeResource: &armconnectedcache.EnterpriseMccCacheNodeResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1/enterpriseMccCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers/enterpriseMccCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("yeinlleavzbehelhsucb"), + // CustomerID: to.Ptr("xjjgcknmsakfawcmwbdufdxktysp"), + // CustomerName: to.Ptr("zsklcocjfjhkcpmzyefzkwamdzc"), + // IPAddress: to.Ptr("gbfkdhloyphnpnhemwrcrxlk"), + // CustomerIndex: to.Ptr("vafvezmelfgmjsrccjukrhppljvipg"), + // CacheNodeID: to.Ptr("fmrjefyddfn"), + // CacheNodeName: to.Ptr("qppvqxliajjfoalzjbgmxggr"), + // CustomerAsn: to.Ptr[int32](25), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](27), + // MaxAllowableProbability: to.Ptr[float32](12), + // XCid: to.Ptr("ooyrhuockukmsrqsevwaaqglhf"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("tvmivvnpisuboggoqgbobugld"), + // ClientTenantID: to.Ptr("iwrpakllacxvtqygpaimlpxvqrjz"), + // Category: to.Ptr("utfjefejkrpxcmrgygzawa"), + // ReleaseVersion: to.Ptr[int32](29), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](4), + // ContainerConfigurations: to.Ptr("dyvefvbvrtsmdrdmiuphzh"), + // CidrCSV: []*string{ + // to.Ptr("kaynxstxqsoreorwh"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpReviewStateText: to.Ptr("khtriksrqrjieouoz"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("bc"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](23), + // BgpNumberOfRecords: to.Ptr[int32](25), + // BgpCidrBlocksCount: to.Ptr[int32](28), + // BgpAddressSpace: to.Ptr[int32](30), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](26), + // CidrSelectionType: to.Ptr[int32](11), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](2), + // ReviewStateText: to.Ptr("xubwhyrdtramrmoldbxqwauyusymqu"), + // ReviewFeedback: to.Ptr("zowuztcnybt"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("okbofqwtzcsju"), + // AddressSpace: to.Ptr[int32](1), + // WorkerConnections: to.Ptr[int32](19), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](23), + // ImageURI: to.Ptr("wkowdrixfxvjmdcsy"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("lgljxmyyoakw"), + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ennbzfpuszgalzpawmwicaofqcwcj"), + // }, + // AggregatedStatusDetails: to.Ptr("nztcstlyjhmllbnrrluhzusmoa"), + // AggregatedStatusText: to.Ptr("ofiedyvzpbijnfghnrrigqaws"), + // AggregatedStatusCode: to.Ptr[int32](25), + // ProductVersion: to.Ptr("hfbuukpxoerpkziym"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("onckp"), + // CacheNodeStateShortText: to.Ptr("yxkwlubqlzhkmemzjzlxksho"), + // CacheNodeState: to.Ptr[int32](30), + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("pcbkezoofhamkycot"), + // SizeInGb: to.Ptr[int32](14), + // CacheNumber: to.Ptr[int32](11), + // NginxMapping: to.Ptr("cirlpkpuxg"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("fjbggfvumrn"), + // }, + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("ihkzxlzvpcywtzrogupqozkdud"), + // OptionalProperty1: to.Ptr("ph"), + // OptionalProperty2: to.Ptr("soqqgpgcbhb"), + // OptionalProperty3: to.Ptr("fpnycrbagptsujiotnjfuhlm"), + // OptionalProperty4: to.Ptr("gesqugrxvhxlxxyvatgrautxwlmxsf"), + // OptionalProperty5: to.Ptr("zknjgzpaqtvdqjydd"), + // }, + // Status: to.Ptr("utgrdjsw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // }, + // }, + // Tags: map[string]*string{ + // "key259": to.Ptr("qbkixjuyjkoj"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client.go new file mode 100644 index 000000000000..ec10681f124e --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client.go @@ -0,0 +1,448 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +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" +) + +// EnterpriseMccCustomersClient contains the methods for the EnterpriseMccCustomers group. +// Don't use this type directly, use NewEnterpriseMccCustomersClient() instead. +type EnterpriseMccCustomersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEnterpriseMccCustomersClient creates a new instance of EnterpriseMccCustomersClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEnterpriseMccCustomersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EnterpriseMccCustomersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EnterpriseMccCustomersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - This api creates an enterprise mcc customer with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - resource - Resource create parameters. +// - options - EnterpriseMccCustomersClientBeginCreateOrUpdateOptions contains the optional parameters for the EnterpriseMccCustomersClient.BeginCreateOrUpdate +// method. +func (client *EnterpriseMccCustomersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource EnterpriseMccCustomerResource, options *EnterpriseMccCustomersClientBeginCreateOrUpdateOptions) (*runtime.Poller[EnterpriseMccCustomersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, customerResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EnterpriseMccCustomersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EnterpriseMccCustomersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - This api creates an enterprise mcc customer with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *EnterpriseMccCustomersClient) createOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource EnterpriseMccCustomerResource, options *EnterpriseMccCustomersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EnterpriseMccCustomersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, customerResourceName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *EnterpriseMccCustomersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, resource EnterpriseMccCustomerResource, _ *EnterpriseMccCustomersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - This api deletes an existing enterprise mcc customer resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - EnterpriseMccCustomersClientBeginDeleteOptions contains the optional parameters for the EnterpriseMccCustomersClient.BeginDelete +// method. +func (client *EnterpriseMccCustomersClient) BeginDelete(ctx context.Context, resourceGroupName string, customerResourceName string, options *EnterpriseMccCustomersClientBeginDeleteOptions) (*runtime.Poller[EnterpriseMccCustomersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, customerResourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EnterpriseMccCustomersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EnterpriseMccCustomersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - This api deletes an existing enterprise mcc customer resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *EnterpriseMccCustomersClient) deleteOperation(ctx context.Context, resourceGroupName string, customerResourceName string, options *EnterpriseMccCustomersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "EnterpriseMccCustomersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, customerResourceName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *EnterpriseMccCustomersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *EnterpriseMccCustomersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the enterprise mcc customer resource information using this get call +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - EnterpriseMccCustomersClientGetOptions contains the optional parameters for the EnterpriseMccCustomersClient.Get +// method. +func (client *EnterpriseMccCustomersClient) Get(ctx context.Context, resourceGroupName string, customerResourceName string, options *EnterpriseMccCustomersClientGetOptions) (EnterpriseMccCustomersClientGetResponse, error) { + var err error + const operationName = "EnterpriseMccCustomersClient.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, customerResourceName, options) + if err != nil { + return EnterpriseMccCustomersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseMccCustomersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseMccCustomersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EnterpriseMccCustomersClient) getCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *EnterpriseMccCustomersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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", "2023-05-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 *EnterpriseMccCustomersClient) getHandleResponse(resp *http.Response) (EnterpriseMccCustomersClientGetResponse, error) { + result := EnterpriseMccCustomersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCustomerResource); err != nil { + return EnterpriseMccCustomersClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - This api gets the information about all enterprise mcc customer resources under the given +// subscription and resource group +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - EnterpriseMccCustomersClientListByResourceGroupOptions contains the optional parameters for the EnterpriseMccCustomersClient.NewListByResourceGroupPager +// method. +func (client *EnterpriseMccCustomersClient) NewListByResourceGroupPager(resourceGroupName string, options *EnterpriseMccCustomersClientListByResourceGroupOptions) *runtime.Pager[EnterpriseMccCustomersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[EnterpriseMccCustomersClientListByResourceGroupResponse]{ + More: func(page EnterpriseMccCustomersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EnterpriseMccCustomersClientListByResourceGroupResponse) (EnterpriseMccCustomersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EnterpriseMccCustomersClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return EnterpriseMccCustomersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *EnterpriseMccCustomersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *EnterpriseMccCustomersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers" + 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)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *EnterpriseMccCustomersClient) listByResourceGroupHandleResponse(resp *http.Response) (EnterpriseMccCustomersClientListByResourceGroupResponse, error) { + result := EnterpriseMccCustomersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCustomerResourceListResult); err != nil { + return EnterpriseMccCustomersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - This api gets information about all enterpriseMccCustomer resources under the given subscription +// +// Generated from API version 2023-05-01-preview +// - options - EnterpriseMccCustomersClientListBySubscriptionOptions contains the optional parameters for the EnterpriseMccCustomersClient.NewListBySubscriptionPager +// method. +func (client *EnterpriseMccCustomersClient) NewListBySubscriptionPager(options *EnterpriseMccCustomersClientListBySubscriptionOptions) *runtime.Pager[EnterpriseMccCustomersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[EnterpriseMccCustomersClientListBySubscriptionResponse]{ + More: func(page EnterpriseMccCustomersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EnterpriseMccCustomersClientListBySubscriptionResponse) (EnterpriseMccCustomersClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EnterpriseMccCustomersClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return EnterpriseMccCustomersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *EnterpriseMccCustomersClient) listBySubscriptionCreateRequest(ctx context.Context, _ *EnterpriseMccCustomersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *EnterpriseMccCustomersClient) listBySubscriptionHandleResponse(resp *http.Response) (EnterpriseMccCustomersClientListBySubscriptionResponse, error) { + result := EnterpriseMccCustomersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCustomerResourceListResult); err != nil { + return EnterpriseMccCustomersClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - This api updates an existing enterprise mcc customer resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - properties - The resource properties to be updated. +// - options - EnterpriseMccCustomersClientUpdateOptions contains the optional parameters for the EnterpriseMccCustomersClient.Update +// method. +func (client *EnterpriseMccCustomersClient) Update(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, options *EnterpriseMccCustomersClientUpdateOptions) (EnterpriseMccCustomersClientUpdateResponse, error) { + var err error + const operationName = "EnterpriseMccCustomersClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, customerResourceName, properties, options) + if err != nil { + return EnterpriseMccCustomersClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseMccCustomersClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseMccCustomersClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *EnterpriseMccCustomersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, _ *EnterpriseMccCustomersClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *EnterpriseMccCustomersClient) updateHandleResponse(resp *http.Response) (EnterpriseMccCustomersClientUpdateResponse, error) { + result := EnterpriseMccCustomersClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCustomerResource); err != nil { + return EnterpriseMccCustomersClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client_example_test.go new file mode 100644 index 000000000000..ce3c3099eabc --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client_example_test.go @@ -0,0 +1,609 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "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/connectedcache/armconnectedcache" + "log" + "time" +) + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCustomers_CreateOrUpdate_MaximumSet_Gen.json +func ExampleEnterpriseMccCustomersClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEnterpriseMccCustomersClient().BeginCreateOrUpdate(ctx, "rgConnectedCache", "MccRPTest1", armconnectedcache.EnterpriseMccCustomerResource{ + Properties: &armconnectedcache.CustomerProperty{ + Customer: &armconnectedcache.CustomerEntity{ + FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + ContactEmail: to.Ptr("xquos"), + ContactPhone: to.Ptr("vue"), + ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + IsEntitled: to.Ptr(true), + ReleaseVersion: to.Ptr[int32](20), + ClientTenantID: to.Ptr("fproidkpgvpdnac"), + IsEnterpriseManaged: to.Ptr(true), + ShouldMigrate: to.Ptr(true), + ResendSignupCode: to.Ptr(true), + VerifySignupCode: to.Ptr(true), + VerifySignupPhrase: to.Ptr("tprjvttkgmrqlsyicnidhm"), + }, + AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + CustomerEmail: to.Ptr("zdjgibsidydyzm"), + CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + CustomerEntitlementSKUID: to.Ptr("b"), + CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t }()), + OptionalProperty1: to.Ptr("qhmwxza"), + OptionalProperty2: to.Ptr("l"), + OptionalProperty3: to.Ptr("mblwwvbie"), + OptionalProperty4: to.Ptr("vzuek"), + OptionalProperty5: to.Ptr("fzjodscdfcdr"), + }, + Error: &armconnectedcache.ErrorDetail{}, + }, + Tags: map[string]*string{ + "key3379": to.Ptr("dpyqeaqhcnutzezom"), + }, + Location: to.Ptr("westus"), + }, 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 = armconnectedcache.EnterpriseMccCustomersClientCreateOrUpdateResponse{ + // EnterpriseMccCustomerResource: &armconnectedcache.EnterpriseMccCustomerResource{ + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key3379": to.Ptr("dpyqeaqhcnutzezom"), + // }, + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers"), + // Location: to.Ptr("westus"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCustomers_Delete_MaximumSet_Gen.json +func ExampleEnterpriseMccCustomersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEnterpriseMccCustomersClient().BeginDelete(ctx, "rgConnectedCache", "zktb", 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: 2023-05-01-preview/EnterpriseMccCustomers_Get_MaximumSet_Gen.json +func ExampleEnterpriseMccCustomersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseMccCustomersClient().Get(ctx, "rgConnectedCache", "pvilvqkofbjbykupeewgvzlmjao", 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 = armconnectedcache.EnterpriseMccCustomersClientGetResponse{ + // EnterpriseMccCustomerResource: &armconnectedcache.EnterpriseMccCustomerResource{ + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key3379": to.Ptr("dpyqeaqhcnutzezom"), + // }, + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers"), + // Location: to.Ptr("westus"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCustomers_ListByResourceGroup_MaximumSet_Gen.json +func ExampleEnterpriseMccCustomersClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEnterpriseMccCustomersClient().NewListByResourceGroupPager("rgConnectedCache", 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 = armconnectedcache.EnterpriseMccCustomersClientListByResourceGroupResponse{ + // EnterpriseMccCustomerResourceListResult: armconnectedcache.EnterpriseMccCustomerResourceListResult{ + // Value: []*armconnectedcache.EnterpriseMccCustomerResource{ + // { + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key3379": to.Ptr("dpyqeaqhcnutzezom"), + // }, + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers"), + // Location: to.Ptr("westus"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/ae"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCustomers_ListBySubscription_MaximumSet_Gen.json +func ExampleEnterpriseMccCustomersClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEnterpriseMccCustomersClient().NewListBySubscriptionPager(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 = armconnectedcache.EnterpriseMccCustomersClientListBySubscriptionResponse{ + // EnterpriseMccCustomerResourceListResult: armconnectedcache.EnterpriseMccCustomerResourceListResult{ + // Value: []*armconnectedcache.EnterpriseMccCustomerResource{ + // { + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key3379": to.Ptr("dpyqeaqhcnutzezom"), + // }, + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers"), + // Location: to.Ptr("westus"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/ae"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCustomers_Update_MaximumSet_Gen.json +func ExampleEnterpriseMccCustomersClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseMccCustomersClient().Update(ctx, "rgConnectedCache", "MccRPTest1", armconnectedcache.PatchResource{ + Tags: map[string]*string{ + "key1878": to.Ptr("warz"), + }, + }, 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 = armconnectedcache.EnterpriseMccCustomersClientUpdateResponse{ + // EnterpriseMccCustomerResource: &armconnectedcache.EnterpriseMccCustomerResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // }, + // Tags: map[string]*string{ + // "key3379": to.Ptr("dpyqeaqhcnutzezom"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/cachenodesoperations_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/cachenodesoperations_server.go new file mode 100644 index 000000000000..d85abb59b355 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/cachenodesoperations_server.go @@ -0,0 +1,348 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache" + "net/http" + "net/url" + "regexp" +) + +// CacheNodesOperationsServer is a fake server for instances of the armconnectedcache.CacheNodesOperationsClient type. +type CacheNodesOperationsServer struct { + // BeginCreateorUpdate is the fake for method CacheNodesOperationsClient.BeginCreateorUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateorUpdate func(ctx context.Context, resourceGroupName string, customerResourceName string, resource armconnectedcache.CacheNodePreviewResource, options *armconnectedcache.CacheNodesOperationsClientBeginCreateorUpdateOptions) (resp azfake.PollerResponder[armconnectedcache.CacheNodesOperationsClientCreateorUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method CacheNodesOperationsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.CacheNodesOperationsClientDeleteOptions) (resp azfake.Responder[armconnectedcache.CacheNodesOperationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CacheNodesOperationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.CacheNodesOperationsClientGetOptions) (resp azfake.Responder[armconnectedcache.CacheNodesOperationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method CacheNodesOperationsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armconnectedcache.CacheNodesOperationsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armconnectedcache.CacheNodesOperationsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method CacheNodesOperationsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armconnectedcache.CacheNodesOperationsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armconnectedcache.CacheNodesOperationsClientListBySubscriptionResponse]) + + // Update is the fake for method CacheNodesOperationsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, customerResourceName string, properties armconnectedcache.PatchResource, options *armconnectedcache.CacheNodesOperationsClientUpdateOptions) (resp azfake.Responder[armconnectedcache.CacheNodesOperationsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewCacheNodesOperationsServerTransport creates a new instance of CacheNodesOperationsServerTransport with the provided implementation. +// The returned CacheNodesOperationsServerTransport instance is connected to an instance of armconnectedcache.CacheNodesOperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCacheNodesOperationsServerTransport(srv *CacheNodesOperationsServer) *CacheNodesOperationsServerTransport { + return &CacheNodesOperationsServerTransport{ + srv: srv, + beginCreateorUpdate: newTracker[azfake.PollerResponder[armconnectedcache.CacheNodesOperationsClientCreateorUpdateResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armconnectedcache.CacheNodesOperationsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armconnectedcache.CacheNodesOperationsClientListBySubscriptionResponse]](), + } +} + +// CacheNodesOperationsServerTransport connects instances of armconnectedcache.CacheNodesOperationsClient to instances of CacheNodesOperationsServer. +// Don't use this type directly, use NewCacheNodesOperationsServerTransport instead. +type CacheNodesOperationsServerTransport struct { + srv *CacheNodesOperationsServer + beginCreateorUpdate *tracker[azfake.PollerResponder[armconnectedcache.CacheNodesOperationsClientCreateorUpdateResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armconnectedcache.CacheNodesOperationsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armconnectedcache.CacheNodesOperationsClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for CacheNodesOperationsServerTransport. +func (c *CacheNodesOperationsServerTransport) 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")} + } + + return c.dispatchToMethodFake(req, method) +} + +func (c *CacheNodesOperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if cacheNodesOperationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = cacheNodesOperationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CacheNodesOperationsClient.BeginCreateorUpdate": + res.resp, res.err = c.dispatchBeginCreateorUpdate(req) + case "CacheNodesOperationsClient.Delete": + res.resp, res.err = c.dispatchDelete(req) + case "CacheNodesOperationsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CacheNodesOperationsClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "CacheNodesOperationsClient.NewListBySubscriptionPager": + res.resp, res.err = c.dispatchNewListBySubscriptionPager(req) + case "CacheNodesOperationsClient.Update": + res.resp, res.err = c.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (c *CacheNodesOperationsServerTransport) dispatchBeginCreateorUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateorUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateorUpdate not implemented")} + } + beginCreateorUpdate := c.beginCreateorUpdate.get(req) + if beginCreateorUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/cacheNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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[armconnectedcache.CacheNodePreviewResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateorUpdate(req.Context(), resourceGroupNameParam, customerResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateorUpdate = &respr + c.beginCreateorUpdate.add(req, beginCreateorUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateorUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginCreateorUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateorUpdate) { + c.beginCreateorUpdate.remove(req) + } + + return resp, nil +} + +func (c *CacheNodesOperationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if c.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/cacheNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, customerResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CacheNodesOperationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.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\.ConnectedCache/cacheNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).CacheNodePreviewResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CacheNodesOperationsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/cacheNodes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + 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 + } + resp := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armconnectedcache.CacheNodesOperationsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + c.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (c *CacheNodesOperationsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/cacheNodes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := c.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armconnectedcache.CacheNodesOperationsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + c.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (c *CacheNodesOperationsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if c.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/cacheNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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[armconnectedcache.PatchResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Update(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).CacheNodePreviewResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to CacheNodesOperationsServerTransport +var cacheNodesOperationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisecustomeroperations_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisecustomeroperations_server.go new file mode 100644 index 000000000000..e7955086b130 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisecustomeroperations_server.go @@ -0,0 +1,348 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache" + "net/http" + "net/url" + "regexp" +) + +// EnterpriseCustomerOperationsServer is a fake server for instances of the armconnectedcache.EnterpriseCustomerOperationsClient type. +type EnterpriseCustomerOperationsServer struct { + // BeginCreateOrUpdate is the fake for method EnterpriseCustomerOperationsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, customerResourceName string, resource armconnectedcache.EnterprisePreviewResource, options *armconnectedcache.EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armconnectedcache.EnterpriseCustomerOperationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method EnterpriseCustomerOperationsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.EnterpriseCustomerOperationsClientDeleteOptions) (resp azfake.Responder[armconnectedcache.EnterpriseCustomerOperationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EnterpriseCustomerOperationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.EnterpriseCustomerOperationsClientGetOptions) (resp azfake.Responder[armconnectedcache.EnterpriseCustomerOperationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method EnterpriseCustomerOperationsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armconnectedcache.EnterpriseCustomerOperationsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armconnectedcache.EnterpriseCustomerOperationsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method EnterpriseCustomerOperationsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armconnectedcache.EnterpriseCustomerOperationsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armconnectedcache.EnterpriseCustomerOperationsClientListBySubscriptionResponse]) + + // Update is the fake for method EnterpriseCustomerOperationsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, customerResourceName string, properties armconnectedcache.PatchResource, options *armconnectedcache.EnterpriseCustomerOperationsClientUpdateOptions) (resp azfake.Responder[armconnectedcache.EnterpriseCustomerOperationsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewEnterpriseCustomerOperationsServerTransport creates a new instance of EnterpriseCustomerOperationsServerTransport with the provided implementation. +// The returned EnterpriseCustomerOperationsServerTransport instance is connected to an instance of armconnectedcache.EnterpriseCustomerOperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEnterpriseCustomerOperationsServerTransport(srv *EnterpriseCustomerOperationsServer) *EnterpriseCustomerOperationsServerTransport { + return &EnterpriseCustomerOperationsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armconnectedcache.EnterpriseCustomerOperationsClientCreateOrUpdateResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armconnectedcache.EnterpriseCustomerOperationsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armconnectedcache.EnterpriseCustomerOperationsClientListBySubscriptionResponse]](), + } +} + +// EnterpriseCustomerOperationsServerTransport connects instances of armconnectedcache.EnterpriseCustomerOperationsClient to instances of EnterpriseCustomerOperationsServer. +// Don't use this type directly, use NewEnterpriseCustomerOperationsServerTransport instead. +type EnterpriseCustomerOperationsServerTransport struct { + srv *EnterpriseCustomerOperationsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armconnectedcache.EnterpriseCustomerOperationsClientCreateOrUpdateResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armconnectedcache.EnterpriseCustomerOperationsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armconnectedcache.EnterpriseCustomerOperationsClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for EnterpriseCustomerOperationsServerTransport. +func (e *EnterpriseCustomerOperationsServerTransport) 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")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *EnterpriseCustomerOperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if enterpriseCustomerOperationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = enterpriseCustomerOperationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EnterpriseCustomerOperationsClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "EnterpriseCustomerOperationsClient.Delete": + res.resp, res.err = e.dispatchDelete(req) + case "EnterpriseCustomerOperationsClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EnterpriseCustomerOperationsClient.NewListByResourceGroupPager": + res.resp, res.err = e.dispatchNewListByResourceGroupPager(req) + case "EnterpriseCustomerOperationsClient.NewListBySubscriptionPager": + res.resp, res.err = e.dispatchNewListBySubscriptionPager(req) + case "EnterpriseCustomerOperationsClient.Update": + res.resp, res.err = e.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (e *EnterpriseCustomerOperationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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[armconnectedcache.EnterprisePreviewResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, customerResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EnterpriseCustomerOperationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if e.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Delete(req.Context(), resourceGroupNameParam, customerResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EnterpriseCustomerOperationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.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\.ConnectedCache/enterpriseCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).EnterprisePreviewResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EnterpriseCustomerOperationsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := e.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseCustomers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + 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 + } + resp := e.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + e.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armconnectedcache.EnterpriseCustomerOperationsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + e.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (e *EnterpriseCustomerOperationsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := e.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseCustomers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := e.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + e.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armconnectedcache.EnterpriseCustomerOperationsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + e.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (e *EnterpriseCustomerOperationsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if e.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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[armconnectedcache.PatchResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Update(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).EnterprisePreviewResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to EnterpriseCustomerOperationsServerTransport +var enterpriseCustomerOperationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccachenodesoperations_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccachenodesoperations_server.go new file mode 100644 index 000000000000..d4e726786935 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccachenodesoperations_server.go @@ -0,0 +1,383 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache" + "net/http" + "net/url" + "regexp" +) + +// EnterpriseMccCacheNodesOperationsServer is a fake server for instances of the armconnectedcache.EnterpriseMccCacheNodesOperationsClient type. +type EnterpriseMccCacheNodesOperationsServer struct { + // BeginCreateOrUpdate is the fake for method EnterpriseMccCacheNodesOperationsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource armconnectedcache.EnterpriseMccCacheNodeResource, options *armconnectedcache.EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method EnterpriseMccCacheNodesOperationsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions) (resp azfake.PollerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EnterpriseMccCacheNodesOperationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.EnterpriseMccCacheNodesOperationsClientGetOptions) (resp azfake.Responder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientGetResponse], errResp azfake.ErrorResponder) + + // GetCacheNodeInstallDetails is the fake for method EnterpriseMccCacheNodesOperationsClient.GetCacheNodeInstallDetails + // HTTP status codes to indicate success: http.StatusOK + GetCacheNodeInstallDetails func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions) (resp azfake.Responder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse], errResp azfake.ErrorResponder) + + // NewListByEnterpriseMccCustomerResourcePager is the fake for method EnterpriseMccCacheNodesOperationsClient.NewListByEnterpriseMccCustomerResourcePager + // HTTP status codes to indicate success: http.StatusOK + NewListByEnterpriseMccCustomerResourcePager func(resourceGroupName string, customerResourceName string, options *armconnectedcache.EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceOptions) (resp azfake.PagerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse]) + + // Update is the fake for method EnterpriseMccCacheNodesOperationsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, properties armconnectedcache.PatchResource, options *armconnectedcache.EnterpriseMccCacheNodesOperationsClientUpdateOptions) (resp azfake.Responder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewEnterpriseMccCacheNodesOperationsServerTransport creates a new instance of EnterpriseMccCacheNodesOperationsServerTransport with the provided implementation. +// The returned EnterpriseMccCacheNodesOperationsServerTransport instance is connected to an instance of armconnectedcache.EnterpriseMccCacheNodesOperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEnterpriseMccCacheNodesOperationsServerTransport(srv *EnterpriseMccCacheNodesOperationsServer) *EnterpriseMccCacheNodesOperationsServerTransport { + return &EnterpriseMccCacheNodesOperationsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientDeleteResponse]](), + newListByEnterpriseMccCustomerResourcePager: newTracker[azfake.PagerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse]](), + } +} + +// EnterpriseMccCacheNodesOperationsServerTransport connects instances of armconnectedcache.EnterpriseMccCacheNodesOperationsClient to instances of EnterpriseMccCacheNodesOperationsServer. +// Don't use this type directly, use NewEnterpriseMccCacheNodesOperationsServerTransport instead. +type EnterpriseMccCacheNodesOperationsServerTransport struct { + srv *EnterpriseMccCacheNodesOperationsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientDeleteResponse]] + newListByEnterpriseMccCustomerResourcePager *tracker[azfake.PagerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse]] +} + +// Do implements the policy.Transporter interface for EnterpriseMccCacheNodesOperationsServerTransport. +func (e *EnterpriseMccCacheNodesOperationsServerTransport) 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")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if enterpriseMccCacheNodesOperationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = enterpriseMccCacheNodesOperationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EnterpriseMccCacheNodesOperationsClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "EnterpriseMccCacheNodesOperationsClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "EnterpriseMccCacheNodesOperationsClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EnterpriseMccCacheNodesOperationsClient.GetCacheNodeInstallDetails": + res.resp, res.err = e.dispatchGetCacheNodeInstallDetails(req) + case "EnterpriseMccCacheNodesOperationsClient.NewListByEnterpriseMccCustomerResourcePager": + res.resp, res.err = e.dispatchNewListByEnterpriseMccCustomerResourcePager(req) + case "EnterpriseMccCacheNodesOperationsClient.Update": + res.resp, res.err = e.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/enterpriseMccCacheNodes/(?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[armconnectedcache.EnterpriseMccCacheNodeResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/enterpriseMccCacheNodes/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + e.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.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\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/enterpriseMccCacheNodes/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).EnterpriseMccCacheNodeResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchGetCacheNodeInstallDetails(req *http.Request) (*http.Response, error) { + if e.srv.GetCacheNodeInstallDetails == nil { + return nil, &nonRetriableError{errors.New("fake for method GetCacheNodeInstallDetails not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/enterpriseMccCacheNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getCacheNodeInstallDetails` + 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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.GetCacheNodeInstallDetails(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).MccCacheNodeInstallDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchNewListByEnterpriseMccCustomerResourcePager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByEnterpriseMccCustomerResourcePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByEnterpriseMccCustomerResourcePager not implemented")} + } + newListByEnterpriseMccCustomerResourcePager := e.newListByEnterpriseMccCustomerResourcePager.get(req) + if newListByEnterpriseMccCustomerResourcePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/enterpriseMccCacheNodes` + 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) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + resp := e.srv.NewListByEnterpriseMccCustomerResourcePager(resourceGroupNameParam, customerResourceNameParam, nil) + newListByEnterpriseMccCustomerResourcePager = &resp + e.newListByEnterpriseMccCustomerResourcePager.add(req, newListByEnterpriseMccCustomerResourcePager) + server.PagerResponderInjectNextLinks(newListByEnterpriseMccCustomerResourcePager, req, func(page *armconnectedcache.EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByEnterpriseMccCustomerResourcePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByEnterpriseMccCustomerResourcePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByEnterpriseMccCustomerResourcePager) { + e.newListByEnterpriseMccCustomerResourcePager.remove(req) + } + return resp, nil +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if e.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/enterpriseMccCacheNodes/(?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[armconnectedcache.PatchResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Update(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).EnterpriseMccCacheNodeResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to EnterpriseMccCacheNodesOperationsServerTransport +var enterpriseMccCacheNodesOperationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccustomers_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccustomers_server.go new file mode 100644 index 000000000000..ca8d452a5a75 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccustomers_server.go @@ -0,0 +1,361 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache" + "net/http" + "net/url" + "regexp" +) + +// EnterpriseMccCustomersServer is a fake server for instances of the armconnectedcache.EnterpriseMccCustomersClient type. +type EnterpriseMccCustomersServer struct { + // BeginCreateOrUpdate is the fake for method EnterpriseMccCustomersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, customerResourceName string, resource armconnectedcache.EnterpriseMccCustomerResource, options *armconnectedcache.EnterpriseMccCustomersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armconnectedcache.EnterpriseMccCustomersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method EnterpriseMccCustomersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.EnterpriseMccCustomersClientBeginDeleteOptions) (resp azfake.PollerResponder[armconnectedcache.EnterpriseMccCustomersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EnterpriseMccCustomersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.EnterpriseMccCustomersClientGetOptions) (resp azfake.Responder[armconnectedcache.EnterpriseMccCustomersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method EnterpriseMccCustomersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armconnectedcache.EnterpriseMccCustomersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armconnectedcache.EnterpriseMccCustomersClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method EnterpriseMccCustomersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armconnectedcache.EnterpriseMccCustomersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armconnectedcache.EnterpriseMccCustomersClientListBySubscriptionResponse]) + + // Update is the fake for method EnterpriseMccCustomersClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, customerResourceName string, properties armconnectedcache.PatchResource, options *armconnectedcache.EnterpriseMccCustomersClientUpdateOptions) (resp azfake.Responder[armconnectedcache.EnterpriseMccCustomersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewEnterpriseMccCustomersServerTransport creates a new instance of EnterpriseMccCustomersServerTransport with the provided implementation. +// The returned EnterpriseMccCustomersServerTransport instance is connected to an instance of armconnectedcache.EnterpriseMccCustomersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEnterpriseMccCustomersServerTransport(srv *EnterpriseMccCustomersServer) *EnterpriseMccCustomersServerTransport { + return &EnterpriseMccCustomersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCustomersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCustomersClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armconnectedcache.EnterpriseMccCustomersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armconnectedcache.EnterpriseMccCustomersClientListBySubscriptionResponse]](), + } +} + +// EnterpriseMccCustomersServerTransport connects instances of armconnectedcache.EnterpriseMccCustomersClient to instances of EnterpriseMccCustomersServer. +// Don't use this type directly, use NewEnterpriseMccCustomersServerTransport instead. +type EnterpriseMccCustomersServerTransport struct { + srv *EnterpriseMccCustomersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCustomersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCustomersClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armconnectedcache.EnterpriseMccCustomersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armconnectedcache.EnterpriseMccCustomersClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for EnterpriseMccCustomersServerTransport. +func (e *EnterpriseMccCustomersServerTransport) 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")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if enterpriseMccCustomersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = enterpriseMccCustomersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EnterpriseMccCustomersClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "EnterpriseMccCustomersClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "EnterpriseMccCustomersClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EnterpriseMccCustomersClient.NewListByResourceGroupPager": + res.resp, res.err = e.dispatchNewListByResourceGroupPager(req) + case "EnterpriseMccCustomersClient.NewListBySubscriptionPager": + res.resp, res.err = e.dispatchNewListBySubscriptionPager(req) + case "EnterpriseMccCustomersClient.Update": + res.resp, res.err = e.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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[armconnectedcache.EnterpriseMccCustomerResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, customerResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, customerResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + e.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.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\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).EnterpriseMccCustomerResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := e.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + 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 + } + resp := e.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + e.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armconnectedcache.EnterpriseMccCustomersClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + e.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := e.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := e.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + e.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armconnectedcache.EnterpriseMccCustomersClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + e.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if e.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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[armconnectedcache.PatchResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Update(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).EnterpriseMccCustomerResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to EnterpriseMccCustomersServerTransport +var enterpriseMccCustomersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/internal.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/internal.go @@ -0,0 +1,65 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcachenodesoperations_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcachenodesoperations_server.go new file mode 100644 index 000000000000..61d62032ad5d --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcachenodesoperations_server.go @@ -0,0 +1,426 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache" + "net/http" + "net/url" + "regexp" +) + +// IspCacheNodesOperationsServer is a fake server for instances of the armconnectedcache.IspCacheNodesOperationsClient type. +type IspCacheNodesOperationsServer struct { + // BeginCreateOrUpdate is the fake for method IspCacheNodesOperationsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource armconnectedcache.IspCacheNodeResource, options *armconnectedcache.IspCacheNodesOperationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armconnectedcache.IspCacheNodesOperationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method IspCacheNodesOperationsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.IspCacheNodesOperationsClientBeginDeleteOptions) (resp azfake.PollerResponder[armconnectedcache.IspCacheNodesOperationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method IspCacheNodesOperationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.IspCacheNodesOperationsClientGetOptions) (resp azfake.Responder[armconnectedcache.IspCacheNodesOperationsClientGetResponse], errResp azfake.ErrorResponder) + + // GetBgpCidrs is the fake for method IspCacheNodesOperationsClient.GetBgpCidrs + // HTTP status codes to indicate success: http.StatusOK + GetBgpCidrs func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.IspCacheNodesOperationsClientGetBgpCidrsOptions) (resp azfake.Responder[armconnectedcache.IspCacheNodesOperationsClientGetBgpCidrsResponse], errResp azfake.ErrorResponder) + + // GetCacheNodeInstallDetails is the fake for method IspCacheNodesOperationsClient.GetCacheNodeInstallDetails + // HTTP status codes to indicate success: http.StatusOK + GetCacheNodeInstallDetails func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.IspCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions) (resp azfake.Responder[armconnectedcache.IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse], errResp azfake.ErrorResponder) + + // NewListByIspCustomerResourcePager is the fake for method IspCacheNodesOperationsClient.NewListByIspCustomerResourcePager + // HTTP status codes to indicate success: http.StatusOK + NewListByIspCustomerResourcePager func(resourceGroupName string, customerResourceName string, options *armconnectedcache.IspCacheNodesOperationsClientListByIspCustomerResourceOptions) (resp azfake.PagerResponder[armconnectedcache.IspCacheNodesOperationsClientListByIspCustomerResourceResponse]) + + // Update is the fake for method IspCacheNodesOperationsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, properties armconnectedcache.PatchResource, options *armconnectedcache.IspCacheNodesOperationsClientUpdateOptions) (resp azfake.Responder[armconnectedcache.IspCacheNodesOperationsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewIspCacheNodesOperationsServerTransport creates a new instance of IspCacheNodesOperationsServerTransport with the provided implementation. +// The returned IspCacheNodesOperationsServerTransport instance is connected to an instance of armconnectedcache.IspCacheNodesOperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewIspCacheNodesOperationsServerTransport(srv *IspCacheNodesOperationsServer) *IspCacheNodesOperationsServerTransport { + return &IspCacheNodesOperationsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armconnectedcache.IspCacheNodesOperationsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armconnectedcache.IspCacheNodesOperationsClientDeleteResponse]](), + newListByIspCustomerResourcePager: newTracker[azfake.PagerResponder[armconnectedcache.IspCacheNodesOperationsClientListByIspCustomerResourceResponse]](), + } +} + +// IspCacheNodesOperationsServerTransport connects instances of armconnectedcache.IspCacheNodesOperationsClient to instances of IspCacheNodesOperationsServer. +// Don't use this type directly, use NewIspCacheNodesOperationsServerTransport instead. +type IspCacheNodesOperationsServerTransport struct { + srv *IspCacheNodesOperationsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armconnectedcache.IspCacheNodesOperationsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armconnectedcache.IspCacheNodesOperationsClientDeleteResponse]] + newListByIspCustomerResourcePager *tracker[azfake.PagerResponder[armconnectedcache.IspCacheNodesOperationsClientListByIspCustomerResourceResponse]] +} + +// Do implements the policy.Transporter interface for IspCacheNodesOperationsServerTransport. +func (i *IspCacheNodesOperationsServerTransport) 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")} + } + + return i.dispatchToMethodFake(req, method) +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if ispCacheNodesOperationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = ispCacheNodesOperationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "IspCacheNodesOperationsClient.BeginCreateOrUpdate": + res.resp, res.err = i.dispatchBeginCreateOrUpdate(req) + case "IspCacheNodesOperationsClient.BeginDelete": + res.resp, res.err = i.dispatchBeginDelete(req) + case "IspCacheNodesOperationsClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "IspCacheNodesOperationsClient.GetBgpCidrs": + res.resp, res.err = i.dispatchGetBgpCidrs(req) + case "IspCacheNodesOperationsClient.GetCacheNodeInstallDetails": + res.resp, res.err = i.dispatchGetCacheNodeInstallDetails(req) + case "IspCacheNodesOperationsClient.NewListByIspCustomerResourcePager": + res.resp, res.err = i.dispatchNewListByIspCustomerResourcePager(req) + case "IspCacheNodesOperationsClient.Update": + res.resp, res.err = i.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if i.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := i.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes/(?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[armconnectedcache.IspCacheNodeResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + i.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + i.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + i.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if i.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := i.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.BeginDelete(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + i.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + i.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + i.beginDelete.remove(req) + } + + return resp, nil +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if i.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\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).IspCacheNodeResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchGetBgpCidrs(req *http.Request) (*http.Response, error) { + if i.srv.GetBgpCidrs == nil { + return nil, &nonRetriableError{errors.New("fake for method GetBgpCidrs not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getBgpCidrs` + 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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.GetBgpCidrs(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).MccCacheNodeBgpCidrDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchGetCacheNodeInstallDetails(req *http.Request) (*http.Response, error) { + if i.srv.GetCacheNodeInstallDetails == nil { + return nil, &nonRetriableError{errors.New("fake for method GetCacheNodeInstallDetails not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getCacheNodeInstallDetails` + 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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.GetCacheNodeInstallDetails(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).MccCacheNodeInstallDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchNewListByIspCustomerResourcePager(req *http.Request) (*http.Response, error) { + if i.srv.NewListByIspCustomerResourcePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByIspCustomerResourcePager not implemented")} + } + newListByIspCustomerResourcePager := i.newListByIspCustomerResourcePager.get(req) + if newListByIspCustomerResourcePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes` + 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) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListByIspCustomerResourcePager(resourceGroupNameParam, customerResourceNameParam, nil) + newListByIspCustomerResourcePager = &resp + i.newListByIspCustomerResourcePager.add(req, newListByIspCustomerResourcePager) + server.PagerResponderInjectNextLinks(newListByIspCustomerResourcePager, req, func(page *armconnectedcache.IspCacheNodesOperationsClientListByIspCustomerResourceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByIspCustomerResourcePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListByIspCustomerResourcePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByIspCustomerResourcePager) { + i.newListByIspCustomerResourcePager.remove(req) + } + return resp, nil +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if i.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes/(?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[armconnectedcache.PatchResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Update(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).IspCacheNodeResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to IspCacheNodesOperationsServerTransport +var ispCacheNodesOperationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcustomers_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcustomers_server.go new file mode 100644 index 000000000000..1fb980a4bd60 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcustomers_server.go @@ -0,0 +1,361 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache" + "net/http" + "net/url" + "regexp" +) + +// IspCustomersServer is a fake server for instances of the armconnectedcache.IspCustomersClient type. +type IspCustomersServer struct { + // BeginCreateOrUpdate is the fake for method IspCustomersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, customerResourceName string, resource armconnectedcache.IspCustomerResource, options *armconnectedcache.IspCustomersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armconnectedcache.IspCustomersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method IspCustomersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.IspCustomersClientBeginDeleteOptions) (resp azfake.PollerResponder[armconnectedcache.IspCustomersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method IspCustomersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.IspCustomersClientGetOptions) (resp azfake.Responder[armconnectedcache.IspCustomersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method IspCustomersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armconnectedcache.IspCustomersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armconnectedcache.IspCustomersClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method IspCustomersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armconnectedcache.IspCustomersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armconnectedcache.IspCustomersClientListBySubscriptionResponse]) + + // Update is the fake for method IspCustomersClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, customerResourceName string, properties armconnectedcache.PatchResource, options *armconnectedcache.IspCustomersClientUpdateOptions) (resp azfake.Responder[armconnectedcache.IspCustomersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewIspCustomersServerTransport creates a new instance of IspCustomersServerTransport with the provided implementation. +// The returned IspCustomersServerTransport instance is connected to an instance of armconnectedcache.IspCustomersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewIspCustomersServerTransport(srv *IspCustomersServer) *IspCustomersServerTransport { + return &IspCustomersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armconnectedcache.IspCustomersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armconnectedcache.IspCustomersClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armconnectedcache.IspCustomersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armconnectedcache.IspCustomersClientListBySubscriptionResponse]](), + } +} + +// IspCustomersServerTransport connects instances of armconnectedcache.IspCustomersClient to instances of IspCustomersServer. +// Don't use this type directly, use NewIspCustomersServerTransport instead. +type IspCustomersServerTransport struct { + srv *IspCustomersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armconnectedcache.IspCustomersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armconnectedcache.IspCustomersClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armconnectedcache.IspCustomersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armconnectedcache.IspCustomersClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for IspCustomersServerTransport. +func (i *IspCustomersServerTransport) 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")} + } + + return i.dispatchToMethodFake(req, method) +} + +func (i *IspCustomersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if ispCustomersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = ispCustomersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "IspCustomersClient.BeginCreateOrUpdate": + res.resp, res.err = i.dispatchBeginCreateOrUpdate(req) + case "IspCustomersClient.BeginDelete": + res.resp, res.err = i.dispatchBeginDelete(req) + case "IspCustomersClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "IspCustomersClient.NewListByResourceGroupPager": + res.resp, res.err = i.dispatchNewListByResourceGroupPager(req) + case "IspCustomersClient.NewListBySubscriptionPager": + res.resp, res.err = i.dispatchNewListBySubscriptionPager(req) + case "IspCustomersClient.Update": + res.resp, res.err = i.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (i *IspCustomersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if i.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := i.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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[armconnectedcache.IspCustomerResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, customerResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + i.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + i.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + i.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (i *IspCustomersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if i.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := i.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.BeginDelete(req.Context(), resourceGroupNameParam, customerResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + i.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + i.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + i.beginDelete.remove(req) + } + + return resp, nil +} + +func (i *IspCustomersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if i.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\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).IspCustomerResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *IspCustomersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if i.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := i.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + 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 + } + resp := i.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + i.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armconnectedcache.IspCustomersClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + i.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (i *IspCustomersServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if i.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := i.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := i.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + i.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armconnectedcache.IspCustomersClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + i.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (i *IspCustomersServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if i.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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[armconnectedcache.PatchResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Update(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).IspCustomerResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to IspCustomersServerTransport +var ispCustomersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/operations_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/operations_server.go new file mode 100644 index 000000000000..10197cea6d92 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/operations_server.go @@ -0,0 +1,117 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "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/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache" + "net/http" +) + +// OperationsServer is a fake server for instances of the armconnectedcache.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armconnectedcache.OperationsClientListOptions) (resp azfake.PagerResponder[armconnectedcache.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armconnectedcache.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armconnectedcache.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armconnectedcache.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armconnectedcache.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) 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")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armconnectedcache.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/server_factory.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/server_factory.go new file mode 100644 index 000000000000..5e9b7929d6fe --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/server_factory.go @@ -0,0 +1,124 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armconnectedcache.ClientFactory type. +type ServerFactory struct { + // CacheNodesOperationsServer contains the fakes for client CacheNodesOperationsClient + CacheNodesOperationsServer CacheNodesOperationsServer + + // EnterpriseCustomerOperationsServer contains the fakes for client EnterpriseCustomerOperationsClient + EnterpriseCustomerOperationsServer EnterpriseCustomerOperationsServer + + // EnterpriseMccCacheNodesOperationsServer contains the fakes for client EnterpriseMccCacheNodesOperationsClient + EnterpriseMccCacheNodesOperationsServer EnterpriseMccCacheNodesOperationsServer + + // EnterpriseMccCustomersServer contains the fakes for client EnterpriseMccCustomersClient + EnterpriseMccCustomersServer EnterpriseMccCustomersServer + + // IspCacheNodesOperationsServer contains the fakes for client IspCacheNodesOperationsClient + IspCacheNodesOperationsServer IspCacheNodesOperationsServer + + // IspCustomersServer contains the fakes for client IspCustomersClient + IspCustomersServer IspCustomersServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armconnectedcache.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armconnectedcache.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trCacheNodesOperationsServer *CacheNodesOperationsServerTransport + trEnterpriseCustomerOperationsServer *EnterpriseCustomerOperationsServerTransport + trEnterpriseMccCacheNodesOperationsServer *EnterpriseMccCacheNodesOperationsServerTransport + trEnterpriseMccCustomersServer *EnterpriseMccCustomersServerTransport + trIspCacheNodesOperationsServer *IspCacheNodesOperationsServerTransport + trIspCustomersServer *IspCustomersServerTransport + trOperationsServer *OperationsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) 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")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "CacheNodesOperationsClient": + initServer(s, &s.trCacheNodesOperationsServer, func() *CacheNodesOperationsServerTransport { + return NewCacheNodesOperationsServerTransport(&s.srv.CacheNodesOperationsServer) + }) + resp, err = s.trCacheNodesOperationsServer.Do(req) + case "EnterpriseCustomerOperationsClient": + initServer(s, &s.trEnterpriseCustomerOperationsServer, func() *EnterpriseCustomerOperationsServerTransport { + return NewEnterpriseCustomerOperationsServerTransport(&s.srv.EnterpriseCustomerOperationsServer) + }) + resp, err = s.trEnterpriseCustomerOperationsServer.Do(req) + case "EnterpriseMccCacheNodesOperationsClient": + initServer(s, &s.trEnterpriseMccCacheNodesOperationsServer, func() *EnterpriseMccCacheNodesOperationsServerTransport { + return NewEnterpriseMccCacheNodesOperationsServerTransport(&s.srv.EnterpriseMccCacheNodesOperationsServer) + }) + resp, err = s.trEnterpriseMccCacheNodesOperationsServer.Do(req) + case "EnterpriseMccCustomersClient": + initServer(s, &s.trEnterpriseMccCustomersServer, func() *EnterpriseMccCustomersServerTransport { + return NewEnterpriseMccCustomersServerTransport(&s.srv.EnterpriseMccCustomersServer) + }) + resp, err = s.trEnterpriseMccCustomersServer.Do(req) + case "IspCacheNodesOperationsClient": + initServer(s, &s.trIspCacheNodesOperationsServer, func() *IspCacheNodesOperationsServerTransport { + return NewIspCacheNodesOperationsServerTransport(&s.srv.IspCacheNodesOperationsServer) + }) + resp, err = s.trIspCacheNodesOperationsServer.Do(req) + case "IspCustomersClient": + initServer(s, &s.trIspCustomersServer, func() *IspCustomersServerTransport { return NewIspCustomersServerTransport(&s.srv.IspCustomersServer) }) + resp, err = s.trIspCustomersServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/time_rfc3339.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/time_rfc3339.go new file mode 100644 index 000000000000..87ee11e83b32 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// 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+)*"*$`) + +const ( + 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 + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + 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 { + if len(data) == 0 { + return nil + } + 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)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + 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 + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/go.mod b/sdk/resourcemanager/connectedcache/armconnectedcache/go.mod new file mode 100644 index 000000000000..07717e7039ae --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect +) diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/go.sum b/sdk/resourcemanager/connectedcache/armconnectedcache/go.sum new file mode 100644 index 000000000000..cbddbbd9ecec --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client.go new file mode 100644 index 000000000000..114294da874f --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client.go @@ -0,0 +1,558 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +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" +) + +// IspCacheNodesOperationsClient contains the methods for the IspCacheNodesOperations group. +// Don't use this type directly, use NewIspCacheNodesOperationsClient() instead. +type IspCacheNodesOperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewIspCacheNodesOperationsClient creates a new instance of IspCacheNodesOperationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewIspCacheNodesOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IspCacheNodesOperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &IspCacheNodesOperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - This api creates an ispCacheNode with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - resource - Resource create parameters. +// - options - IspCacheNodesOperationsClientBeginCreateOrUpdateOptions contains the optional parameters for the IspCacheNodesOperationsClient.BeginCreateOrUpdate +// method. +func (client *IspCacheNodesOperationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource IspCacheNodeResource, options *IspCacheNodesOperationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[IspCacheNodesOperationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IspCacheNodesOperationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[IspCacheNodesOperationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - This api creates an ispCacheNode with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *IspCacheNodesOperationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource IspCacheNodeResource, options *IspCacheNodesOperationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "IspCacheNodesOperationsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *IspCacheNodesOperationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource IspCacheNodeResource, _ *IspCacheNodesOperationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - This api deletes an existing ispCacheNode resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - IspCacheNodesOperationsClientBeginDeleteOptions contains the optional parameters for the IspCacheNodesOperationsClient.BeginDelete +// method. +func (client *IspCacheNodesOperationsClient) BeginDelete(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *IspCacheNodesOperationsClientBeginDeleteOptions) (*runtime.Poller[IspCacheNodesOperationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IspCacheNodesOperationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[IspCacheNodesOperationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - This api deletes an existing ispCacheNode resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *IspCacheNodesOperationsClient) deleteOperation(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *IspCacheNodesOperationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "IspCacheNodesOperationsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *IspCacheNodesOperationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *IspCacheNodesOperationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - This api gets ispCacheNode resource information +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - IspCacheNodesOperationsClientGetOptions contains the optional parameters for the IspCacheNodesOperationsClient.Get +// method. +func (client *IspCacheNodesOperationsClient) Get(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *IspCacheNodesOperationsClientGetOptions) (IspCacheNodesOperationsClientGetResponse, error) { + var err error + const operationName = "IspCacheNodesOperationsClient.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, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return IspCacheNodesOperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IspCacheNodesOperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IspCacheNodesOperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *IspCacheNodesOperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *IspCacheNodesOperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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", "2023-05-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 *IspCacheNodesOperationsClient) getHandleResponse(resp *http.Response) (IspCacheNodesOperationsClientGetResponse, error) { + result := IspCacheNodesOperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCacheNodeResource); err != nil { + return IspCacheNodesOperationsClientGetResponse{}, err + } + return result, nil +} + +// GetBgpCidrs - This api gets ispCacheNode resource information +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - IspCacheNodesOperationsClientGetBgpCidrsOptions contains the optional parameters for the IspCacheNodesOperationsClient.GetBgpCidrs +// method. +func (client *IspCacheNodesOperationsClient) GetBgpCidrs(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *IspCacheNodesOperationsClientGetBgpCidrsOptions) (IspCacheNodesOperationsClientGetBgpCidrsResponse, error) { + var err error + const operationName = "IspCacheNodesOperationsClient.GetBgpCidrs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getBgpCidrsCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return IspCacheNodesOperationsClientGetBgpCidrsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IspCacheNodesOperationsClientGetBgpCidrsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IspCacheNodesOperationsClientGetBgpCidrsResponse{}, err + } + resp, err := client.getBgpCidrsHandleResponse(httpResp) + return resp, err +} + +// getBgpCidrsCreateRequest creates the GetBgpCidrs request. +func (client *IspCacheNodesOperationsClient) getBgpCidrsCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *IspCacheNodesOperationsClientGetBgpCidrsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes/{cacheNodeResourceName}/getBgpCidrs" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getBgpCidrsHandleResponse handles the GetBgpCidrs response. +func (client *IspCacheNodesOperationsClient) getBgpCidrsHandleResponse(resp *http.Response) (IspCacheNodesOperationsClientGetBgpCidrsResponse, error) { + result := IspCacheNodesOperationsClientGetBgpCidrsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MccCacheNodeBgpCidrDetails); err != nil { + return IspCacheNodesOperationsClientGetBgpCidrsResponse{}, err + } + return result, nil +} + +// GetCacheNodeInstallDetails - This api gets secrets of the ispCacheNode resource install details +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - IspCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions contains the optional parameters for the IspCacheNodesOperationsClient.GetCacheNodeInstallDetails +// method. +func (client *IspCacheNodesOperationsClient) GetCacheNodeInstallDetails(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *IspCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions) (IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse, error) { + var err error + const operationName = "IspCacheNodesOperationsClient.GetCacheNodeInstallDetails" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCacheNodeInstallDetailsCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + resp, err := client.getCacheNodeInstallDetailsHandleResponse(httpResp) + return resp, err +} + +// getCacheNodeInstallDetailsCreateRequest creates the GetCacheNodeInstallDetails request. +func (client *IspCacheNodesOperationsClient) getCacheNodeInstallDetailsCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *IspCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes/{cacheNodeResourceName}/getCacheNodeInstallDetails" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCacheNodeInstallDetailsHandleResponse handles the GetCacheNodeInstallDetails response. +func (client *IspCacheNodesOperationsClient) getCacheNodeInstallDetailsHandleResponse(resp *http.Response) (IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse, error) { + result := IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MccCacheNodeInstallDetails); err != nil { + return IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + return result, nil +} + +// NewListByIspCustomerResourcePager - This api retrieves information about all ispCacheNode resources under the given subscription +// and resource group +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - IspCacheNodesOperationsClientListByIspCustomerResourceOptions contains the optional parameters for the IspCacheNodesOperationsClient.NewListByIspCustomerResourcePager +// method. +func (client *IspCacheNodesOperationsClient) NewListByIspCustomerResourcePager(resourceGroupName string, customerResourceName string, options *IspCacheNodesOperationsClientListByIspCustomerResourceOptions) *runtime.Pager[IspCacheNodesOperationsClientListByIspCustomerResourceResponse] { + return runtime.NewPager(runtime.PagingHandler[IspCacheNodesOperationsClientListByIspCustomerResourceResponse]{ + More: func(page IspCacheNodesOperationsClientListByIspCustomerResourceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IspCacheNodesOperationsClientListByIspCustomerResourceResponse) (IspCacheNodesOperationsClientListByIspCustomerResourceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IspCacheNodesOperationsClient.NewListByIspCustomerResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByIspCustomerResourceCreateRequest(ctx, resourceGroupName, customerResourceName, options) + }, nil) + if err != nil { + return IspCacheNodesOperationsClientListByIspCustomerResourceResponse{}, err + } + return client.listByIspCustomerResourceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByIspCustomerResourceCreateRequest creates the ListByIspCustomerResource request. +func (client *IspCacheNodesOperationsClient) listByIspCustomerResourceCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *IspCacheNodesOperationsClientListByIspCustomerResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByIspCustomerResourceHandleResponse handles the ListByIspCustomerResource response. +func (client *IspCacheNodesOperationsClient) listByIspCustomerResourceHandleResponse(resp *http.Response) (IspCacheNodesOperationsClientListByIspCustomerResourceResponse, error) { + result := IspCacheNodesOperationsClientListByIspCustomerResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCacheNodeResourceListResult); err != nil { + return IspCacheNodesOperationsClientListByIspCustomerResourceResponse{}, err + } + return result, nil +} + +// Update - This api updates an existing ispCacheNode resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - properties - The resource properties to be updated. +// - options - IspCacheNodesOperationsClientUpdateOptions contains the optional parameters for the IspCacheNodesOperationsClient.Update +// method. +func (client *IspCacheNodesOperationsClient) Update(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, properties PatchResource, options *IspCacheNodesOperationsClientUpdateOptions) (IspCacheNodesOperationsClientUpdateResponse, error) { + var err error + const operationName = "IspCacheNodesOperationsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, properties, options) + if err != nil { + return IspCacheNodesOperationsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IspCacheNodesOperationsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IspCacheNodesOperationsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *IspCacheNodesOperationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, properties PatchResource, _ *IspCacheNodesOperationsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *IspCacheNodesOperationsClient) updateHandleResponse(resp *http.Response) (IspCacheNodesOperationsClientUpdateResponse, error) { + result := IspCacheNodesOperationsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCacheNodeResource); err != nil { + return IspCacheNodesOperationsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client_example_test.go new file mode 100644 index 000000000000..cd071f82888d --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client_example_test.go @@ -0,0 +1,724 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "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/connectedcache/armconnectedcache" + "log" +) + +// Generated from example definition: 2023-05-01-preview/IspCacheNodesOperations_CreateOrUpdate_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewIspCacheNodesOperationsClient().BeginCreateOrUpdate(ctx, "rgConnectedCache", "zpqzbmanlljgmkrthtydrtneavhlnlqkdmviq", "cabakm", armconnectedcache.IspCacheNodeResource{ + Location: to.Ptr("westus"), + Properties: &armconnectedcache.CacheNodeProperty{ + CacheNode: &armconnectedcache.CacheNodeEntity{ + FullyQualifiedResourceID: to.Ptr("hskxkpbiqbrbjiwdzrxndru"), + CustomerName: to.Ptr("xwyqk"), + IPAddress: to.Ptr("voctagljcwqgcpnionqdcbjk"), + CustomerIndex: to.Ptr("qtoiglqaswivmkjhzogburcxtszmek"), + CacheNodeID: to.Ptr("xjzffjftwcgsehanoxsl"), + CacheNodeName: to.Ptr("mfjxb"), + CustomerAsn: to.Ptr[int32](4), + IsEnabled: to.Ptr(true), + MaxAllowableEgressInMbps: to.Ptr[int32](29), + IsEnterpriseManaged: to.Ptr(true), + CidrCSV: []*string{ + to.Ptr("nlqlvrthafvvljuupcbcw"), + }, + ShouldMigrate: to.Ptr(true), + CidrSelectionType: to.Ptr[int32](4), + }, + AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + { + PhysicalPath: to.Ptr("/mcc"), + SizeInGb: to.Ptr[int32](500), + CacheNumber: to.Ptr[int32](1), + NginxMapping: to.Ptr("lijygenjq"), + }, + }, + BgpConfiguration: &armconnectedcache.BgpConfiguration{ + AsnToIPAddressMapping: to.Ptr("pafcimhoog"), + }, + CacheNodePropertiesDetailsIssuesList: []*string{ + to.Ptr("ex"), + }, + ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + ProxyURL: to.Ptr("hplstyg"), + }, + ProxyURL: to.Ptr("qhux"), + OptionalProperty1: to.Ptr("hvpmt"), + OptionalProperty2: to.Ptr("talanelmsgxvksrzoeeontqkjzbpv"), + OptionalProperty3: to.Ptr("bxkoxq"), + OptionalProperty4: to.Ptr("pqlkcekupusoc"), + OptionalProperty5: to.Ptr("nyvvmrjigqdufzjdvazdca"), + }, + StatusCode: to.Ptr("1"), + StatusText: to.Ptr("Success"), + StatusDetails: to.Ptr("djruqvptzxak"), + Error: &armconnectedcache.ErrorDetail{}, + }, + Tags: map[string]*string{ + "key4171": to.Ptr("qtjlszkawsdujzpgohsbw"), + }, + }, 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 = armconnectedcache.IspCacheNodesOperationsClientCreateOrUpdateResponse{ + // IspCacheNodeResource: &armconnectedcache.IspCacheNodeResource{ + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DOTest/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1/ispCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers/ispCacheNodes"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("hskxkpbiqbrbjiwdzrxndru"), + // CustomerID: to.Ptr("ceyfqoygknpmmjojlhuklqybfl"), + // CustomerName: to.Ptr("xwyqk"), + // IPAddress: to.Ptr("voctagljcwqgcpnionqdcbjk"), + // CustomerIndex: to.Ptr("qtoiglqaswivmkjhzogburcxtszmek"), + // CacheNodeID: to.Ptr("xjzffjftwcgsehanoxsl"), + // CacheNodeName: to.Ptr("mfjxb"), + // CustomerAsn: to.Ptr[int32](4), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](29), + // MaxAllowableProbability: to.Ptr[float32](16), + // XCid: to.Ptr("kwnwgdbeflazz"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("oeyevqzlpbsimi"), + // ClientTenantID: to.Ptr("ds"), + // Category: to.Ptr("rixlfzbl"), + // ReleaseVersion: to.Ptr[int32](30), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](11), + // ContainerConfigurations: to.Ptr("waygqqgfzvnvlbufilldsqavwlshzt"), + // CidrCSV: []*string{ + // to.Ptr("nlqlvrthafvvljuupcbcw"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpReviewStateText: to.Ptr("xduneialocyri"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("us"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](2), + // BgpNumberOfRecords: to.Ptr[int32](21), + // BgpCidrBlocksCount: to.Ptr[int32](5), + // BgpAddressSpace: to.Ptr[int32](6), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](13), + // CidrSelectionType: to.Ptr[int32](4), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](19), + // ReviewStateText: to.Ptr("mrnragzmnscovixohmif"), + // ReviewFeedback: to.Ptr("wrcfimvx"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("arugukqjcxmkbgfambg"), + // AddressSpace: to.Ptr[int32](11), + // WorkerConnections: to.Ptr[int32](18), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](13), + // ImageURI: to.Ptr("ezbwyfaainatxtlplyoailzxlhxy"), + // }, + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("/mcc"), + // SizeInGb: to.Ptr[int32](500), + // CacheNumber: to.Ptr[int32](1), + // NginxMapping: to.Ptr("lijygenjq"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("pafcimhoog"), + // }, + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ex"), + // }, + // AggregatedStatusDetails: to.Ptr("emougql"), + // AggregatedStatusText: to.Ptr("xcasvndgkob"), + // AggregatedStatusCode: to.Ptr[int32](22), + // ProductVersion: to.Ptr("oxhqgwlhgnuf"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("ufvomikgfnmnj"), + // CacheNodeStateShortText: to.Ptr("orfpuvrevhrxsaasddazigglq"), + // CacheNodeState: to.Ptr[int32](9), + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("qhux"), + // OptionalProperty1: to.Ptr("hvpmt"), + // OptionalProperty2: to.Ptr("talanelmsgxvksrzoeeontqkjzbpv"), + // OptionalProperty3: to.Ptr("bxkoxq"), + // OptionalProperty4: to.Ptr("pqlkcekupusoc"), + // OptionalProperty5: to.Ptr("nyvvmrjigqdufzjdvazdca"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("djruqvptzxak"), + // Status: to.Ptr("tnyrntqvazk"), + // }, + // Tags: map[string]*string{ + // "key4171": to.Ptr("qtjlszkawsdujzpgohsbw"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/IspCacheNodesOperations_Delete_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewIspCacheNodesOperationsClient().BeginDelete(ctx, "rgConnectedCache", "lvpcosvbfxtpzscakewx", "wsiruvexelltpbouqxvsogqpxdizcwqwfowybncvjunlakjwcpgmqbdbgzjrsmxlkczxnsxfonhnqqa", 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: 2023-05-01-preview/IspCacheNodesOperations_Get_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewIspCacheNodesOperationsClient().Get(ctx, "rgConnectedCache", "sgtqjsitdrskmgyrrkntszwrrjjkretscpjgaezraucvcwececlelcsorfunrnvxyxcsrg", "lbsziwmudcjnwnwy", 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 = armconnectedcache.IspCacheNodesOperationsClientGetResponse{ + // IspCacheNodeResource: &armconnectedcache.IspCacheNodeResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1/ispCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers/ispCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("hskxkpbiqbrbjiwdzrxndru"), + // CustomerID: to.Ptr("ceyfqoygknpmmjojlhuklqybfl"), + // CustomerName: to.Ptr("xwyqk"), + // IPAddress: to.Ptr("voctagljcwqgcpnionqdcbjk"), + // CustomerIndex: to.Ptr("qtoiglqaswivmkjhzogburcxtszmek"), + // CacheNodeID: to.Ptr("xjzffjftwcgsehanoxsl"), + // CacheNodeName: to.Ptr("mfjxb"), + // CustomerAsn: to.Ptr[int32](4), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](29), + // MaxAllowableProbability: to.Ptr[float32](16), + // XCid: to.Ptr("kwnwgdbeflazz"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("oeyevqzlpbsimi"), + // ClientTenantID: to.Ptr("ds"), + // Category: to.Ptr("rixlfzbl"), + // ReleaseVersion: to.Ptr[int32](30), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](11), + // ContainerConfigurations: to.Ptr("waygqqgfzvnvlbufilldsqavwlshzt"), + // CidrCSV: []*string{ + // to.Ptr("nlqlvrthafvvljuupcbcw"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpReviewStateText: to.Ptr("xduneialocyri"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("us"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](2), + // BgpNumberOfRecords: to.Ptr[int32](21), + // BgpCidrBlocksCount: to.Ptr[int32](5), + // BgpAddressSpace: to.Ptr[int32](6), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](13), + // CidrSelectionType: to.Ptr[int32](4), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](19), + // ReviewStateText: to.Ptr("mrnragzmnscovixohmif"), + // ReviewFeedback: to.Ptr("wrcfimvx"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("arugukqjcxmkbgfambg"), + // AddressSpace: to.Ptr[int32](11), + // WorkerConnections: to.Ptr[int32](18), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](13), + // ImageURI: to.Ptr("ezbwyfaainatxtlplyoailzxlhxy"), + // }, + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("/mcc"), + // SizeInGb: to.Ptr[int32](500), + // CacheNumber: to.Ptr[int32](1), + // NginxMapping: to.Ptr("lijygenjq"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("pafcimhoog"), + // }, + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ex"), + // }, + // AggregatedStatusDetails: to.Ptr("emougql"), + // AggregatedStatusText: to.Ptr("xcasvndgkob"), + // AggregatedStatusCode: to.Ptr[int32](22), + // ProductVersion: to.Ptr("oxhqgwlhgnuf"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("ufvomikgfnmnj"), + // CacheNodeStateShortText: to.Ptr("orfpuvrevhrxsaasddazigglq"), + // CacheNodeState: to.Ptr[int32](9), + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("qhux"), + // OptionalProperty1: to.Ptr("hvpmt"), + // OptionalProperty2: to.Ptr("talanelmsgxvksrzoeeontqkjzbpv"), + // OptionalProperty3: to.Ptr("bxkoxq"), + // OptionalProperty4: to.Ptr("pqlkcekupusoc"), + // OptionalProperty5: to.Ptr("nyvvmrjigqdufzjdvazdca"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("djruqvptzxak"), + // Status: to.Ptr("tnyrntqvazk"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4171": to.Ptr("qtjlszkawsdujzpgohsbw"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/IspCacheNodesOperations_GetBgpCidrs_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_GetBgpCidrs() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewIspCacheNodesOperationsClient().GetBgpCidrs(ctx, "rgConnectedCache", "MccRPTest1", "MCCCachenode1", 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 = armconnectedcache.IspCacheNodesOperationsClientGetBgpCidrsResponse{ + // MccCacheNodeBgpCidrDetails: &armconnectedcache.MccCacheNodeBgpCidrDetails{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1/ispCacheNodes/MCCCachenode1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers/ispCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.BgpCidrsConfiguration{ + // BgpCidrs: []*string{ + // to.Ptr("10.1.0.1/23"), + // to.Ptr("10.1.0.1/32"), + // }, + // }, + // Tags: map[string]*string{ + // "key5911": to.Ptr("qllqoxckxvnyhdegqubvqtfediery"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/IspCacheNodesOperations_GetCacheNodeInstallDetails_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_GetCacheNodeInstallDetails() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewIspCacheNodesOperationsClient().GetCacheNodeInstallDetails(ctx, "rgConnectedCache", "MccRPTest1", "MCCCachenode1", 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 = armconnectedcache.IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{ + // MccCacheNodeInstallDetails: &armconnectedcache.MccCacheNodeInstallDetails{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1/ispCacheNodes/MCCCachenode1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers/ispCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeInstallProperties{ + // CustomerID: to.Ptr("eqklliuswn"), + // CacheNodeID: to.Ptr("zirahqqohbaju"), + // PrimaryAccountKey: to.Ptr("mzfvziehrsbxidhj"), + // SecondaryAccountKey: to.Ptr("dq"), + // RegistrationKey: to.Ptr("tnwkmorctwsgajewcoutombm"), + // }, + // Tags: map[string]*string{ + // "key5811": to.Ptr("betoafcoprgfcuscoew"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/IspCacheNodesOperations_ListByIspCustomerResource_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_NewListByIspCustomerResourcePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewIspCacheNodesOperationsClient().NewListByIspCustomerResourcePager("rgConnectedCache", "MccRPTest1", 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 = armconnectedcache.IspCacheNodesOperationsClientListByIspCustomerResourceResponse{ + // IspCacheNodeResourceListResult: armconnectedcache.IspCacheNodeResourceListResult{ + // Value: []*armconnectedcache.IspCacheNodeResource{ + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1/ispCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers/ispCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("hskxkpbiqbrbjiwdzrxndru"), + // CustomerID: to.Ptr("ceyfqoygknpmmjojlhuklqybfl"), + // CustomerName: to.Ptr("xwyqk"), + // IPAddress: to.Ptr("voctagljcwqgcpnionqdcbjk"), + // CustomerIndex: to.Ptr("qtoiglqaswivmkjhzogburcxtszmek"), + // CacheNodeID: to.Ptr("xjzffjftwcgsehanoxsl"), + // CacheNodeName: to.Ptr("mfjxb"), + // CustomerAsn: to.Ptr[int32](4), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](29), + // MaxAllowableProbability: to.Ptr[float32](16), + // XCid: to.Ptr("kwnwgdbeflazz"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("oeyevqzlpbsimi"), + // ClientTenantID: to.Ptr("ds"), + // Category: to.Ptr("rixlfzbl"), + // ReleaseVersion: to.Ptr[int32](30), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](11), + // ContainerConfigurations: to.Ptr("waygqqgfzvnvlbufilldsqavwlshzt"), + // CidrCSV: []*string{ + // to.Ptr("nlqlvrthafvvljuupcbcw"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpReviewStateText: to.Ptr("xduneialocyri"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("us"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](2), + // BgpNumberOfRecords: to.Ptr[int32](21), + // BgpCidrBlocksCount: to.Ptr[int32](5), + // BgpAddressSpace: to.Ptr[int32](6), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](13), + // CidrSelectionType: to.Ptr[int32](4), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](19), + // ReviewStateText: to.Ptr("mrnragzmnscovixohmif"), + // ReviewFeedback: to.Ptr("wrcfimvx"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("arugukqjcxmkbgfambg"), + // AddressSpace: to.Ptr[int32](11), + // WorkerConnections: to.Ptr[int32](18), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](13), + // ImageURI: to.Ptr("ezbwyfaainatxtlplyoailzxlhxy"), + // }, + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("/mcc"), + // SizeInGb: to.Ptr[int32](500), + // CacheNumber: to.Ptr[int32](1), + // NginxMapping: to.Ptr("lijygenjq"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("pafcimhoog"), + // }, + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ex"), + // }, + // AggregatedStatusDetails: to.Ptr("emougql"), + // AggregatedStatusText: to.Ptr("xcasvndgkob"), + // AggregatedStatusCode: to.Ptr[int32](22), + // ProductVersion: to.Ptr("oxhqgwlhgnuf"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("ufvomikgfnmnj"), + // CacheNodeStateShortText: to.Ptr("orfpuvrevhrxsaasddazigglq"), + // CacheNodeState: to.Ptr[int32](9), + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("qhux"), + // OptionalProperty1: to.Ptr("hvpmt"), + // OptionalProperty2: to.Ptr("talanelmsgxvksrzoeeontqkjzbpv"), + // OptionalProperty3: to.Ptr("bxkoxq"), + // OptionalProperty4: to.Ptr("pqlkcekupusoc"), + // OptionalProperty5: to.Ptr("nyvvmrjigqdufzjdvazdca"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("djruqvptzxak"), + // Status: to.Ptr("tnyrntqvazk"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4171": to.Ptr("qtjlszkawsdujzpgohsbw"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/IspCacheNodesOperations_Update_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewIspCacheNodesOperationsClient().Update(ctx, "rgConnectedCache", "MccRPTest1", "MCCCachenode1", armconnectedcache.PatchResource{ + Tags: map[string]*string{ + "key1653": to.Ptr("nzjczrhclhkndesgy"), + }, + }, 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 = armconnectedcache.IspCacheNodesOperationsClientUpdateResponse{ + // IspCacheNodeResource: &armconnectedcache.IspCacheNodeResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1/ispCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers/ispCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("hskxkpbiqbrbjiwdzrxndru"), + // CustomerID: to.Ptr("ceyfqoygknpmmjojlhuklqybfl"), + // CustomerName: to.Ptr("xwyqk"), + // IPAddress: to.Ptr("voctagljcwqgcpnionqdcbjk"), + // CustomerIndex: to.Ptr("qtoiglqaswivmkjhzogburcxtszmek"), + // CacheNodeID: to.Ptr("xjzffjftwcgsehanoxsl"), + // CacheNodeName: to.Ptr("mfjxb"), + // CustomerAsn: to.Ptr[int32](4), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](29), + // MaxAllowableProbability: to.Ptr[float32](16), + // XCid: to.Ptr("kwnwgdbeflazz"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("oeyevqzlpbsimi"), + // ClientTenantID: to.Ptr("ds"), + // Category: to.Ptr("rixlfzbl"), + // ReleaseVersion: to.Ptr[int32](30), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](11), + // ContainerConfigurations: to.Ptr("waygqqgfzvnvlbufilldsqavwlshzt"), + // CidrCSV: []*string{ + // to.Ptr("127.0.0.1/20"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpReviewStateText: to.Ptr("xduneialocyri"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("us"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](2), + // BgpNumberOfRecords: to.Ptr[int32](21), + // BgpCidrBlocksCount: to.Ptr[int32](5), + // BgpAddressSpace: to.Ptr[int32](6), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](13), + // CidrSelectionType: to.Ptr[int32](4), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](19), + // ReviewStateText: to.Ptr("mrnragzmnscovixohmif"), + // ReviewFeedback: to.Ptr("wrcfimvx"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("arugukqjcxmkbgfambg"), + // AddressSpace: to.Ptr[int32](11), + // WorkerConnections: to.Ptr[int32](18), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](13), + // ImageURI: to.Ptr("ezbwyfaainatxtlplyoailzxlhxy"), + // }, + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("/mcc"), + // SizeInGb: to.Ptr[int32](500), + // CacheNumber: to.Ptr[int32](1), + // NginxMapping: to.Ptr("lijygenjq"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("pafcimhoog"), + // }, + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ex"), + // }, + // AggregatedStatusDetails: to.Ptr("emougql"), + // AggregatedStatusText: to.Ptr("xcasvndgkob"), + // AggregatedStatusCode: to.Ptr[int32](22), + // ProductVersion: to.Ptr("oxhqgwlhgnuf"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("ufvomikgfnmnj"), + // CacheNodeStateShortText: to.Ptr("orfpuvrevhrxsaasddazigglq"), + // CacheNodeState: to.Ptr[int32](9), + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("qhux"), + // OptionalProperty1: to.Ptr("hvpmt"), + // OptionalProperty2: to.Ptr("talanelmsgxvksrzoeeontqkjzbpv"), + // OptionalProperty3: to.Ptr("bxkoxq"), + // OptionalProperty4: to.Ptr("pqlkcekupusoc"), + // OptionalProperty5: to.Ptr("nyvvmrjigqdufzjdvazdca"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("djruqvptzxak"), + // Status: to.Ptr("tnyrntqvazk"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4171": to.Ptr("qtjlszkawsdujzpgohsbw"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client.go new file mode 100644 index 000000000000..a9a5ff6d9485 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client.go @@ -0,0 +1,446 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +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" +) + +// IspCustomersClient contains the methods for the IspCustomers group. +// Don't use this type directly, use NewIspCustomersClient() instead. +type IspCustomersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewIspCustomersClient creates a new instance of IspCustomersClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewIspCustomersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IspCustomersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &IspCustomersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - This api creates an ispCustomer with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - resource - Resource create parameters. +// - options - IspCustomersClientBeginCreateOrUpdateOptions contains the optional parameters for the IspCustomersClient.BeginCreateOrUpdate +// method. +func (client *IspCustomersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource IspCustomerResource, options *IspCustomersClientBeginCreateOrUpdateOptions) (*runtime.Poller[IspCustomersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, customerResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IspCustomersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[IspCustomersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - This api creates an ispCustomer with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *IspCustomersClient) createOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource IspCustomerResource, options *IspCustomersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "IspCustomersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, customerResourceName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *IspCustomersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, resource IspCustomerResource, _ *IspCustomersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - This api deletes an existing ispCustomer resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - IspCustomersClientBeginDeleteOptions contains the optional parameters for the IspCustomersClient.BeginDelete +// method. +func (client *IspCustomersClient) BeginDelete(ctx context.Context, resourceGroupName string, customerResourceName string, options *IspCustomersClientBeginDeleteOptions) (*runtime.Poller[IspCustomersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, customerResourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IspCustomersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[IspCustomersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - This api deletes an existing ispCustomer resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *IspCustomersClient) deleteOperation(ctx context.Context, resourceGroupName string, customerResourceName string, options *IspCustomersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "IspCustomersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, customerResourceName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *IspCustomersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *IspCustomersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the ispCustomer resource information using this get call +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - IspCustomersClientGetOptions contains the optional parameters for the IspCustomersClient.Get method. +func (client *IspCustomersClient) Get(ctx context.Context, resourceGroupName string, customerResourceName string, options *IspCustomersClientGetOptions) (IspCustomersClientGetResponse, error) { + var err error + const operationName = "IspCustomersClient.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, customerResourceName, options) + if err != nil { + return IspCustomersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IspCustomersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IspCustomersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *IspCustomersClient) getCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *IspCustomersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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", "2023-05-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 *IspCustomersClient) getHandleResponse(resp *http.Response) (IspCustomersClientGetResponse, error) { + result := IspCustomersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCustomerResource); err != nil { + return IspCustomersClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - This api gets the information about all ispCustomer resources under the given subscription +// and resource group +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - IspCustomersClientListByResourceGroupOptions contains the optional parameters for the IspCustomersClient.NewListByResourceGroupPager +// method. +func (client *IspCustomersClient) NewListByResourceGroupPager(resourceGroupName string, options *IspCustomersClientListByResourceGroupOptions) *runtime.Pager[IspCustomersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[IspCustomersClientListByResourceGroupResponse]{ + More: func(page IspCustomersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IspCustomersClientListByResourceGroupResponse) (IspCustomersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IspCustomersClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return IspCustomersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *IspCustomersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *IspCustomersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers" + 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)) + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *IspCustomersClient) listByResourceGroupHandleResponse(resp *http.Response) (IspCustomersClientListByResourceGroupResponse, error) { + result := IspCustomersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCustomerResourceListResult); err != nil { + return IspCustomersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - This api gets information about all ispCustomer resources under the given subscription +// +// Generated from API version 2023-05-01-preview +// - options - IspCustomersClientListBySubscriptionOptions contains the optional parameters for the IspCustomersClient.NewListBySubscriptionPager +// method. +func (client *IspCustomersClient) NewListBySubscriptionPager(options *IspCustomersClientListBySubscriptionOptions) *runtime.Pager[IspCustomersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[IspCustomersClientListBySubscriptionResponse]{ + More: func(page IspCustomersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IspCustomersClientListBySubscriptionResponse) (IspCustomersClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IspCustomersClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return IspCustomersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *IspCustomersClient) listBySubscriptionCreateRequest(ctx context.Context, _ *IspCustomersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedCache/ispCustomers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *IspCustomersClient) listBySubscriptionHandleResponse(resp *http.Response) (IspCustomersClientListBySubscriptionResponse, error) { + result := IspCustomersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCustomerResourceListResult); err != nil { + return IspCustomersClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - This api updates an existing ispCustomer resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - properties - The resource properties to be updated. +// - options - IspCustomersClientUpdateOptions contains the optional parameters for the IspCustomersClient.Update method. +func (client *IspCustomersClient) Update(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, options *IspCustomersClientUpdateOptions) (IspCustomersClientUpdateResponse, error) { + var err error + const operationName = "IspCustomersClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, customerResourceName, properties, options) + if err != nil { + return IspCustomersClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IspCustomersClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IspCustomersClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *IspCustomersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, _ *IspCustomersClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *IspCustomersClient) updateHandleResponse(resp *http.Response) (IspCustomersClientUpdateResponse, error) { + result := IspCustomersClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCustomerResource); err != nil { + return IspCustomersClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client_example_test.go new file mode 100644 index 000000000000..f03849689aa1 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client_example_test.go @@ -0,0 +1,770 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "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/connectedcache/armconnectedcache" + "log" + "time" +) + +// Generated from example definition: 2023-05-01-preview/IspCustomers_CreateOrUpdate_MaximumSet_Gen.json +func ExampleIspCustomersClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewIspCustomersClient().BeginCreateOrUpdate(ctx, "rgConnectedCache", "MccRPTest2", armconnectedcache.IspCustomerResource{ + Location: to.Ptr("westus"), + Properties: &armconnectedcache.CustomerProperty{ + Customer: &armconnectedcache.CustomerEntity{ + FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + ContactEmail: to.Ptr("xquos"), + ContactPhone: to.Ptr("vue"), + ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + IsEntitled: to.Ptr(true), + ReleaseVersion: to.Ptr[int32](20), + ClientTenantID: to.Ptr("fproidkpgvpdnac"), + IsEnterpriseManaged: to.Ptr(true), + ShouldMigrate: to.Ptr(true), + ResendSignupCode: to.Ptr(true), + VerifySignupCode: to.Ptr(true), + VerifySignupPhrase: to.Ptr("tprjvttkgmrqlsyicnidhm"), + }, + AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + CustomerEmail: to.Ptr("zdjgibsidydyzm"), + CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + CustomerEntitlementSKUID: to.Ptr("b"), + CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t }()), + OptionalProperty1: to.Ptr("qhmwxza"), + OptionalProperty2: to.Ptr("l"), + OptionalProperty3: to.Ptr("mblwwvbie"), + OptionalProperty4: to.Ptr("vzuek"), + OptionalProperty5: to.Ptr("fzjodscdfcdr"), + }, + Error: &armconnectedcache.ErrorDetail{}, + }, + Tags: map[string]*string{ + "key1878": to.Ptr("warz"), + }, + }, 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 = armconnectedcache.IspCustomersClientCreateOrUpdateResponse{ + // IspCustomerResource: &armconnectedcache.IspCustomerResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key1878": to.Ptr("warz"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/IspCustomers_Delete_MaximumSet_Gen.json +func ExampleIspCustomersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewIspCustomersClient().BeginDelete(ctx, "rgConnectedCache", "hdontfoythjsaeyjhrakckgimgchxwzttbcnvntpvdsgeumxpgnjurptd", 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: 2023-05-01-preview/IspCustomers_Get_MaximumSet_Gen.json +func ExampleIspCustomersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewIspCustomersClient().Get(ctx, "rgConnectedCache", "cmcjfueweicolcjkwmsuvcj", 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 = armconnectedcache.IspCustomersClientGetResponse{ + // IspCustomerResource: &armconnectedcache.IspCustomerResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key1878": to.Ptr("warz"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/IspCustomers_ListByResourceGroup_MaximumSet_Gen.json +func ExampleIspCustomersClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewIspCustomersClient().NewListByResourceGroupPager("rgConnectedCache", 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 = armconnectedcache.IspCustomersClientListByResourceGroupResponse{ + // IspCustomerResourceListResult: armconnectedcache.IspCustomerResourceListResult{ + // Value: []*armconnectedcache.IspCustomerResource{ + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key1878": to.Ptr("warz"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1"), + // Name: to.Ptr("MCCTPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("oytrfgfhk"), + // StatusText: to.Ptr("pqitblihwfrq"), + // StatusDetails: to.Ptr("kvxqjbldcwqgslerajc"), + // Status: to.Ptr("stwi"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key2096": to.Ptr("uzoqqgqnnaiagdqilrjiezogx"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/ao"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/IspCustomers_ListBySubscription_MaximumSet_Gen.json +func ExampleIspCustomersClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewIspCustomersClient().NewListBySubscriptionPager(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 = armconnectedcache.IspCustomersClientListBySubscriptionResponse{ + // IspCustomerResourceListResult: armconnectedcache.IspCustomerResourceListResult{ + // Value: []*armconnectedcache.IspCustomerResource{ + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key1878": to.Ptr("warz"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1"), + // Name: to.Ptr("MCCTPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("oytrfgfhk"), + // StatusText: to.Ptr("pqitblihwfrq"), + // StatusDetails: to.Ptr("kvxqjbldcwqgslerajc"), + // Status: to.Ptr("stwi"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key2096": to.Ptr("uzoqqgqnnaiagdqilrjiezogx"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/ao"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/IspCustomers_Update_MaximumSet_Gen.json +func ExampleIspCustomersClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewIspCustomersClient().Update(ctx, "rgConnectedCache", "MccRPTest2", armconnectedcache.PatchResource{ + Tags: map[string]*string{ + "key1653": to.Ptr("nzjczrhclhkndesgy"), + }, + }, 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 = armconnectedcache.IspCustomersClientUpdateResponse{ + // IspCustomerResource: &armconnectedcache.IspCustomerResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // }, + // Tags: map[string]*string{ + // "key1878": to.Ptr("warz"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/models.go b/sdk/resourcemanager/connectedcache/armconnectedcache/models.go new file mode 100644 index 000000000000..0809ee407c17 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/models.go @@ -0,0 +1,897 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +import "time" + +// AdditionalCacheNodeProperties - Model representing cache node for connected cache resource +type AdditionalCacheNodeProperties struct { + // Auto update or fast update version + AutoUpdateVersion *string + + // Cache node resource Bgp configuration. + BgpConfiguration *BgpConfiguration + + // issues list to return the issues as part of the additional cache node properties + CacheNodePropertiesDetailsIssuesList []*string + + // Cache node resource drive configurations. + DriveConfiguration []*CacheNodeDriveConfiguration + + // Cache node resource requires a proxy + IsProxyRequired *ProxyRequired + + // Operating system of the cache node + OSType *OsType + + // Optional property #1 of Mcc response object + OptionalProperty1 *string + + // Optional property #2 of Mcc response object + OptionalProperty2 *string + + // Optional property #3 of Mcc response object + OptionalProperty3 *string + + // Optional property #4 of Mcc response object + OptionalProperty4 *string + + // Optional property #5 of Mcc response object + OptionalProperty5 *string + + // Cache node resource Mcc proxy Url + ProxyURL *string + + // proxyUrl configuration of the cache node + ProxyURLConfiguration *ProxyURLConfiguration + + // Update Cycle Type + UpdateCycleType *CycleType + + // Update related information details + UpdateInfoDetails *string + + // customer requested date time for mcc install of update cycle + UpdateRequestedDateTime *time.Time + + // READ-ONLY; Cache node resource aggregated status code. + AggregatedStatusCode *int32 + + // READ-ONLY; Cache node resource aggregated status details. + AggregatedStatusDetails *string + + // READ-ONLY; Cache node resource aggregated status text. + AggregatedStatusText *string + + // READ-ONLY; Auto update version that is the applied to update on mcc cache node + AutoUpdateAppliedVersion *string + + // READ-ONLY; Auto update last applied date time of mcc install + AutoUpdateLastAppliedDateTime *time.Time + + // READ-ONLY; Auto Update status details from the backend after applying the new version details + AutoUpdateLastAppliedDetails *string + + // READ-ONLY; Last applied auto update state for mcc install of auto update cycle + AutoUpdateLastAppliedState *string + + // READ-ONLY; Auto update last triggered date time of mcc install + AutoUpdateLastTriggeredDateTime *time.Time + + // READ-ONLY; Auto update last applied date time of mcc install + AutoUpdateNextAvailableDateTime *time.Time + + // READ-ONLY; Auto update version that is the Next available version to update on mcc cache node + AutoUpdateNextAvailableVersion *string + + // READ-ONLY; Cache node resource state as integer. + CacheNodeState *int32 + + // READ-ONLY; Cache node resource detailed state text. + CacheNodeStateDetailedText *string + + // READ-ONLY; Cache node resource short state text. + CacheNodeStateShortText *string + + // READ-ONLY; Cache node resource flag indicating if cache node has been physically installed or provisioned on their physical + // lab. + IsProvisioned *bool + + // READ-ONLY; Cache node resource Mcc product version. + ProductVersion *string +} + +// AdditionalCustomerProperties - Model representing customer for connected cache resource +type AdditionalCustomerProperties struct { + // Customer resource Asn (autonomous system number). + CustomerAsn *string + + // Customer resource contact email. + CustomerEmail *string + + // Customer resource entitlement expiration date string. + CustomerEntitlementExpiration *time.Time + + // Customer resource entitlement Sku Guid. + CustomerEntitlementSKUGUID *string + + // Customer resource entitlement Sku Id. + CustomerEntitlementSKUID *string + + // Customer resource entitlement Sku name. + CustomerEntitlementSKUName *string + + // Customer resource transit Asn (autonomous system number). + CustomerTransitAsn *string + + // Customer resource transit state. + CustomerTransitState *CustomerTransitState + + // Optional property #1 of Mcc response object. + OptionalProperty1 *string + + // Optional property #2 of Mcc response object. + OptionalProperty2 *string + + // Optional property #3 of Mcc response object. + OptionalProperty3 *string + + // Optional property #4 of Mcc response object. + OptionalProperty4 *string + + // Optional property #5 of Mcc response object. + OptionalProperty5 *string + + // READ-ONLY; Customer resource estimated Asn peering peak in Gbps. + CustomerAsnEstimatedEgressPeekGbps *float32 + + // READ-ONLY; Customer resource owner organization name. + CustomerOrgName *string + + // READ-ONLY; Customer resource average egress in Mbps. + CustomerPropertiesOverviewAverageEgressMbps *float32 + + // READ-ONLY; Customer resource average cache miss throughput in Mbps. + CustomerPropertiesOverviewAverageMissMbps *float32 + + // READ-ONLY; Customer resource cache efficiency. + CustomerPropertiesOverviewCacheEfficiency *float32 + + // READ-ONLY; Customer resource total healthy cache nodes. + CustomerPropertiesOverviewCacheNodesHealthyCount *int32 + + // READ-ONLY; Customer resource total unhealthy cache nodes. + CustomerPropertiesOverviewCacheNodesUnhealthyCount *int32 + + // READ-ONLY; Customer resource maximum egress in Mbps. + CustomerPropertiesOverviewEgressMbpsMax *float32 + + // READ-ONLY; Customer resource peak egress timestamp. + CustomerPropertiesOverviewEgressMbpsMaxDateTime *time.Time + + // READ-ONLY; Customer resource maximum cache miss throughput in Mbps. + CustomerPropertiesOverviewMissMbpsMax *float32 + + // READ-ONLY; Customer resource peak cache miss throughput timestamp. + CustomerPropertiesOverviewMissMbpsMaxDateTime *time.Time + + // READ-ONLY; Customer resource last PeeringDB update timestamp. + PeeringDbLastUpdateDate *time.Time + + // READ-ONLY; Customer resource last PeeringDB update timestamp. + PeeringDbLastUpdateTime *time.Time + + // READ-ONLY; Customer resource signup phase status code as integer. + SignupPhaseStatusCode *int32 + + // READ-ONLY; Customer resource signup phase status as string text. + SignupPhaseStatusText *string + + // READ-ONLY; Customer resource signup status as boolean. + SignupStatus *bool + + // READ-ONLY; Customer resource signup status as integer code. + SignupStatusCode *int32 + + // READ-ONLY; Customer resource signup status as string text. + SignupStatusText *string +} + +// BgpCidrsConfiguration - Mcc cache node Bgp Cidr details. +type BgpCidrsConfiguration struct { + // READ-ONLY; Mcc cache node Bgp Cidr details. + BgpCidrs []*string +} + +// BgpConfiguration - Bgp configuration of cache node +type BgpConfiguration struct { + // Asn to ip address mapping + AsnToIPAddressMapping *string +} + +// CacheNodeDriveConfiguration - Drive configuration for cache node +type CacheNodeDriveConfiguration struct { + // corresponding nginx cache number. Valid cache numbers are 1 - 20 + CacheNumber *int32 + + // full binding for corresponding nginx cache drive + NginxMapping *string + + // physical path location of the folder used for caching content + PhysicalPath *string + + // physical size of the drive used for caching content + SizeInGb *int32 +} + +// CacheNodeEntity - Model representing Cache Node for ConnectedCache resource +type CacheNodeEntity struct { + // Customer requested day of week for mcc install of auto update cycle + AutoUpdateRequestedDay *int32 + + // Customer requested time of the day for mcc install of auto update cycle, should be hh:mm + AutoUpdateRequestedTime *string + + // Customer requested week of month for mcc install of auto update cycle + AutoUpdateRequestedWeek *int32 + + // Auto Update Ring Type which is slow or fast etc. + AutoUpdateRingType *AutoUpdateRingType + + // Cache node resource identifier of the cache node + CacheNodeID *string + + // Cache node resource name. + CacheNodeName *string + + // Cache node resource comma separated values of Cidrs. + CidrCSV []*string + + // Cache node resource current Cidr range precedence selection type. + CidrSelectionType *int32 + + // Cache node resource customer resource Asn (autonomous system number) + CustomerAsn *int32 + + // Cache node resource customer index as string. + CustomerIndex *string + + // Cache node resource customer resource name. + CustomerName *string + + // FQDN(fully qualified domain name) value of the mcc cache node + FullyQualifiedDomainName *string + + // Cache node resource Azure fully qualified resource Id. + FullyQualifiedResourceID *string + + // Cache node resource Ip address. + IPAddress *string + + // Cache node resource flag for indicating if cache node is enabled. + IsEnabled *bool + + // Cache node resource flag for determining if managed by enterprise as boolean. + IsEnterpriseManaged *bool + + // Cache node resource maximum allowed egress in Mbps. + MaxAllowableEgressInMbps *int32 + + // Cache node resource flag for determining if customer will be migrated. + ShouldMigrate *bool + + // READ-ONLY; Cache node resource total addressable space defined by the Cidr Csv block. + AddressSpace *int32 + + // READ-ONLY; Cache node resource total addressable space defined by Bgp and Cidr Csv blocks. + BgpAddressSpace *int32 + + // READ-ONLY; Cache node resource Bgp block count. + BgpCidrBlocksCount *int32 + + // READ-ONLY; Cache node resource last Bgp Cidr Csv update timestamp + BgpCidrCSVLastUpdateTime *time.Time + + // READ-ONLY; Cache node resource bytes truncated from Bgp output file. + BgpFileBytesTruncated *int32 + + // READ-ONLY; Cache node resource last Bgp report timestamp. + BgpLastReportedTime *time.Time + + // READ-ONLY; Cache node resource Bgp record count. + BgpNumberOfRecords *int32 + + // READ-ONLY; Cache node resource Bgp update count. + BgpNumberOfTimesUpdated *int32 + + // READ-ONLY; Cache node resource Bgp review feedback text. + BgpReviewFeedback *string + + // READ-ONLY; Cache node resource Bgp review state string text. + BgpReviewState *BgpReviewStateEnum + + // READ-ONLY; Cache node resource Bgp review state string text in detail. + BgpReviewStateText *string + + // READ-ONLY; Cache node resource category. + Category *string + + // READ-ONLY; Cache node resource last Cidr Csv update timestamp + CidrCSVLastUpdateTime *time.Time + + // READ-ONLY; Cache node resource customer resource client tenant Id of subscription. + ClientTenantID *string + + // READ-ONLY; Cache node resource configuration state. + ConfigurationState *ConfigurationState + + // READ-ONLY; Cache node resource configuration state text. + ConfigurationStateText *string + + // READ-ONLY; Cache node resource container configuration details. + ContainerConfigurations *string + + // READ-ONLY; Cache node resource Mcc container configuration details re-sync trigger. + ContainerResyncTrigger *int32 + + // READ-ONLY; Cache node resource create async operation Id. + CreateAsyncOperationID *string + + // READ-ONLY; Cache node resource customer resource GUID Id. + CustomerID *string + + // READ-ONLY; Cache node resource deletion async operation Id. + DeleteAsyncOperationID *string + + // READ-ONLY; Cache node resource Mcc Container Id Uri. + ImageURI *string + + // READ-ONLY; Cache node resource flag for indicating the cache node resource is frozen (not selectable, not editable in UI). + IsFrozen *bool + + // READ-ONLY; Cache node resource last sync timestamp. + LastSyncWithAzureTimestamp *time.Time + + // READ-ONLY; Cache node resource last backend updated timestamp. + LastUpdatedTimestamp *time.Time + + // READ-ONLY; Cache node resource maximum allowed probability of egress. + MaxAllowableProbability *float32 + + // READ-ONLY; Cache node resource release version. + ReleaseVersion *int32 + + // READ-ONLY; Cache node resource review feedback text. + ReviewFeedback *string + + // READ-ONLY; Cache node resource review process state as integer + ReviewState *int32 + + // READ-ONLY; Cache node resource review state text. + ReviewStateText *string + + // READ-ONLY; Cache node resource attempts to sync with Azure. + SynchWithAzureAttemptsCount *int32 + + // READ-ONLY; Cache node resource Mcc container deployment worker connection count. + WorkerConnections *int32 + + // READ-ONLY; Cache node resource last updated Mcc container deployment worker connection count timestamp. + WorkerConnectionsLastUpdatedDateTime *time.Time + + // READ-ONLY; Cache node resource Azure XCid. + XCid *string +} + +// CacheNodeInstallProperties - Mcc cache node resource install script properties. +type CacheNodeInstallProperties struct { + // Mcc cache node resource Id. + CacheNodeID *string + + // Mcc customer resource Id. + CustomerID *string + + // READ-ONLY; Mcc primary account key. Internal to Mcc. + PrimaryAccountKey *string + + // READ-ONLY; Mcc Iot Central temporary device registration key, used once. + RegistrationKey *string + + // READ-ONLY; Mcc secondary account key. Internal to Mcc. + SecondaryAccountKey *string +} + +// CacheNodeOldResponse - Model representing Cache Node for ConnectedCache resource +type CacheNodeOldResponse struct { + // The error details + Error *ErrorDetail + + // statusCode used to get code details of Mcc response object + StatusCode *string + + // statusDetails used to get inner details of Mcc response object + StatusDetails *string + + // statusText used to get status details in string format of Mcc response object + StatusText *string + + // READ-ONLY; The provisioned state of the resource + ProvisioningState *ProvisioningState + + // READ-ONLY; status of the HTTP error code + Status *string +} + +// CacheNodePreviewResource - Concrete tracked resource types can be created by aliasing this type using a specific property +// type. +type CacheNodePreviewResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CacheNodeOldResponse + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the Customer resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// CacheNodePreviewResourceListResult - The response of a CacheNodePreviewResource list operation. +type CacheNodePreviewResourceListResult struct { + // REQUIRED; The CacheNodePreviewResource items on this page + Value []*CacheNodePreviewResource + + // The link to the next page of items + NextLink *string +} + +// CacheNodeProperty - Model representing an Mcc cache node connectedCache resource +type CacheNodeProperty struct { + // Mcc cache node resource additional properties. + AdditionalCacheNodeProperties *AdditionalCacheNodeProperties + + // Mcc cache node resource (cache node entity). + CacheNode *CacheNodeEntity + + // Mcc response error details. + Error *ErrorDetail + + // Mcc response status code. + StatusCode *string + + // Mcc response status details for retrieving response inner details. + StatusDetails *string + + // Mcc response status text as string for retrieving status details. + StatusText *string + + // READ-ONLY; The provisioned state of the resource + ProvisioningState *ProvisioningState + + // READ-ONLY; HTTP error status code. + Status *string +} + +// CustomerEntity - Model representing Customer resource for ConnectedCache resource +type CustomerEntity struct { + // Customer resource client tenant Id of subscription. + ClientTenantID *string + + // Customer resource contact email. + ContactEmail *string + + // Customer resource contact full name. + ContactName *string + + // Customer resource contact phone. + ContactPhone *string + + // Customer resource name. + CustomerName *string + + // Customer resource Azure fully qualified resource Id. + FullyQualifiedResourceID *string + + // Customer resource flag for enterprise management as boolean. + IsEnterpriseManaged *bool + + // Customer resource entitlement flag as boolean. + IsEntitled *bool + + // Customer resource Mcc release version. + ReleaseVersion *int32 + + // Customer resource flag for resending signup code as boolean. + ResendSignupCode *bool + + // Customer resource flag for migration. + ShouldMigrate *bool + + // Customer resource flag for requiring verification of signup code as boolean. + VerifySignupCode *bool + + // Customer resource phrase for verifying signup. + VerifySignupPhrase *string + + // READ-ONLY; Customer resource create async operation Id. + CreateAsyncOperationID *string + + // READ-ONLY; Customer resource Guid Id. + CustomerID *string + + // READ-ONLY; Customer resource deletion async operation Id. + DeleteAsyncOperationID *string + + // READ-ONLY; Customer resource last Azure sync timestamp. + LastSyncWithAzureTimestamp *time.Time + + // READ-ONLY; Customer resource sync attempts. + SynchWithAzureAttemptsCount *int32 +} + +// CustomerProperty - Model representing customer for connectedCache resource +type CustomerProperty struct { + // Mcc customer resource additional properties. + AdditionalCustomerProperties *AdditionalCustomerProperties + + // Mcc customer resource (customer entity). + Customer *CustomerEntity + + // READ-ONLY; Mcc response error details. + Error *ErrorDetail + + // READ-ONLY; The provisioned state of the resource + ProvisioningState *ProvisioningState + + // READ-ONLY; HTTP error status code. + Status *string + + // READ-ONLY; Mcc response status code. + StatusCode *string + + // READ-ONLY; Mcc response status details for retrieving response inner details. + StatusDetails *string + + // READ-ONLY; Mcc response status text as string for retrieving status details. + StatusText *string +} + +// EnterpriseMccCacheNodeResource - Represents the high level Nodes needed to provision cache node resources +type EnterpriseMccCacheNodeResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CacheNodeProperty + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the ConnectedCache resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// EnterpriseMccCacheNodeResourceListResult - The response of a EnterpriseMccCacheNodeResource list operation. +type EnterpriseMccCacheNodeResourceListResult struct { + // REQUIRED; The EnterpriseMccCacheNodeResource items on this page + Value []*EnterpriseMccCacheNodeResource + + // The link to the next page of items + NextLink *string +} + +// EnterpriseMccCustomerResource - Represents the high level Nodes needed to provision customer resources +type EnterpriseMccCustomerResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CustomerProperty + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the Customer resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// EnterpriseMccCustomerResourceListResult - The response of a EnterpriseMccCustomerResource list operation. +type EnterpriseMccCustomerResourceListResult struct { + // REQUIRED; The EnterpriseMccCustomerResource items on this page + Value []*EnterpriseMccCustomerResource + + // The link to the next page of items + NextLink *string +} + +// EnterprisePreviewResource - ConnectedCache Resource. Represents the high level Nodes needed to provision CacheNode and +// customer resources used in private preview +type EnterprisePreviewResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CacheNodeOldResponse + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the Customer resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// EnterprisePreviewResourceListResult - The response of a EnterprisePreviewResource list operation. +type EnterprisePreviewResourceListResult struct { + // REQUIRED; The EnterprisePreviewResource items on this page + Value []*EnterprisePreviewResource + + // The link to the next page of items + NextLink *string +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info *ErrorAdditionalInfoInfo + + // READ-ONLY; The additional info type. + Type *string +} + +type ErrorAdditionalInfoInfo struct { +} + +// 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 +} + +// IspCacheNodeResource - Represents the high level Nodes needed to provision cache node resources +type IspCacheNodeResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CacheNodeProperty + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the ConnectedCache resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// IspCacheNodeResourceListResult - The response of a IspCacheNodeResource list operation. +type IspCacheNodeResourceListResult struct { + // REQUIRED; The IspCacheNodeResource items on this page + Value []*IspCacheNodeResource + + // The link to the next page of items + NextLink *string +} + +// IspCustomerResource - Represents the high level Nodes needed to provision isp customer resources +type IspCustomerResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CustomerProperty + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the Customer resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// IspCustomerResourceListResult - The response of a IspCustomerResource list operation. +type IspCustomerResourceListResult struct { + // REQUIRED; The IspCustomerResource items on this page + Value []*IspCustomerResource + + // The link to the next page of items + NextLink *string +} + +// MccCacheNodeBgpCidrDetails - Represents all Cidr details of the Bgp request for a specific cache node resource +type MccCacheNodeBgpCidrDetails struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Mcc cache node resource Bgp Cidr properties. + Properties *BgpCidrsConfiguration + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// MccCacheNodeInstallDetails - Mcc cache node resource all install details. +type MccCacheNodeInstallDetails struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Mcc cache node resource install script details. + Properties *CacheNodeInstallProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/control-plane operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for and operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // REQUIRED; The Operation items on this page + Value []*Operation + + // The link to the next page of items + NextLink *string +} + +// PatchResource - Mcc PATCH operation properties. +type PatchResource struct { + // Resource tags. + Tags map[string]*string +} + +// ProxyURLConfiguration - ProxyUrl configuration of cache node +type ProxyURLConfiguration struct { + // Host Proxy Address configuration along with port number. This can be a proxy or ip address. ex: xx.xx.xx.xxxx:80 or host + // name http://exampleproxy.com:80 + ProxyURL *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/models_serde.go b/sdk/resourcemanager/connectedcache/armconnectedcache/models_serde.go new file mode 100644 index 000000000000..0a2659d79975 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/models_serde.go @@ -0,0 +1,1827 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AdditionalCacheNodeProperties. +func (a AdditionalCacheNodeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aggregatedStatusCode", a.AggregatedStatusCode) + populate(objectMap, "aggregatedStatusDetails", a.AggregatedStatusDetails) + populate(objectMap, "aggregatedStatusText", a.AggregatedStatusText) + populate(objectMap, "autoUpdateAppliedVersion", a.AutoUpdateAppliedVersion) + populateDateTimeRFC3339(objectMap, "autoUpdateLastAppliedDateTime", a.AutoUpdateLastAppliedDateTime) + populate(objectMap, "autoUpdateLastAppliedDetails", a.AutoUpdateLastAppliedDetails) + populate(objectMap, "autoUpdateLastAppliedState", a.AutoUpdateLastAppliedState) + populateDateTimeRFC3339(objectMap, "autoUpdateLastTriggeredDateTime", a.AutoUpdateLastTriggeredDateTime) + populateDateTimeRFC3339(objectMap, "autoUpdateNextAvailableDateTime", a.AutoUpdateNextAvailableDateTime) + populate(objectMap, "autoUpdateNextAvailableVersion", a.AutoUpdateNextAvailableVersion) + populate(objectMap, "autoUpdateVersion", a.AutoUpdateVersion) + populate(objectMap, "bgpConfiguration", a.BgpConfiguration) + populate(objectMap, "cacheNodePropertiesDetailsIssuesList", a.CacheNodePropertiesDetailsIssuesList) + populate(objectMap, "cacheNodeState", a.CacheNodeState) + populate(objectMap, "cacheNodeStateDetailedText", a.CacheNodeStateDetailedText) + populate(objectMap, "cacheNodeStateShortText", a.CacheNodeStateShortText) + populate(objectMap, "driveConfiguration", a.DriveConfiguration) + populate(objectMap, "isProvisioned", a.IsProvisioned) + populate(objectMap, "isProxyRequired", a.IsProxyRequired) + populate(objectMap, "osType", a.OSType) + populate(objectMap, "optionalProperty1", a.OptionalProperty1) + populate(objectMap, "optionalProperty2", a.OptionalProperty2) + populate(objectMap, "optionalProperty3", a.OptionalProperty3) + populate(objectMap, "optionalProperty4", a.OptionalProperty4) + populate(objectMap, "optionalProperty5", a.OptionalProperty5) + populate(objectMap, "productVersion", a.ProductVersion) + populate(objectMap, "proxyUrl", a.ProxyURL) + populate(objectMap, "proxyUrlConfiguration", a.ProxyURLConfiguration) + populate(objectMap, "updateCycleType", a.UpdateCycleType) + populate(objectMap, "updateInfoDetails", a.UpdateInfoDetails) + populateDateTimeRFC3339(objectMap, "updateRequestedDateTime", a.UpdateRequestedDateTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalCacheNodeProperties. +func (a *AdditionalCacheNodeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregatedStatusCode": + err = unpopulate(val, "AggregatedStatusCode", &a.AggregatedStatusCode) + delete(rawMsg, key) + case "aggregatedStatusDetails": + err = unpopulate(val, "AggregatedStatusDetails", &a.AggregatedStatusDetails) + delete(rawMsg, key) + case "aggregatedStatusText": + err = unpopulate(val, "AggregatedStatusText", &a.AggregatedStatusText) + delete(rawMsg, key) + case "autoUpdateAppliedVersion": + err = unpopulate(val, "AutoUpdateAppliedVersion", &a.AutoUpdateAppliedVersion) + delete(rawMsg, key) + case "autoUpdateLastAppliedDateTime": + err = unpopulateDateTimeRFC3339(val, "AutoUpdateLastAppliedDateTime", &a.AutoUpdateLastAppliedDateTime) + delete(rawMsg, key) + case "autoUpdateLastAppliedDetails": + err = unpopulate(val, "AutoUpdateLastAppliedDetails", &a.AutoUpdateLastAppliedDetails) + delete(rawMsg, key) + case "autoUpdateLastAppliedState": + err = unpopulate(val, "AutoUpdateLastAppliedState", &a.AutoUpdateLastAppliedState) + delete(rawMsg, key) + case "autoUpdateLastTriggeredDateTime": + err = unpopulateDateTimeRFC3339(val, "AutoUpdateLastTriggeredDateTime", &a.AutoUpdateLastTriggeredDateTime) + delete(rawMsg, key) + case "autoUpdateNextAvailableDateTime": + err = unpopulateDateTimeRFC3339(val, "AutoUpdateNextAvailableDateTime", &a.AutoUpdateNextAvailableDateTime) + delete(rawMsg, key) + case "autoUpdateNextAvailableVersion": + err = unpopulate(val, "AutoUpdateNextAvailableVersion", &a.AutoUpdateNextAvailableVersion) + delete(rawMsg, key) + case "autoUpdateVersion": + err = unpopulate(val, "AutoUpdateVersion", &a.AutoUpdateVersion) + delete(rawMsg, key) + case "bgpConfiguration": + err = unpopulate(val, "BgpConfiguration", &a.BgpConfiguration) + delete(rawMsg, key) + case "cacheNodePropertiesDetailsIssuesList": + err = unpopulate(val, "CacheNodePropertiesDetailsIssuesList", &a.CacheNodePropertiesDetailsIssuesList) + delete(rawMsg, key) + case "cacheNodeState": + err = unpopulate(val, "CacheNodeState", &a.CacheNodeState) + delete(rawMsg, key) + case "cacheNodeStateDetailedText": + err = unpopulate(val, "CacheNodeStateDetailedText", &a.CacheNodeStateDetailedText) + delete(rawMsg, key) + case "cacheNodeStateShortText": + err = unpopulate(val, "CacheNodeStateShortText", &a.CacheNodeStateShortText) + delete(rawMsg, key) + case "driveConfiguration": + err = unpopulate(val, "DriveConfiguration", &a.DriveConfiguration) + delete(rawMsg, key) + case "isProvisioned": + err = unpopulate(val, "IsProvisioned", &a.IsProvisioned) + delete(rawMsg, key) + case "isProxyRequired": + err = unpopulate(val, "IsProxyRequired", &a.IsProxyRequired) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &a.OSType) + delete(rawMsg, key) + case "optionalProperty1": + err = unpopulate(val, "OptionalProperty1", &a.OptionalProperty1) + delete(rawMsg, key) + case "optionalProperty2": + err = unpopulate(val, "OptionalProperty2", &a.OptionalProperty2) + delete(rawMsg, key) + case "optionalProperty3": + err = unpopulate(val, "OptionalProperty3", &a.OptionalProperty3) + delete(rawMsg, key) + case "optionalProperty4": + err = unpopulate(val, "OptionalProperty4", &a.OptionalProperty4) + delete(rawMsg, key) + case "optionalProperty5": + err = unpopulate(val, "OptionalProperty5", &a.OptionalProperty5) + delete(rawMsg, key) + case "productVersion": + err = unpopulate(val, "ProductVersion", &a.ProductVersion) + delete(rawMsg, key) + case "proxyUrl": + err = unpopulate(val, "ProxyURL", &a.ProxyURL) + delete(rawMsg, key) + case "proxyUrlConfiguration": + err = unpopulate(val, "ProxyURLConfiguration", &a.ProxyURLConfiguration) + delete(rawMsg, key) + case "updateCycleType": + err = unpopulate(val, "UpdateCycleType", &a.UpdateCycleType) + delete(rawMsg, key) + case "updateInfoDetails": + err = unpopulate(val, "UpdateInfoDetails", &a.UpdateInfoDetails) + delete(rawMsg, key) + case "updateRequestedDateTime": + err = unpopulateDateTimeRFC3339(val, "UpdateRequestedDateTime", &a.UpdateRequestedDateTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdditionalCustomerProperties. +func (a AdditionalCustomerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customerAsn", a.CustomerAsn) + populate(objectMap, "customerAsnEstimatedEgressPeekGbps", a.CustomerAsnEstimatedEgressPeekGbps) + populate(objectMap, "customerEmail", a.CustomerEmail) + populateDateTimeRFC3339(objectMap, "customerEntitlementExpiration", a.CustomerEntitlementExpiration) + populate(objectMap, "customerEntitlementSkuGuid", a.CustomerEntitlementSKUGUID) + populate(objectMap, "customerEntitlementSkuId", a.CustomerEntitlementSKUID) + populate(objectMap, "customerEntitlementSkuName", a.CustomerEntitlementSKUName) + populate(objectMap, "customerOrgName", a.CustomerOrgName) + populate(objectMap, "customerPropertiesOverviewAverageEgressMbps", a.CustomerPropertiesOverviewAverageEgressMbps) + populate(objectMap, "customerPropertiesOverviewAverageMissMbps", a.CustomerPropertiesOverviewAverageMissMbps) + populate(objectMap, "customerPropertiesOverviewCacheEfficiency", a.CustomerPropertiesOverviewCacheEfficiency) + populate(objectMap, "customerPropertiesOverviewCacheNodesHealthyCount", a.CustomerPropertiesOverviewCacheNodesHealthyCount) + populate(objectMap, "customerPropertiesOverviewCacheNodesUnhealthyCount", a.CustomerPropertiesOverviewCacheNodesUnhealthyCount) + populate(objectMap, "customerPropertiesOverviewEgressMbpsMax", a.CustomerPropertiesOverviewEgressMbpsMax) + populateDateTimeRFC3339(objectMap, "customerPropertiesOverviewEgressMbpsMaxDateTime", a.CustomerPropertiesOverviewEgressMbpsMaxDateTime) + populate(objectMap, "customerPropertiesOverviewMissMbpsMax", a.CustomerPropertiesOverviewMissMbpsMax) + populateDateTimeRFC3339(objectMap, "customerPropertiesOverviewMissMbpsMaxDateTime", a.CustomerPropertiesOverviewMissMbpsMaxDateTime) + populate(objectMap, "customerTransitAsn", a.CustomerTransitAsn) + populate(objectMap, "customerTransitState", a.CustomerTransitState) + populate(objectMap, "optionalProperty1", a.OptionalProperty1) + populate(objectMap, "optionalProperty2", a.OptionalProperty2) + populate(objectMap, "optionalProperty3", a.OptionalProperty3) + populate(objectMap, "optionalProperty4", a.OptionalProperty4) + populate(objectMap, "optionalProperty5", a.OptionalProperty5) + populateDateTimeRFC3339(objectMap, "peeringDbLastUpdateDate", a.PeeringDbLastUpdateDate) + populateDateTimeRFC3339(objectMap, "peeringDbLastUpdateTime", a.PeeringDbLastUpdateTime) + populate(objectMap, "signupPhaseStatusCode", a.SignupPhaseStatusCode) + populate(objectMap, "signupPhaseStatusText", a.SignupPhaseStatusText) + populate(objectMap, "signupStatus", a.SignupStatus) + populate(objectMap, "signupStatusCode", a.SignupStatusCode) + populate(objectMap, "signupStatusText", a.SignupStatusText) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalCustomerProperties. +func (a *AdditionalCustomerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customerAsn": + err = unpopulate(val, "CustomerAsn", &a.CustomerAsn) + delete(rawMsg, key) + case "customerAsnEstimatedEgressPeekGbps": + err = unpopulate(val, "CustomerAsnEstimatedEgressPeekGbps", &a.CustomerAsnEstimatedEgressPeekGbps) + delete(rawMsg, key) + case "customerEmail": + err = unpopulate(val, "CustomerEmail", &a.CustomerEmail) + delete(rawMsg, key) + case "customerEntitlementExpiration": + err = unpopulateDateTimeRFC3339(val, "CustomerEntitlementExpiration", &a.CustomerEntitlementExpiration) + delete(rawMsg, key) + case "customerEntitlementSkuGuid": + err = unpopulate(val, "CustomerEntitlementSKUGUID", &a.CustomerEntitlementSKUGUID) + delete(rawMsg, key) + case "customerEntitlementSkuId": + err = unpopulate(val, "CustomerEntitlementSKUID", &a.CustomerEntitlementSKUID) + delete(rawMsg, key) + case "customerEntitlementSkuName": + err = unpopulate(val, "CustomerEntitlementSKUName", &a.CustomerEntitlementSKUName) + delete(rawMsg, key) + case "customerOrgName": + err = unpopulate(val, "CustomerOrgName", &a.CustomerOrgName) + delete(rawMsg, key) + case "customerPropertiesOverviewAverageEgressMbps": + err = unpopulate(val, "CustomerPropertiesOverviewAverageEgressMbps", &a.CustomerPropertiesOverviewAverageEgressMbps) + delete(rawMsg, key) + case "customerPropertiesOverviewAverageMissMbps": + err = unpopulate(val, "CustomerPropertiesOverviewAverageMissMbps", &a.CustomerPropertiesOverviewAverageMissMbps) + delete(rawMsg, key) + case "customerPropertiesOverviewCacheEfficiency": + err = unpopulate(val, "CustomerPropertiesOverviewCacheEfficiency", &a.CustomerPropertiesOverviewCacheEfficiency) + delete(rawMsg, key) + case "customerPropertiesOverviewCacheNodesHealthyCount": + err = unpopulate(val, "CustomerPropertiesOverviewCacheNodesHealthyCount", &a.CustomerPropertiesOverviewCacheNodesHealthyCount) + delete(rawMsg, key) + case "customerPropertiesOverviewCacheNodesUnhealthyCount": + err = unpopulate(val, "CustomerPropertiesOverviewCacheNodesUnhealthyCount", &a.CustomerPropertiesOverviewCacheNodesUnhealthyCount) + delete(rawMsg, key) + case "customerPropertiesOverviewEgressMbpsMax": + err = unpopulate(val, "CustomerPropertiesOverviewEgressMbpsMax", &a.CustomerPropertiesOverviewEgressMbpsMax) + delete(rawMsg, key) + case "customerPropertiesOverviewEgressMbpsMaxDateTime": + err = unpopulateDateTimeRFC3339(val, "CustomerPropertiesOverviewEgressMbpsMaxDateTime", &a.CustomerPropertiesOverviewEgressMbpsMaxDateTime) + delete(rawMsg, key) + case "customerPropertiesOverviewMissMbpsMax": + err = unpopulate(val, "CustomerPropertiesOverviewMissMbpsMax", &a.CustomerPropertiesOverviewMissMbpsMax) + delete(rawMsg, key) + case "customerPropertiesOverviewMissMbpsMaxDateTime": + err = unpopulateDateTimeRFC3339(val, "CustomerPropertiesOverviewMissMbpsMaxDateTime", &a.CustomerPropertiesOverviewMissMbpsMaxDateTime) + delete(rawMsg, key) + case "customerTransitAsn": + err = unpopulate(val, "CustomerTransitAsn", &a.CustomerTransitAsn) + delete(rawMsg, key) + case "customerTransitState": + err = unpopulate(val, "CustomerTransitState", &a.CustomerTransitState) + delete(rawMsg, key) + case "optionalProperty1": + err = unpopulate(val, "OptionalProperty1", &a.OptionalProperty1) + delete(rawMsg, key) + case "optionalProperty2": + err = unpopulate(val, "OptionalProperty2", &a.OptionalProperty2) + delete(rawMsg, key) + case "optionalProperty3": + err = unpopulate(val, "OptionalProperty3", &a.OptionalProperty3) + delete(rawMsg, key) + case "optionalProperty4": + err = unpopulate(val, "OptionalProperty4", &a.OptionalProperty4) + delete(rawMsg, key) + case "optionalProperty5": + err = unpopulate(val, "OptionalProperty5", &a.OptionalProperty5) + delete(rawMsg, key) + case "peeringDbLastUpdateDate": + err = unpopulateDateTimeRFC3339(val, "PeeringDbLastUpdateDate", &a.PeeringDbLastUpdateDate) + delete(rawMsg, key) + case "peeringDbLastUpdateTime": + err = unpopulateDateTimeRFC3339(val, "PeeringDbLastUpdateTime", &a.PeeringDbLastUpdateTime) + delete(rawMsg, key) + case "signupPhaseStatusCode": + err = unpopulate(val, "SignupPhaseStatusCode", &a.SignupPhaseStatusCode) + delete(rawMsg, key) + case "signupPhaseStatusText": + err = unpopulate(val, "SignupPhaseStatusText", &a.SignupPhaseStatusText) + delete(rawMsg, key) + case "signupStatus": + err = unpopulate(val, "SignupStatus", &a.SignupStatus) + delete(rawMsg, key) + case "signupStatusCode": + err = unpopulate(val, "SignupStatusCode", &a.SignupStatusCode) + delete(rawMsg, key) + case "signupStatusText": + err = unpopulate(val, "SignupStatusText", &a.SignupStatusText) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BgpCidrsConfiguration. +func (b BgpCidrsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bgpCidrs", b.BgpCidrs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BgpCidrsConfiguration. +func (b *BgpCidrsConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bgpCidrs": + err = unpopulate(val, "BgpCidrs", &b.BgpCidrs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BgpConfiguration. +func (b BgpConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "asnToIpAddressMapping", b.AsnToIPAddressMapping) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BgpConfiguration. +func (b *BgpConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asnToIpAddressMapping": + err = unpopulate(val, "AsnToIPAddressMapping", &b.AsnToIPAddressMapping) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodeDriveConfiguration. +func (c CacheNodeDriveConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cacheNumber", c.CacheNumber) + populate(objectMap, "nginxMapping", c.NginxMapping) + populate(objectMap, "physicalPath", c.PhysicalPath) + populate(objectMap, "sizeInGb", c.SizeInGb) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodeDriveConfiguration. +func (c *CacheNodeDriveConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cacheNumber": + err = unpopulate(val, "CacheNumber", &c.CacheNumber) + delete(rawMsg, key) + case "nginxMapping": + err = unpopulate(val, "NginxMapping", &c.NginxMapping) + delete(rawMsg, key) + case "physicalPath": + err = unpopulate(val, "PhysicalPath", &c.PhysicalPath) + delete(rawMsg, key) + case "sizeInGb": + err = unpopulate(val, "SizeInGb", &c.SizeInGb) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodeEntity. +func (c CacheNodeEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressSpace", c.AddressSpace) + populate(objectMap, "autoUpdateRequestedDay", c.AutoUpdateRequestedDay) + populate(objectMap, "autoUpdateRequestedTime", c.AutoUpdateRequestedTime) + populate(objectMap, "autoUpdateRequestedWeek", c.AutoUpdateRequestedWeek) + populate(objectMap, "autoUpdateRingType", c.AutoUpdateRingType) + populate(objectMap, "bgpAddressSpace", c.BgpAddressSpace) + populate(objectMap, "bgpCidrBlocksCount", c.BgpCidrBlocksCount) + populateDateTimeRFC3339(objectMap, "bgpCidrCsvLastUpdateTime", c.BgpCidrCSVLastUpdateTime) + populate(objectMap, "bgpFileBytesTruncated", c.BgpFileBytesTruncated) + populateDateTimeRFC3339(objectMap, "bgpLastReportedTime", c.BgpLastReportedTime) + populate(objectMap, "bgpNumberOfRecords", c.BgpNumberOfRecords) + populate(objectMap, "bgpNumberOfTimesUpdated", c.BgpNumberOfTimesUpdated) + populate(objectMap, "bgpReviewFeedback", c.BgpReviewFeedback) + populate(objectMap, "bgpReviewState", c.BgpReviewState) + populate(objectMap, "bgpReviewStateText", c.BgpReviewStateText) + populate(objectMap, "cacheNodeId", c.CacheNodeID) + populate(objectMap, "cacheNodeName", c.CacheNodeName) + populate(objectMap, "category", c.Category) + populate(objectMap, "cidrCsv", c.CidrCSV) + populateDateTimeRFC3339(objectMap, "cidrCsvLastUpdateTime", c.CidrCSVLastUpdateTime) + populate(objectMap, "cidrSelectionType", c.CidrSelectionType) + populate(objectMap, "clientTenantId", c.ClientTenantID) + populate(objectMap, "configurationState", c.ConfigurationState) + populate(objectMap, "configurationStateText", c.ConfigurationStateText) + populate(objectMap, "containerConfigurations", c.ContainerConfigurations) + populate(objectMap, "containerResyncTrigger", c.ContainerResyncTrigger) + populate(objectMap, "createAsyncOperationId", c.CreateAsyncOperationID) + populate(objectMap, "customerAsn", c.CustomerAsn) + populate(objectMap, "customerId", c.CustomerID) + populate(objectMap, "customerIndex", c.CustomerIndex) + populate(objectMap, "customerName", c.CustomerName) + populate(objectMap, "deleteAsyncOperationId", c.DeleteAsyncOperationID) + populate(objectMap, "fullyQualifiedDomainName", c.FullyQualifiedDomainName) + populate(objectMap, "fullyQualifiedResourceId", c.FullyQualifiedResourceID) + populate(objectMap, "ipAddress", c.IPAddress) + populate(objectMap, "imageUri", c.ImageURI) + populate(objectMap, "isEnabled", c.IsEnabled) + populate(objectMap, "isEnterpriseManaged", c.IsEnterpriseManaged) + populate(objectMap, "isFrozen", c.IsFrozen) + populateDateTimeRFC3339(objectMap, "lastSyncWithAzureTimestamp", c.LastSyncWithAzureTimestamp) + populateDateTimeRFC3339(objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) + populate(objectMap, "maxAllowableEgressInMbps", c.MaxAllowableEgressInMbps) + populate(objectMap, "maxAllowableProbability", c.MaxAllowableProbability) + populate(objectMap, "releaseVersion", c.ReleaseVersion) + populate(objectMap, "reviewFeedback", c.ReviewFeedback) + populate(objectMap, "reviewState", c.ReviewState) + populate(objectMap, "reviewStateText", c.ReviewStateText) + populate(objectMap, "shouldMigrate", c.ShouldMigrate) + populate(objectMap, "synchWithAzureAttemptsCount", c.SynchWithAzureAttemptsCount) + populate(objectMap, "workerConnections", c.WorkerConnections) + populateDateTimeRFC3339(objectMap, "workerConnectionsLastUpdatedDateTime", c.WorkerConnectionsLastUpdatedDateTime) + populate(objectMap, "xCid", c.XCid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodeEntity. +func (c *CacheNodeEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressSpace": + err = unpopulate(val, "AddressSpace", &c.AddressSpace) + delete(rawMsg, key) + case "autoUpdateRequestedDay": + err = unpopulate(val, "AutoUpdateRequestedDay", &c.AutoUpdateRequestedDay) + delete(rawMsg, key) + case "autoUpdateRequestedTime": + err = unpopulate(val, "AutoUpdateRequestedTime", &c.AutoUpdateRequestedTime) + delete(rawMsg, key) + case "autoUpdateRequestedWeek": + err = unpopulate(val, "AutoUpdateRequestedWeek", &c.AutoUpdateRequestedWeek) + delete(rawMsg, key) + case "autoUpdateRingType": + err = unpopulate(val, "AutoUpdateRingType", &c.AutoUpdateRingType) + delete(rawMsg, key) + case "bgpAddressSpace": + err = unpopulate(val, "BgpAddressSpace", &c.BgpAddressSpace) + delete(rawMsg, key) + case "bgpCidrBlocksCount": + err = unpopulate(val, "BgpCidrBlocksCount", &c.BgpCidrBlocksCount) + delete(rawMsg, key) + case "bgpCidrCsvLastUpdateTime": + err = unpopulateDateTimeRFC3339(val, "BgpCidrCSVLastUpdateTime", &c.BgpCidrCSVLastUpdateTime) + delete(rawMsg, key) + case "bgpFileBytesTruncated": + err = unpopulate(val, "BgpFileBytesTruncated", &c.BgpFileBytesTruncated) + delete(rawMsg, key) + case "bgpLastReportedTime": + err = unpopulateDateTimeRFC3339(val, "BgpLastReportedTime", &c.BgpLastReportedTime) + delete(rawMsg, key) + case "bgpNumberOfRecords": + err = unpopulate(val, "BgpNumberOfRecords", &c.BgpNumberOfRecords) + delete(rawMsg, key) + case "bgpNumberOfTimesUpdated": + err = unpopulate(val, "BgpNumberOfTimesUpdated", &c.BgpNumberOfTimesUpdated) + delete(rawMsg, key) + case "bgpReviewFeedback": + err = unpopulate(val, "BgpReviewFeedback", &c.BgpReviewFeedback) + delete(rawMsg, key) + case "bgpReviewState": + err = unpopulate(val, "BgpReviewState", &c.BgpReviewState) + delete(rawMsg, key) + case "bgpReviewStateText": + err = unpopulate(val, "BgpReviewStateText", &c.BgpReviewStateText) + delete(rawMsg, key) + case "cacheNodeId": + err = unpopulate(val, "CacheNodeID", &c.CacheNodeID) + delete(rawMsg, key) + case "cacheNodeName": + err = unpopulate(val, "CacheNodeName", &c.CacheNodeName) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &c.Category) + delete(rawMsg, key) + case "cidrCsv": + err = unpopulate(val, "CidrCSV", &c.CidrCSV) + delete(rawMsg, key) + case "cidrCsvLastUpdateTime": + err = unpopulateDateTimeRFC3339(val, "CidrCSVLastUpdateTime", &c.CidrCSVLastUpdateTime) + delete(rawMsg, key) + case "cidrSelectionType": + err = unpopulate(val, "CidrSelectionType", &c.CidrSelectionType) + delete(rawMsg, key) + case "clientTenantId": + err = unpopulate(val, "ClientTenantID", &c.ClientTenantID) + delete(rawMsg, key) + case "configurationState": + err = unpopulate(val, "ConfigurationState", &c.ConfigurationState) + delete(rawMsg, key) + case "configurationStateText": + err = unpopulate(val, "ConfigurationStateText", &c.ConfigurationStateText) + delete(rawMsg, key) + case "containerConfigurations": + err = unpopulate(val, "ContainerConfigurations", &c.ContainerConfigurations) + delete(rawMsg, key) + case "containerResyncTrigger": + err = unpopulate(val, "ContainerResyncTrigger", &c.ContainerResyncTrigger) + delete(rawMsg, key) + case "createAsyncOperationId": + err = unpopulate(val, "CreateAsyncOperationID", &c.CreateAsyncOperationID) + delete(rawMsg, key) + case "customerAsn": + err = unpopulate(val, "CustomerAsn", &c.CustomerAsn) + delete(rawMsg, key) + case "customerId": + err = unpopulate(val, "CustomerID", &c.CustomerID) + delete(rawMsg, key) + case "customerIndex": + err = unpopulate(val, "CustomerIndex", &c.CustomerIndex) + delete(rawMsg, key) + case "customerName": + err = unpopulate(val, "CustomerName", &c.CustomerName) + delete(rawMsg, key) + case "deleteAsyncOperationId": + err = unpopulate(val, "DeleteAsyncOperationID", &c.DeleteAsyncOperationID) + delete(rawMsg, key) + case "fullyQualifiedDomainName": + err = unpopulate(val, "FullyQualifiedDomainName", &c.FullyQualifiedDomainName) + delete(rawMsg, key) + case "fullyQualifiedResourceId": + err = unpopulate(val, "FullyQualifiedResourceID", &c.FullyQualifiedResourceID) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &c.IPAddress) + delete(rawMsg, key) + case "imageUri": + err = unpopulate(val, "ImageURI", &c.ImageURI) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &c.IsEnabled) + delete(rawMsg, key) + case "isEnterpriseManaged": + err = unpopulate(val, "IsEnterpriseManaged", &c.IsEnterpriseManaged) + delete(rawMsg, key) + case "isFrozen": + err = unpopulate(val, "IsFrozen", &c.IsFrozen) + delete(rawMsg, key) + case "lastSyncWithAzureTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastSyncWithAzureTimestamp", &c.LastSyncWithAzureTimestamp) + delete(rawMsg, key) + case "lastUpdatedTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) + delete(rawMsg, key) + case "maxAllowableEgressInMbps": + err = unpopulate(val, "MaxAllowableEgressInMbps", &c.MaxAllowableEgressInMbps) + delete(rawMsg, key) + case "maxAllowableProbability": + err = unpopulate(val, "MaxAllowableProbability", &c.MaxAllowableProbability) + delete(rawMsg, key) + case "releaseVersion": + err = unpopulate(val, "ReleaseVersion", &c.ReleaseVersion) + delete(rawMsg, key) + case "reviewFeedback": + err = unpopulate(val, "ReviewFeedback", &c.ReviewFeedback) + delete(rawMsg, key) + case "reviewState": + err = unpopulate(val, "ReviewState", &c.ReviewState) + delete(rawMsg, key) + case "reviewStateText": + err = unpopulate(val, "ReviewStateText", &c.ReviewStateText) + delete(rawMsg, key) + case "shouldMigrate": + err = unpopulate(val, "ShouldMigrate", &c.ShouldMigrate) + delete(rawMsg, key) + case "synchWithAzureAttemptsCount": + err = unpopulate(val, "SynchWithAzureAttemptsCount", &c.SynchWithAzureAttemptsCount) + delete(rawMsg, key) + case "workerConnections": + err = unpopulate(val, "WorkerConnections", &c.WorkerConnections) + delete(rawMsg, key) + case "workerConnectionsLastUpdatedDateTime": + err = unpopulateDateTimeRFC3339(val, "WorkerConnectionsLastUpdatedDateTime", &c.WorkerConnectionsLastUpdatedDateTime) + delete(rawMsg, key) + case "xCid": + err = unpopulate(val, "XCid", &c.XCid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodeInstallProperties. +func (c CacheNodeInstallProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cacheNodeId", c.CacheNodeID) + populate(objectMap, "customerId", c.CustomerID) + populate(objectMap, "primaryAccountKey", c.PrimaryAccountKey) + populate(objectMap, "registrationKey", c.RegistrationKey) + populate(objectMap, "secondaryAccountKey", c.SecondaryAccountKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodeInstallProperties. +func (c *CacheNodeInstallProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cacheNodeId": + err = unpopulate(val, "CacheNodeID", &c.CacheNodeID) + delete(rawMsg, key) + case "customerId": + err = unpopulate(val, "CustomerID", &c.CustomerID) + delete(rawMsg, key) + case "primaryAccountKey": + err = unpopulate(val, "PrimaryAccountKey", &c.PrimaryAccountKey) + delete(rawMsg, key) + case "registrationKey": + err = unpopulate(val, "RegistrationKey", &c.RegistrationKey) + delete(rawMsg, key) + case "secondaryAccountKey": + err = unpopulate(val, "SecondaryAccountKey", &c.SecondaryAccountKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodeOldResponse. +func (c CacheNodeOldResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", c.Error) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "status", c.Status) + populate(objectMap, "statusCode", c.StatusCode) + populate(objectMap, "statusDetails", c.StatusDetails) + populate(objectMap, "statusText", c.StatusText) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodeOldResponse. +func (c *CacheNodeOldResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "statusCode": + err = unpopulate(val, "StatusCode", &c.StatusCode) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &c.StatusDetails) + delete(rawMsg, key) + case "statusText": + err = unpopulate(val, "StatusText", &c.StatusText) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodePreviewResource. +func (c CacheNodePreviewResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodePreviewResource. +func (c *CacheNodePreviewResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodePreviewResourceListResult. +func (c CacheNodePreviewResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodePreviewResourceListResult. +func (c *CacheNodePreviewResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodeProperty. +func (c CacheNodeProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalCacheNodeProperties", c.AdditionalCacheNodeProperties) + populate(objectMap, "cacheNode", c.CacheNode) + populate(objectMap, "error", c.Error) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "status", c.Status) + populate(objectMap, "statusCode", c.StatusCode) + populate(objectMap, "statusDetails", c.StatusDetails) + populate(objectMap, "statusText", c.StatusText) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodeProperty. +func (c *CacheNodeProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalCacheNodeProperties": + err = unpopulate(val, "AdditionalCacheNodeProperties", &c.AdditionalCacheNodeProperties) + delete(rawMsg, key) + case "cacheNode": + err = unpopulate(val, "CacheNode", &c.CacheNode) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "statusCode": + err = unpopulate(val, "StatusCode", &c.StatusCode) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &c.StatusDetails) + delete(rawMsg, key) + case "statusText": + err = unpopulate(val, "StatusText", &c.StatusText) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomerEntity. +func (c CustomerEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientTenantId", c.ClientTenantID) + populate(objectMap, "contactEmail", c.ContactEmail) + populate(objectMap, "contactName", c.ContactName) + populate(objectMap, "contactPhone", c.ContactPhone) + populate(objectMap, "createAsyncOperationId", c.CreateAsyncOperationID) + populate(objectMap, "customerId", c.CustomerID) + populate(objectMap, "customerName", c.CustomerName) + populate(objectMap, "deleteAsyncOperationId", c.DeleteAsyncOperationID) + populate(objectMap, "fullyQualifiedResourceId", c.FullyQualifiedResourceID) + populate(objectMap, "isEnterpriseManaged", c.IsEnterpriseManaged) + populate(objectMap, "isEntitled", c.IsEntitled) + populateDateTimeRFC3339(objectMap, "lastSyncWithAzureTimestamp", c.LastSyncWithAzureTimestamp) + populate(objectMap, "releaseVersion", c.ReleaseVersion) + populate(objectMap, "resendSignupCode", c.ResendSignupCode) + populate(objectMap, "shouldMigrate", c.ShouldMigrate) + populate(objectMap, "synchWithAzureAttemptsCount", c.SynchWithAzureAttemptsCount) + populate(objectMap, "verifySignupCode", c.VerifySignupCode) + populate(objectMap, "verifySignupPhrase", c.VerifySignupPhrase) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerEntity. +func (c *CustomerEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientTenantId": + err = unpopulate(val, "ClientTenantID", &c.ClientTenantID) + delete(rawMsg, key) + case "contactEmail": + err = unpopulate(val, "ContactEmail", &c.ContactEmail) + delete(rawMsg, key) + case "contactName": + err = unpopulate(val, "ContactName", &c.ContactName) + delete(rawMsg, key) + case "contactPhone": + err = unpopulate(val, "ContactPhone", &c.ContactPhone) + delete(rawMsg, key) + case "createAsyncOperationId": + err = unpopulate(val, "CreateAsyncOperationID", &c.CreateAsyncOperationID) + delete(rawMsg, key) + case "customerId": + err = unpopulate(val, "CustomerID", &c.CustomerID) + delete(rawMsg, key) + case "customerName": + err = unpopulate(val, "CustomerName", &c.CustomerName) + delete(rawMsg, key) + case "deleteAsyncOperationId": + err = unpopulate(val, "DeleteAsyncOperationID", &c.DeleteAsyncOperationID) + delete(rawMsg, key) + case "fullyQualifiedResourceId": + err = unpopulate(val, "FullyQualifiedResourceID", &c.FullyQualifiedResourceID) + delete(rawMsg, key) + case "isEnterpriseManaged": + err = unpopulate(val, "IsEnterpriseManaged", &c.IsEnterpriseManaged) + delete(rawMsg, key) + case "isEntitled": + err = unpopulate(val, "IsEntitled", &c.IsEntitled) + delete(rawMsg, key) + case "lastSyncWithAzureTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastSyncWithAzureTimestamp", &c.LastSyncWithAzureTimestamp) + delete(rawMsg, key) + case "releaseVersion": + err = unpopulate(val, "ReleaseVersion", &c.ReleaseVersion) + delete(rawMsg, key) + case "resendSignupCode": + err = unpopulate(val, "ResendSignupCode", &c.ResendSignupCode) + delete(rawMsg, key) + case "shouldMigrate": + err = unpopulate(val, "ShouldMigrate", &c.ShouldMigrate) + delete(rawMsg, key) + case "synchWithAzureAttemptsCount": + err = unpopulate(val, "SynchWithAzureAttemptsCount", &c.SynchWithAzureAttemptsCount) + delete(rawMsg, key) + case "verifySignupCode": + err = unpopulate(val, "VerifySignupCode", &c.VerifySignupCode) + delete(rawMsg, key) + case "verifySignupPhrase": + err = unpopulate(val, "VerifySignupPhrase", &c.VerifySignupPhrase) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomerProperty. +func (c CustomerProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalCustomerProperties", c.AdditionalCustomerProperties) + populate(objectMap, "customer", c.Customer) + populate(objectMap, "error", c.Error) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "status", c.Status) + populate(objectMap, "statusCode", c.StatusCode) + populate(objectMap, "statusDetails", c.StatusDetails) + populate(objectMap, "statusText", c.StatusText) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerProperty. +func (c *CustomerProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalCustomerProperties": + err = unpopulate(val, "AdditionalCustomerProperties", &c.AdditionalCustomerProperties) + delete(rawMsg, key) + case "customer": + err = unpopulate(val, "Customer", &c.Customer) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "statusCode": + err = unpopulate(val, "StatusCode", &c.StatusCode) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &c.StatusDetails) + delete(rawMsg, key) + case "statusText": + err = unpopulate(val, "StatusText", &c.StatusText) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterpriseMccCacheNodeResource. +func (e EnterpriseMccCacheNodeResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterpriseMccCacheNodeResource. +func (e *EnterpriseMccCacheNodeResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterpriseMccCacheNodeResourceListResult. +func (e EnterpriseMccCacheNodeResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterpriseMccCacheNodeResourceListResult. +func (e *EnterpriseMccCacheNodeResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterpriseMccCustomerResource. +func (e EnterpriseMccCustomerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterpriseMccCustomerResource. +func (e *EnterpriseMccCustomerResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterpriseMccCustomerResourceListResult. +func (e EnterpriseMccCustomerResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterpriseMccCustomerResourceListResult. +func (e *EnterpriseMccCustomerResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterprisePreviewResource. +func (e EnterprisePreviewResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterprisePreviewResource. +func (e *EnterprisePreviewResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterprisePreviewResourceListResult. +func (e EnterprisePreviewResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterprisePreviewResourceListResult. +func (e *EnterprisePreviewResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IspCacheNodeResource. +func (i IspCacheNodeResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "location", i.Location) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IspCacheNodeResource. +func (i *IspCacheNodeResource) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IspCacheNodeResourceListResult. +func (i IspCacheNodeResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IspCacheNodeResourceListResult. +func (i *IspCacheNodeResourceListResult) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IspCustomerResource. +func (i IspCustomerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "location", i.Location) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IspCustomerResource. +func (i *IspCustomerResource) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IspCustomerResourceListResult. +func (i IspCustomerResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IspCustomerResourceListResult. +func (i *IspCustomerResourceListResult) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MccCacheNodeBgpCidrDetails. +func (m MccCacheNodeBgpCidrDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MccCacheNodeBgpCidrDetails. +func (m *MccCacheNodeBgpCidrDetails) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MccCacheNodeInstallDetails. +func (m MccCacheNodeInstallDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MccCacheNodeInstallDetails. +func (m *MccCacheNodeInstallDetails) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchResource. +func (p PatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchResource. +func (p *PatchResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyURLConfiguration. +func (p ProxyURLConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "proxyUrl", p.ProxyURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyURLConfiguration. +func (p *ProxyURLConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "proxyUrl": + err = unpopulate(val, "ProxyURL", &p.ProxyURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/operations_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/operations_client.go new file mode 100644 index 000000000000..0099d85a32aa --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/operations_client.go @@ -0,0 +1,84 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +import ( + "context" + "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" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2023-05-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]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ConnectedCache/operations" + 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", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/operations_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/operations_client_example_test.go new file mode 100644 index 000000000000..dbee9b83e9bc --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/operations_client_example_test.go @@ -0,0 +1,56 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache" + "log" +) + +// Generated from example definition: 2023-05-01-preview/Operations_List_MaximumSet_Gen.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 := armconnectedcache.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(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 = armconnectedcache.OperationsClientListResponse{ + // OperationListResult: armconnectedcache.OperationListResult{ + // Value: []*armconnectedcache.Operation{ + // { + // Name: to.Ptr("operationName"), + // Display: &armconnectedcache.OperationDisplay{ + // Provider: to.Ptr("providerName"), + // Resource: to.Ptr("resourceName"), + // Operation: to.Ptr("operationName"), + // Description: to.Ptr("zkcugoxocugvzcsedehxwbxiuvrb"), + // }, + // IsDataAction: to.Ptr(true), + // Origin: to.Ptr(armconnectedcache.OriginUser), + // ActionType: to.Ptr(armconnectedcache.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/options.go b/sdk/resourcemanager/connectedcache/armconnectedcache/options.go new file mode 100644 index 000000000000..ace5356a6a0d --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/options.go @@ -0,0 +1,234 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +// CacheNodesOperationsClientBeginCreateorUpdateOptions contains the optional parameters for the CacheNodesOperationsClient.BeginCreateorUpdate +// method. +type CacheNodesOperationsClientBeginCreateorUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// CacheNodesOperationsClientDeleteOptions contains the optional parameters for the CacheNodesOperationsClient.Delete method. +type CacheNodesOperationsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// CacheNodesOperationsClientGetOptions contains the optional parameters for the CacheNodesOperationsClient.Get method. +type CacheNodesOperationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// CacheNodesOperationsClientListByResourceGroupOptions contains the optional parameters for the CacheNodesOperationsClient.NewListByResourceGroupPager +// method. +type CacheNodesOperationsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// CacheNodesOperationsClientListBySubscriptionOptions contains the optional parameters for the CacheNodesOperationsClient.NewListBySubscriptionPager +// method. +type CacheNodesOperationsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// CacheNodesOperationsClientUpdateOptions contains the optional parameters for the CacheNodesOperationsClient.Update method. +type CacheNodesOperationsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.BeginCreateOrUpdate +// method. +type EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EnterpriseCustomerOperationsClientDeleteOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.Delete +// method. +type EnterpriseCustomerOperationsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseCustomerOperationsClientGetOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.Get +// method. +type EnterpriseCustomerOperationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseCustomerOperationsClientListByResourceGroupOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.NewListByResourceGroupPager +// method. +type EnterpriseCustomerOperationsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseCustomerOperationsClientListBySubscriptionOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.NewListBySubscriptionPager +// method. +type EnterpriseCustomerOperationsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseCustomerOperationsClientUpdateOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.Update +// method. +type EnterpriseCustomerOperationsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.BeginCreateOrUpdate +// method. +type EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.BeginDelete +// method. +type EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.GetCacheNodeInstallDetails +// method. +type EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCacheNodesOperationsClientGetOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.Get +// method. +type EnterpriseMccCacheNodesOperationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceOptions contains the optional parameters for +// the EnterpriseMccCacheNodesOperationsClient.NewListByEnterpriseMccCustomerResourcePager method. +type EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCacheNodesOperationsClientUpdateOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.Update +// method. +type EnterpriseMccCacheNodesOperationsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCustomersClientBeginCreateOrUpdateOptions contains the optional parameters for the EnterpriseMccCustomersClient.BeginCreateOrUpdate +// method. +type EnterpriseMccCustomersClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EnterpriseMccCustomersClientBeginDeleteOptions contains the optional parameters for the EnterpriseMccCustomersClient.BeginDelete +// method. +type EnterpriseMccCustomersClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EnterpriseMccCustomersClientGetOptions contains the optional parameters for the EnterpriseMccCustomersClient.Get method. +type EnterpriseMccCustomersClientGetOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCustomersClientListByResourceGroupOptions contains the optional parameters for the EnterpriseMccCustomersClient.NewListByResourceGroupPager +// method. +type EnterpriseMccCustomersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCustomersClientListBySubscriptionOptions contains the optional parameters for the EnterpriseMccCustomersClient.NewListBySubscriptionPager +// method. +type EnterpriseMccCustomersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCustomersClientUpdateOptions contains the optional parameters for the EnterpriseMccCustomersClient.Update +// method. +type EnterpriseMccCustomersClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// IspCacheNodesOperationsClientBeginCreateOrUpdateOptions contains the optional parameters for the IspCacheNodesOperationsClient.BeginCreateOrUpdate +// method. +type IspCacheNodesOperationsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// IspCacheNodesOperationsClientBeginDeleteOptions contains the optional parameters for the IspCacheNodesOperationsClient.BeginDelete +// method. +type IspCacheNodesOperationsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// IspCacheNodesOperationsClientGetBgpCidrsOptions contains the optional parameters for the IspCacheNodesOperationsClient.GetBgpCidrs +// method. +type IspCacheNodesOperationsClientGetBgpCidrsOptions struct { + // placeholder for future optional parameters +} + +// IspCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions contains the optional parameters for the IspCacheNodesOperationsClient.GetCacheNodeInstallDetails +// method. +type IspCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions struct { + // placeholder for future optional parameters +} + +// IspCacheNodesOperationsClientGetOptions contains the optional parameters for the IspCacheNodesOperationsClient.Get method. +type IspCacheNodesOperationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// IspCacheNodesOperationsClientListByIspCustomerResourceOptions contains the optional parameters for the IspCacheNodesOperationsClient.NewListByIspCustomerResourcePager +// method. +type IspCacheNodesOperationsClientListByIspCustomerResourceOptions struct { + // placeholder for future optional parameters +} + +// IspCacheNodesOperationsClientUpdateOptions contains the optional parameters for the IspCacheNodesOperationsClient.Update +// method. +type IspCacheNodesOperationsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// IspCustomersClientBeginCreateOrUpdateOptions contains the optional parameters for the IspCustomersClient.BeginCreateOrUpdate +// method. +type IspCustomersClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// IspCustomersClientBeginDeleteOptions contains the optional parameters for the IspCustomersClient.BeginDelete method. +type IspCustomersClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// IspCustomersClientGetOptions contains the optional parameters for the IspCustomersClient.Get method. +type IspCustomersClientGetOptions struct { + // placeholder for future optional parameters +} + +// IspCustomersClientListByResourceGroupOptions contains the optional parameters for the IspCustomersClient.NewListByResourceGroupPager +// method. +type IspCustomersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// IspCustomersClientListBySubscriptionOptions contains the optional parameters for the IspCustomersClient.NewListBySubscriptionPager +// method. +type IspCustomersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// IspCustomersClientUpdateOptions contains the optional parameters for the IspCustomersClient.Update method. +type IspCustomersClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/responses.go b/sdk/resourcemanager/connectedcache/armconnectedcache/responses.go new file mode 100644 index 000000000000..501b070cb846 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/responses.go @@ -0,0 +1,230 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +// CacheNodesOperationsClientCreateorUpdateResponse contains the response from method CacheNodesOperationsClient.BeginCreateorUpdate. +type CacheNodesOperationsClientCreateorUpdateResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. + CacheNodePreviewResource +} + +// CacheNodesOperationsClientDeleteResponse contains the response from method CacheNodesOperationsClient.Delete. +type CacheNodesOperationsClientDeleteResponse struct { + // placeholder for future response values +} + +// CacheNodesOperationsClientGetResponse contains the response from method CacheNodesOperationsClient.Get. +type CacheNodesOperationsClientGetResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. + CacheNodePreviewResource +} + +// CacheNodesOperationsClientListByResourceGroupResponse contains the response from method CacheNodesOperationsClient.NewListByResourceGroupPager. +type CacheNodesOperationsClientListByResourceGroupResponse struct { + // The response of a CacheNodePreviewResource list operation. + CacheNodePreviewResourceListResult +} + +// CacheNodesOperationsClientListBySubscriptionResponse contains the response from method CacheNodesOperationsClient.NewListBySubscriptionPager. +type CacheNodesOperationsClientListBySubscriptionResponse struct { + // The response of a CacheNodePreviewResource list operation. + CacheNodePreviewResourceListResult +} + +// CacheNodesOperationsClientUpdateResponse contains the response from method CacheNodesOperationsClient.Update. +type CacheNodesOperationsClientUpdateResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. + CacheNodePreviewResource +} + +// EnterpriseCustomerOperationsClientCreateOrUpdateResponse contains the response from method EnterpriseCustomerOperationsClient.BeginCreateOrUpdate. +type EnterpriseCustomerOperationsClientCreateOrUpdateResponse struct { + // ConnectedCache Resource. Represents the high level Nodes needed to provision CacheNode and customer resources used in private + // preview + EnterprisePreviewResource +} + +// EnterpriseCustomerOperationsClientDeleteResponse contains the response from method EnterpriseCustomerOperationsClient.Delete. +type EnterpriseCustomerOperationsClientDeleteResponse struct { + // placeholder for future response values +} + +// EnterpriseCustomerOperationsClientGetResponse contains the response from method EnterpriseCustomerOperationsClient.Get. +type EnterpriseCustomerOperationsClientGetResponse struct { + // ConnectedCache Resource. Represents the high level Nodes needed to provision CacheNode and customer resources used in private + // preview + EnterprisePreviewResource +} + +// EnterpriseCustomerOperationsClientListByResourceGroupResponse contains the response from method EnterpriseCustomerOperationsClient.NewListByResourceGroupPager. +type EnterpriseCustomerOperationsClientListByResourceGroupResponse struct { + // The response of a EnterprisePreviewResource list operation. + EnterprisePreviewResourceListResult +} + +// EnterpriseCustomerOperationsClientListBySubscriptionResponse contains the response from method EnterpriseCustomerOperationsClient.NewListBySubscriptionPager. +type EnterpriseCustomerOperationsClientListBySubscriptionResponse struct { + // The response of a EnterprisePreviewResource list operation. + EnterprisePreviewResourceListResult +} + +// EnterpriseCustomerOperationsClientUpdateResponse contains the response from method EnterpriseCustomerOperationsClient.Update. +type EnterpriseCustomerOperationsClientUpdateResponse struct { + // ConnectedCache Resource. Represents the high level Nodes needed to provision CacheNode and customer resources used in private + // preview + EnterprisePreviewResource +} + +// EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse contains the response from method EnterpriseMccCacheNodesOperationsClient.BeginCreateOrUpdate. +type EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse struct { + // Represents the high level Nodes needed to provision cache node resources + EnterpriseMccCacheNodeResource +} + +// EnterpriseMccCacheNodesOperationsClientDeleteResponse contains the response from method EnterpriseMccCacheNodesOperationsClient.BeginDelete. +type EnterpriseMccCacheNodesOperationsClientDeleteResponse struct { + // placeholder for future response values +} + +// EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse contains the response from method EnterpriseMccCacheNodesOperationsClient.GetCacheNodeInstallDetails. +type EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse struct { + // Mcc cache node resource all install details. + MccCacheNodeInstallDetails +} + +// EnterpriseMccCacheNodesOperationsClientGetResponse contains the response from method EnterpriseMccCacheNodesOperationsClient.Get. +type EnterpriseMccCacheNodesOperationsClientGetResponse struct { + // Represents the high level Nodes needed to provision cache node resources + EnterpriseMccCacheNodeResource +} + +// EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse contains the response from method EnterpriseMccCacheNodesOperationsClient.NewListByEnterpriseMccCustomerResourcePager. +type EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse struct { + // The response of a EnterpriseMccCacheNodeResource list operation. + EnterpriseMccCacheNodeResourceListResult +} + +// EnterpriseMccCacheNodesOperationsClientUpdateResponse contains the response from method EnterpriseMccCacheNodesOperationsClient.Update. +type EnterpriseMccCacheNodesOperationsClientUpdateResponse struct { + // Represents the high level Nodes needed to provision cache node resources + EnterpriseMccCacheNodeResource +} + +// EnterpriseMccCustomersClientCreateOrUpdateResponse contains the response from method EnterpriseMccCustomersClient.BeginCreateOrUpdate. +type EnterpriseMccCustomersClientCreateOrUpdateResponse struct { + // Represents the high level Nodes needed to provision customer resources + EnterpriseMccCustomerResource +} + +// EnterpriseMccCustomersClientDeleteResponse contains the response from method EnterpriseMccCustomersClient.BeginDelete. +type EnterpriseMccCustomersClientDeleteResponse struct { + // placeholder for future response values +} + +// EnterpriseMccCustomersClientGetResponse contains the response from method EnterpriseMccCustomersClient.Get. +type EnterpriseMccCustomersClientGetResponse struct { + // Represents the high level Nodes needed to provision customer resources + EnterpriseMccCustomerResource +} + +// EnterpriseMccCustomersClientListByResourceGroupResponse contains the response from method EnterpriseMccCustomersClient.NewListByResourceGroupPager. +type EnterpriseMccCustomersClientListByResourceGroupResponse struct { + // The response of a EnterpriseMccCustomerResource list operation. + EnterpriseMccCustomerResourceListResult +} + +// EnterpriseMccCustomersClientListBySubscriptionResponse contains the response from method EnterpriseMccCustomersClient.NewListBySubscriptionPager. +type EnterpriseMccCustomersClientListBySubscriptionResponse struct { + // The response of a EnterpriseMccCustomerResource list operation. + EnterpriseMccCustomerResourceListResult +} + +// EnterpriseMccCustomersClientUpdateResponse contains the response from method EnterpriseMccCustomersClient.Update. +type EnterpriseMccCustomersClientUpdateResponse struct { + // Represents the high level Nodes needed to provision customer resources + EnterpriseMccCustomerResource +} + +// IspCacheNodesOperationsClientCreateOrUpdateResponse contains the response from method IspCacheNodesOperationsClient.BeginCreateOrUpdate. +type IspCacheNodesOperationsClientCreateOrUpdateResponse struct { + // Represents the high level Nodes needed to provision cache node resources + IspCacheNodeResource +} + +// IspCacheNodesOperationsClientDeleteResponse contains the response from method IspCacheNodesOperationsClient.BeginDelete. +type IspCacheNodesOperationsClientDeleteResponse struct { + // placeholder for future response values +} + +// IspCacheNodesOperationsClientGetBgpCidrsResponse contains the response from method IspCacheNodesOperationsClient.GetBgpCidrs. +type IspCacheNodesOperationsClientGetBgpCidrsResponse struct { + // Represents all Cidr details of the Bgp request for a specific cache node resource + MccCacheNodeBgpCidrDetails +} + +// IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse contains the response from method IspCacheNodesOperationsClient.GetCacheNodeInstallDetails. +type IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse struct { + // Mcc cache node resource all install details. + MccCacheNodeInstallDetails +} + +// IspCacheNodesOperationsClientGetResponse contains the response from method IspCacheNodesOperationsClient.Get. +type IspCacheNodesOperationsClientGetResponse struct { + // Represents the high level Nodes needed to provision cache node resources + IspCacheNodeResource +} + +// IspCacheNodesOperationsClientListByIspCustomerResourceResponse contains the response from method IspCacheNodesOperationsClient.NewListByIspCustomerResourcePager. +type IspCacheNodesOperationsClientListByIspCustomerResourceResponse struct { + // The response of a IspCacheNodeResource list operation. + IspCacheNodeResourceListResult +} + +// IspCacheNodesOperationsClientUpdateResponse contains the response from method IspCacheNodesOperationsClient.Update. +type IspCacheNodesOperationsClientUpdateResponse struct { + // Represents the high level Nodes needed to provision cache node resources + IspCacheNodeResource +} + +// IspCustomersClientCreateOrUpdateResponse contains the response from method IspCustomersClient.BeginCreateOrUpdate. +type IspCustomersClientCreateOrUpdateResponse struct { + // Represents the high level Nodes needed to provision isp customer resources + IspCustomerResource +} + +// IspCustomersClientDeleteResponse contains the response from method IspCustomersClient.BeginDelete. +type IspCustomersClientDeleteResponse struct { + // placeholder for future response values +} + +// IspCustomersClientGetResponse contains the response from method IspCustomersClient.Get. +type IspCustomersClientGetResponse struct { + // Represents the high level Nodes needed to provision isp customer resources + IspCustomerResource +} + +// IspCustomersClientListByResourceGroupResponse contains the response from method IspCustomersClient.NewListByResourceGroupPager. +type IspCustomersClientListByResourceGroupResponse struct { + // The response of a IspCustomerResource list operation. + IspCustomerResourceListResult +} + +// IspCustomersClientListBySubscriptionResponse contains the response from method IspCustomersClient.NewListBySubscriptionPager. +type IspCustomersClientListBySubscriptionResponse struct { + // The response of a IspCustomerResource list operation. + IspCustomerResourceListResult +} + +// IspCustomersClientUpdateResponse contains the response from method IspCustomersClient.Update. +type IspCustomersClientUpdateResponse struct { + // Represents the high level Nodes needed to provision isp customer resources + IspCustomerResource +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/time_rfc3339.go b/sdk/resourcemanager/connectedcache/armconnectedcache/time_rfc3339.go new file mode 100644 index 000000000000..80cd130867ef --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// 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+)*"*$`) + +const ( + 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 + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + 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 { + if len(data) == 0 { + return nil + } + 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)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + 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 + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/tsp-location.yaml b/sdk/resourcemanager/connectedcache/armconnectedcache/tsp-location.yaml new file mode 100644 index 000000000000..1ebce821159f --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/connectedcache/ConnectedCache.Management +commit: d477c7caa09bf82e22c419be0a99d170552b5892 +repo: Azure/azure-rest-api-specs +additionalDirectories: