diff --git a/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/CHANGELOG.md b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/CHANGELOG.md new file mode 100644 index 000000000000..7ef47a9904e1 --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 0.1.0 (2023-10-25) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance` 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/azurelargeinstance/armazurelargeinstance/LICENSE.txt b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/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/azurelargeinstance/armazurelargeinstance/README.md b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/README.md new file mode 100644 index 000000000000..d04181f76e7f --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/README.md @@ -0,0 +1,85 @@ +# Azure Azurelargeinstance Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance) + +The `armazurelargeinstance` module provides operations for working with Azure Azurelargeinstance. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance) + +# 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 Azurelargeinstance module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Azurelargeinstance. 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 Azurelargeinstance 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 := armazurelargeinstance.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 := armazurelargeinstance.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.NewClient() +``` + +## 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 `Azurelargeinstance` 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. \ No newline at end of file diff --git a/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/autorest.md b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/autorest.md new file mode 100644 index 000000000000..6dc47eac17dc --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurelargeinstance/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurelargeinstance/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/azurelargestorageinstance_client.go b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/azurelargestorageinstance_client.go new file mode 100644 index 000000000000..aceb83a87f26 --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/azurelargestorageinstance_client.go @@ -0,0 +1,286 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurelargeinstance + +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" +) + +// AzureLargeStorageInstanceClient contains the methods for the AzureLargeStorageInstance group. +// Don't use this type directly, use NewAzureLargeStorageInstanceClient() instead. +type AzureLargeStorageInstanceClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAzureLargeStorageInstanceClient creates a new instance of AzureLargeStorageInstanceClient 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 NewAzureLargeStorageInstanceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureLargeStorageInstanceClient, error) { + cl, err := arm.NewClient(moduleName+".AzureLargeStorageInstanceClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AzureLargeStorageInstanceClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets an Azure Large Storage instance for the specified subscription, resource group, and instance name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureLargeStorageInstanceName - Name of the AzureLargeStorageInstance. +// - options - AzureLargeStorageInstanceClientGetOptions contains the optional parameters for the AzureLargeStorageInstanceClient.Get +// method. +func (client *AzureLargeStorageInstanceClient) Get(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, options *AzureLargeStorageInstanceClientGetOptions) (AzureLargeStorageInstanceClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, azureLargeStorageInstanceName, options) + if err != nil { + return AzureLargeStorageInstanceClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureLargeStorageInstanceClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AzureLargeStorageInstanceClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AzureLargeStorageInstanceClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, options *AzureLargeStorageInstanceClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances/{azureLargeStorageInstanceName}" + 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 azureLargeStorageInstanceName == "" { + return nil, errors.New("parameter azureLargeStorageInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureLargeStorageInstanceName}", url.PathEscape(azureLargeStorageInstanceName)) + 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-07-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AzureLargeStorageInstanceClient) getHandleResponse(resp *http.Response) (AzureLargeStorageInstanceClientGetResponse, error) { + result := AzureLargeStorageInstanceClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureLargeStorageInstance); err != nil { + return AzureLargeStorageInstanceClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets a list of AzureLargeStorageInstances in the specified subscription and resource group. +// The operations returns various properties of each Azure LargeStorage instance. +// +// Generated from API version 2023-07-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AzureLargeStorageInstanceClientListByResourceGroupOptions contains the optional parameters for the AzureLargeStorageInstanceClient.NewListByResourceGroupPager +// method. +func (client *AzureLargeStorageInstanceClient) NewListByResourceGroupPager(resourceGroupName string, options *AzureLargeStorageInstanceClientListByResourceGroupOptions) *runtime.Pager[AzureLargeStorageInstanceClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureLargeStorageInstanceClientListByResourceGroupResponse]{ + More: func(page AzureLargeStorageInstanceClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AzureLargeStorageInstanceClientListByResourceGroupResponse) (AzureLargeStorageInstanceClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AzureLargeStorageInstanceClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureLargeStorageInstanceClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureLargeStorageInstanceClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *AzureLargeStorageInstanceClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AzureLargeStorageInstanceClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances" + 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-07-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *AzureLargeStorageInstanceClient) listByResourceGroupHandleResponse(resp *http.Response) (AzureLargeStorageInstanceClientListByResourceGroupResponse, error) { + result := AzureLargeStorageInstanceClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureLargeStorageInstanceListResult); err != nil { + return AzureLargeStorageInstanceClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Gets a list of AzureLargeStorageInstances in the specified subscription. The operations returns +// various properties of each Azure LargeStorage instance. +// +// Generated from API version 2023-07-20-preview +// - options - AzureLargeStorageInstanceClientListBySubscriptionOptions contains the optional parameters for the AzureLargeStorageInstanceClient.NewListBySubscriptionPager +// method. +func (client *AzureLargeStorageInstanceClient) NewListBySubscriptionPager(options *AzureLargeStorageInstanceClientListBySubscriptionOptions) *runtime.Pager[AzureLargeStorageInstanceClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureLargeStorageInstanceClientListBySubscriptionResponse]{ + More: func(page AzureLargeStorageInstanceClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AzureLargeStorageInstanceClientListBySubscriptionResponse) (AzureLargeStorageInstanceClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AzureLargeStorageInstanceClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureLargeStorageInstanceClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureLargeStorageInstanceClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *AzureLargeStorageInstanceClient) listBySubscriptionCreateRequest(ctx context.Context, options *AzureLargeStorageInstanceClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances" + 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-07-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *AzureLargeStorageInstanceClient) listBySubscriptionHandleResponse(resp *http.Response) (AzureLargeStorageInstanceClientListBySubscriptionResponse, error) { + result := AzureLargeStorageInstanceClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureLargeStorageInstanceListResult); err != nil { + return AzureLargeStorageInstanceClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Patches the Tags field of a Azure Large Storage Instance for the specified subscription, resource group, and instance +// name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureLargeStorageInstanceName - Name of the AzureLargeStorageInstance. +// - tagsParameter - Request body that only contains the new Tags field +// - options - AzureLargeStorageInstanceClientUpdateOptions contains the optional parameters for the AzureLargeStorageInstanceClient.Update +// method. +func (client *AzureLargeStorageInstanceClient) Update(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, tagsParameter Tags, options *AzureLargeStorageInstanceClientUpdateOptions) (AzureLargeStorageInstanceClientUpdateResponse, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, azureLargeStorageInstanceName, tagsParameter, options) + if err != nil { + return AzureLargeStorageInstanceClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureLargeStorageInstanceClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AzureLargeStorageInstanceClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *AzureLargeStorageInstanceClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, tagsParameter Tags, options *AzureLargeStorageInstanceClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances/{azureLargeStorageInstanceName}" + 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 azureLargeStorageInstanceName == "" { + return nil, errors.New("parameter azureLargeStorageInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureLargeStorageInstanceName}", url.PathEscape(azureLargeStorageInstanceName)) + 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-07-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, tagsParameter); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *AzureLargeStorageInstanceClient) updateHandleResponse(resp *http.Response) (AzureLargeStorageInstanceClientUpdateResponse, error) { + result := AzureLargeStorageInstanceClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureLargeStorageInstance); err != nil { + return AzureLargeStorageInstanceClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/build.go b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/build.go new file mode 100644 index 000000000000..4ab6ef2a21ba --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/azurelargeinstance/armazurelargeinstance + +package armazurelargeinstance diff --git a/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/ci.yml b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/ci.yml new file mode 100644 index 000000000000..934439e87c98 --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/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/azurelargeinstance/armazurelargeinstance/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/azurelargeinstance/armazurelargeinstance' diff --git a/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/client.go b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/client.go new file mode 100644 index 000000000000..f1efe73edace --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/client.go @@ -0,0 +1,487 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurelargeinstance + +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" +) + +// Client contains the methods for the AzureLargeInstance group. +// Don't use this type directly, use NewClient() instead. +type Client struct { + internal *arm.Client + subscriptionID string +} + +// NewClient creates a new instance of Client 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 NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { + cl, err := arm.NewClient(moduleName+".Client", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &Client{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets an Azure Large Instance for the specified subscription, resource group, and instance name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureLargeInstanceName - Name of the AzureLargeInstance. +// - options - ClientGetOptions contains the optional parameters for the Client.Get method. +func (client *Client) Get(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *ClientGetOptions) (ClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, azureLargeInstanceName, options) + if err != nil { + return ClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *ClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}" + 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 azureLargeInstanceName == "" { + return nil, errors.New("parameter azureLargeInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureLargeInstanceName}", url.PathEscape(azureLargeInstanceName)) + 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-07-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, error) { + result := ClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureLargeInstance); err != nil { + return ClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets a list of Azure Large Instances in the specified subscription and resource group. The +// operations returns various properties of each Azure Large Instance. +// +// Generated from API version 2023-07-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager +// method. +func (client *Client) NewListByResourceGroupPager(resourceGroupName string, options *ClientListByResourceGroupOptions) *runtime.Pager[ClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ClientListByResourceGroupResponse]{ + More: func(page ClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClientListByResourceGroupResponse) (ClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances" + 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-07-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (ClientListByResourceGroupResponse, error) { + result := ClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListResult); err != nil { + return ClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Gets a list of Azure Large Instances in the specified subscription. The operations returns +// various properties of each Azure Large Instance. +// +// Generated from API version 2023-07-20-preview +// - options - ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. +func (client *Client) NewListBySubscriptionPager(options *ClientListBySubscriptionOptions) *runtime.Pager[ClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ClientListBySubscriptionResponse]{ + More: func(page ClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClientListBySubscriptionResponse) (ClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *Client) listBySubscriptionCreateRequest(ctx context.Context, options *ClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureLargeInstance/azureLargeInstances" + 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-07-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *Client) listBySubscriptionHandleResponse(resp *http.Response) (ClientListBySubscriptionResponse, error) { + result := ClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListResult); err != nil { + return ClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginRestart - The operation to restart an Azure Large Instance (only for compute instances) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureLargeInstanceName - Name of the AzureLargeInstance. +// - options - ClientBeginRestartOptions contains the optional parameters for the Client.BeginRestart method. +func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *ClientBeginRestartOptions) (*runtime.Poller[ClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, azureLargeInstanceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientRestartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ClientRestartResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Restart - The operation to restart an Azure Large Instance (only for compute instances) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-20-preview +func (client *Client) restart(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *ClientBeginRestartOptions) (*http.Response, error) { + var err error + req, err := client.restartCreateRequest(ctx, resourceGroupName, azureLargeInstanceName, 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.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *ClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/restart" + 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 azureLargeInstanceName == "" { + return nil, errors.New("parameter azureLargeInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureLargeInstanceName}", url.PathEscape(azureLargeInstanceName)) + 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-07-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.ForceParameter != nil { + if err := runtime.MarshalAsJSON(req, *options.ForceParameter); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// BeginShutdown - The operation to shutdown an Azure Large Instance (only for compute instances) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureLargeInstanceName - Name of the AzureLargeInstance. +// - options - ClientBeginShutdownOptions contains the optional parameters for the Client.BeginShutdown method. +func (client *Client) BeginShutdown(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *ClientBeginShutdownOptions) (*runtime.Poller[ClientShutdownResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.shutdown(ctx, resourceGroupName, azureLargeInstanceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientShutdownResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ClientShutdownResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Shutdown - The operation to shutdown an Azure Large Instance (only for compute instances) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-20-preview +func (client *Client) shutdown(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *ClientBeginShutdownOptions) (*http.Response, error) { + var err error + req, err := client.shutdownCreateRequest(ctx, resourceGroupName, azureLargeInstanceName, 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.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// shutdownCreateRequest creates the Shutdown request. +func (client *Client) shutdownCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *ClientBeginShutdownOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/shutdown" + 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 azureLargeInstanceName == "" { + return nil, errors.New("parameter azureLargeInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureLargeInstanceName}", url.PathEscape(azureLargeInstanceName)) + 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-07-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStart - The operation to start an Azure Large Instance (only for compute instances) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureLargeInstanceName - Name of the AzureLargeInstance. +// - options - ClientBeginStartOptions contains the optional parameters for the Client.BeginStart method. +func (client *Client) BeginStart(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *ClientBeginStartOptions) (*runtime.Poller[ClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, azureLargeInstanceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Start - The operation to start an Azure Large Instance (only for compute instances) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-20-preview +func (client *Client) start(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *ClientBeginStartOptions) (*http.Response, error) { + var err error + req, err := client.startCreateRequest(ctx, resourceGroupName, azureLargeInstanceName, 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.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// startCreateRequest creates the Start request. +func (client *Client) startCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *ClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/start" + 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 azureLargeInstanceName == "" { + return nil, errors.New("parameter azureLargeInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureLargeInstanceName}", url.PathEscape(azureLargeInstanceName)) + 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-07-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Update - Patches the Tags field of an Azure Large Instance for the specified subscription, resource group, and instance +// name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureLargeInstanceName - Name of the AzureLargeInstance. +// - tagsParameter - Request body that only contains the new Tags field +// - options - ClientUpdateOptions contains the optional parameters for the Client.Update method. +func (client *Client) Update(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, tagsParameter Tags, options *ClientUpdateOptions) (ClientUpdateResponse, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, azureLargeInstanceName, tagsParameter, options) + if err != nil { + return ClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, tagsParameter Tags, options *ClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}" + 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 azureLargeInstanceName == "" { + return nil, errors.New("parameter azureLargeInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureLargeInstanceName}", url.PathEscape(azureLargeInstanceName)) + 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-07-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, tagsParameter); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *Client) updateHandleResponse(resp *http.Response) (ClientUpdateResponse, error) { + result := ClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureLargeInstance); err != nil { + return ClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/client_factory.go b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/client_factory.go new file mode 100644 index 000000000000..9818128af6b2 --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/client_factory.go @@ -0,0 +1,53 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurelargeinstance + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. 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) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewAzureLargeStorageInstanceClient() *AzureLargeStorageInstanceClient { + subClient, _ := NewAzureLargeStorageInstanceClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewClient() *Client { + subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/constants.go b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/constants.go new file mode 100644 index 000000000000..86964c90bc12 --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/constants.go @@ -0,0 +1,283 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurelargeinstance + +const ( + moduleName = "armazurelargeinstance" + moduleVersion = "v0.1.0" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// AzureLargeInstanceForcePowerState - Whether to force restart by shutting all processes. +type AzureLargeInstanceForcePowerState string + +const ( + AzureLargeInstanceForcePowerStateActive AzureLargeInstanceForcePowerState = "active" + AzureLargeInstanceForcePowerStateInactive AzureLargeInstanceForcePowerState = "inactive" +) + +// PossibleAzureLargeInstanceForcePowerStateValues returns the possible values for the AzureLargeInstanceForcePowerState const type. +func PossibleAzureLargeInstanceForcePowerStateValues() []AzureLargeInstanceForcePowerState { + return []AzureLargeInstanceForcePowerState{ + AzureLargeInstanceForcePowerStateActive, + AzureLargeInstanceForcePowerStateInactive, + } +} + +// AzureLargeInstanceHardwareTypeNamesEnum - Name of the hardware type (vendor and/or their product name) +type AzureLargeInstanceHardwareTypeNamesEnum string + +const ( + AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS AzureLargeInstanceHardwareTypeNamesEnum = "Cisco_UCS" + AzureLargeInstanceHardwareTypeNamesEnumHPE AzureLargeInstanceHardwareTypeNamesEnum = "HPE" + AzureLargeInstanceHardwareTypeNamesEnumSDFLEX AzureLargeInstanceHardwareTypeNamesEnum = "SDFLEX" +) + +// PossibleAzureLargeInstanceHardwareTypeNamesEnumValues returns the possible values for the AzureLargeInstanceHardwareTypeNamesEnum const type. +func PossibleAzureLargeInstanceHardwareTypeNamesEnumValues() []AzureLargeInstanceHardwareTypeNamesEnum { + return []AzureLargeInstanceHardwareTypeNamesEnum{ + AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS, + AzureLargeInstanceHardwareTypeNamesEnumHPE, + AzureLargeInstanceHardwareTypeNamesEnumSDFLEX, + } +} + +// AzureLargeInstancePowerStateEnum - Resource power state +type AzureLargeInstancePowerStateEnum string + +const ( + AzureLargeInstancePowerStateEnumRestarting AzureLargeInstancePowerStateEnum = "restarting" + AzureLargeInstancePowerStateEnumStarted AzureLargeInstancePowerStateEnum = "started" + AzureLargeInstancePowerStateEnumStarting AzureLargeInstancePowerStateEnum = "starting" + AzureLargeInstancePowerStateEnumStopped AzureLargeInstancePowerStateEnum = "stopped" + AzureLargeInstancePowerStateEnumStopping AzureLargeInstancePowerStateEnum = "stopping" + AzureLargeInstancePowerStateEnumUnknown AzureLargeInstancePowerStateEnum = "unknown" +) + +// PossibleAzureLargeInstancePowerStateEnumValues returns the possible values for the AzureLargeInstancePowerStateEnum const type. +func PossibleAzureLargeInstancePowerStateEnumValues() []AzureLargeInstancePowerStateEnum { + return []AzureLargeInstancePowerStateEnum{ + AzureLargeInstancePowerStateEnumRestarting, + AzureLargeInstancePowerStateEnumStarted, + AzureLargeInstancePowerStateEnumStarting, + AzureLargeInstancePowerStateEnumStopped, + AzureLargeInstancePowerStateEnumStopping, + AzureLargeInstancePowerStateEnumUnknown, + } +} + +// AzureLargeInstanceProvisioningStatesEnum - State of provisioning of the AzureLargeInstance +type AzureLargeInstanceProvisioningStatesEnum string + +const ( + AzureLargeInstanceProvisioningStatesEnumAccepted AzureLargeInstanceProvisioningStatesEnum = "Accepted" + AzureLargeInstanceProvisioningStatesEnumCanceled AzureLargeInstanceProvisioningStatesEnum = "Canceled" + AzureLargeInstanceProvisioningStatesEnumCreating AzureLargeInstanceProvisioningStatesEnum = "Creating" + AzureLargeInstanceProvisioningStatesEnumDeleting AzureLargeInstanceProvisioningStatesEnum = "Deleting" + AzureLargeInstanceProvisioningStatesEnumFailed AzureLargeInstanceProvisioningStatesEnum = "Failed" + AzureLargeInstanceProvisioningStatesEnumMigrating AzureLargeInstanceProvisioningStatesEnum = "Migrating" + AzureLargeInstanceProvisioningStatesEnumSucceeded AzureLargeInstanceProvisioningStatesEnum = "Succeeded" + AzureLargeInstanceProvisioningStatesEnumUpdating AzureLargeInstanceProvisioningStatesEnum = "Updating" +) + +// PossibleAzureLargeInstanceProvisioningStatesEnumValues returns the possible values for the AzureLargeInstanceProvisioningStatesEnum const type. +func PossibleAzureLargeInstanceProvisioningStatesEnumValues() []AzureLargeInstanceProvisioningStatesEnum { + return []AzureLargeInstanceProvisioningStatesEnum{ + AzureLargeInstanceProvisioningStatesEnumAccepted, + AzureLargeInstanceProvisioningStatesEnumCanceled, + AzureLargeInstanceProvisioningStatesEnumCreating, + AzureLargeInstanceProvisioningStatesEnumDeleting, + AzureLargeInstanceProvisioningStatesEnumFailed, + AzureLargeInstanceProvisioningStatesEnumMigrating, + AzureLargeInstanceProvisioningStatesEnumSucceeded, + AzureLargeInstanceProvisioningStatesEnumUpdating, + } +} + +// AzureLargeInstanceSizeNamesEnum - Specifies the Azure Large Instance SKU. +type AzureLargeInstanceSizeNamesEnum string + +const ( + AzureLargeInstanceSizeNamesEnumS112 AzureLargeInstanceSizeNamesEnum = "S112" + AzureLargeInstanceSizeNamesEnumS144 AzureLargeInstanceSizeNamesEnum = "S144" + AzureLargeInstanceSizeNamesEnumS144M AzureLargeInstanceSizeNamesEnum = "S144m" + AzureLargeInstanceSizeNamesEnumS192 AzureLargeInstanceSizeNamesEnum = "S192" + AzureLargeInstanceSizeNamesEnumS192M AzureLargeInstanceSizeNamesEnum = "S192m" + AzureLargeInstanceSizeNamesEnumS192Xm AzureLargeInstanceSizeNamesEnum = "S192xm" + AzureLargeInstanceSizeNamesEnumS224 AzureLargeInstanceSizeNamesEnum = "S224" + AzureLargeInstanceSizeNamesEnumS224M AzureLargeInstanceSizeNamesEnum = "S224m" + AzureLargeInstanceSizeNamesEnumS224Om AzureLargeInstanceSizeNamesEnum = "S224om" + AzureLargeInstanceSizeNamesEnumS224Oo AzureLargeInstanceSizeNamesEnum = "S224oo" + AzureLargeInstanceSizeNamesEnumS224Oom AzureLargeInstanceSizeNamesEnum = "S224oom" + AzureLargeInstanceSizeNamesEnumS224Ooo AzureLargeInstanceSizeNamesEnum = "S224ooo" + AzureLargeInstanceSizeNamesEnumS224Se AzureLargeInstanceSizeNamesEnum = "S224se" + AzureLargeInstanceSizeNamesEnumS384 AzureLargeInstanceSizeNamesEnum = "S384" + AzureLargeInstanceSizeNamesEnumS384M AzureLargeInstanceSizeNamesEnum = "S384m" + AzureLargeInstanceSizeNamesEnumS384Xm AzureLargeInstanceSizeNamesEnum = "S384xm" + AzureLargeInstanceSizeNamesEnumS384Xxm AzureLargeInstanceSizeNamesEnum = "S384xxm" + AzureLargeInstanceSizeNamesEnumS448 AzureLargeInstanceSizeNamesEnum = "S448" + AzureLargeInstanceSizeNamesEnumS448M AzureLargeInstanceSizeNamesEnum = "S448m" + AzureLargeInstanceSizeNamesEnumS448Om AzureLargeInstanceSizeNamesEnum = "S448om" + AzureLargeInstanceSizeNamesEnumS448Oo AzureLargeInstanceSizeNamesEnum = "S448oo" + AzureLargeInstanceSizeNamesEnumS448Oom AzureLargeInstanceSizeNamesEnum = "S448oom" + AzureLargeInstanceSizeNamesEnumS448Ooo AzureLargeInstanceSizeNamesEnum = "S448ooo" + AzureLargeInstanceSizeNamesEnumS448Se AzureLargeInstanceSizeNamesEnum = "S448se" + AzureLargeInstanceSizeNamesEnumS576M AzureLargeInstanceSizeNamesEnum = "S576m" + AzureLargeInstanceSizeNamesEnumS576Xm AzureLargeInstanceSizeNamesEnum = "S576xm" + AzureLargeInstanceSizeNamesEnumS672 AzureLargeInstanceSizeNamesEnum = "S672" + AzureLargeInstanceSizeNamesEnumS672M AzureLargeInstanceSizeNamesEnum = "S672m" + AzureLargeInstanceSizeNamesEnumS672Om AzureLargeInstanceSizeNamesEnum = "S672om" + AzureLargeInstanceSizeNamesEnumS672Oo AzureLargeInstanceSizeNamesEnum = "S672oo" + AzureLargeInstanceSizeNamesEnumS672Oom AzureLargeInstanceSizeNamesEnum = "S672oom" + AzureLargeInstanceSizeNamesEnumS672Ooo AzureLargeInstanceSizeNamesEnum = "S672ooo" + AzureLargeInstanceSizeNamesEnumS72 AzureLargeInstanceSizeNamesEnum = "S72" + AzureLargeInstanceSizeNamesEnumS72M AzureLargeInstanceSizeNamesEnum = "S72m" + AzureLargeInstanceSizeNamesEnumS768 AzureLargeInstanceSizeNamesEnum = "S768" + AzureLargeInstanceSizeNamesEnumS768M AzureLargeInstanceSizeNamesEnum = "S768m" + AzureLargeInstanceSizeNamesEnumS768Xm AzureLargeInstanceSizeNamesEnum = "S768xm" + AzureLargeInstanceSizeNamesEnumS896 AzureLargeInstanceSizeNamesEnum = "S896" + AzureLargeInstanceSizeNamesEnumS896M AzureLargeInstanceSizeNamesEnum = "S896m" + AzureLargeInstanceSizeNamesEnumS896Om AzureLargeInstanceSizeNamesEnum = "S896om" + AzureLargeInstanceSizeNamesEnumS896Oo AzureLargeInstanceSizeNamesEnum = "S896oo" + AzureLargeInstanceSizeNamesEnumS896Oom AzureLargeInstanceSizeNamesEnum = "S896oom" + AzureLargeInstanceSizeNamesEnumS896Ooo AzureLargeInstanceSizeNamesEnum = "S896ooo" + AzureLargeInstanceSizeNamesEnumS96 AzureLargeInstanceSizeNamesEnum = "S96" + AzureLargeInstanceSizeNamesEnumS960M AzureLargeInstanceSizeNamesEnum = "S960m" +) + +// PossibleAzureLargeInstanceSizeNamesEnumValues returns the possible values for the AzureLargeInstanceSizeNamesEnum const type. +func PossibleAzureLargeInstanceSizeNamesEnumValues() []AzureLargeInstanceSizeNamesEnum { + return []AzureLargeInstanceSizeNamesEnum{ + AzureLargeInstanceSizeNamesEnumS112, + AzureLargeInstanceSizeNamesEnumS144, + AzureLargeInstanceSizeNamesEnumS144M, + AzureLargeInstanceSizeNamesEnumS192, + AzureLargeInstanceSizeNamesEnumS192M, + AzureLargeInstanceSizeNamesEnumS192Xm, + AzureLargeInstanceSizeNamesEnumS224, + AzureLargeInstanceSizeNamesEnumS224M, + AzureLargeInstanceSizeNamesEnumS224Om, + AzureLargeInstanceSizeNamesEnumS224Oo, + AzureLargeInstanceSizeNamesEnumS224Oom, + AzureLargeInstanceSizeNamesEnumS224Ooo, + AzureLargeInstanceSizeNamesEnumS224Se, + AzureLargeInstanceSizeNamesEnumS384, + AzureLargeInstanceSizeNamesEnumS384M, + AzureLargeInstanceSizeNamesEnumS384Xm, + AzureLargeInstanceSizeNamesEnumS384Xxm, + AzureLargeInstanceSizeNamesEnumS448, + AzureLargeInstanceSizeNamesEnumS448M, + AzureLargeInstanceSizeNamesEnumS448Om, + AzureLargeInstanceSizeNamesEnumS448Oo, + AzureLargeInstanceSizeNamesEnumS448Oom, + AzureLargeInstanceSizeNamesEnumS448Ooo, + AzureLargeInstanceSizeNamesEnumS448Se, + AzureLargeInstanceSizeNamesEnumS576M, + AzureLargeInstanceSizeNamesEnumS576Xm, + AzureLargeInstanceSizeNamesEnumS672, + AzureLargeInstanceSizeNamesEnumS672M, + AzureLargeInstanceSizeNamesEnumS672Om, + AzureLargeInstanceSizeNamesEnumS672Oo, + AzureLargeInstanceSizeNamesEnumS672Oom, + AzureLargeInstanceSizeNamesEnumS672Ooo, + AzureLargeInstanceSizeNamesEnumS72, + AzureLargeInstanceSizeNamesEnumS72M, + AzureLargeInstanceSizeNamesEnumS768, + AzureLargeInstanceSizeNamesEnumS768M, + AzureLargeInstanceSizeNamesEnumS768Xm, + AzureLargeInstanceSizeNamesEnumS896, + AzureLargeInstanceSizeNamesEnumS896M, + AzureLargeInstanceSizeNamesEnumS896Om, + AzureLargeInstanceSizeNamesEnumS896Oo, + AzureLargeInstanceSizeNamesEnumS896Oom, + AzureLargeInstanceSizeNamesEnumS896Ooo, + AzureLargeInstanceSizeNamesEnumS96, + AzureLargeInstanceSizeNamesEnumS960M, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// 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 Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProvisioningState - State of provisioning of the AzureLargeStorageInstance +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMigrating ProvisioningState = "Migrating" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateMigrating, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} diff --git a/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/go.mod b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/go.mod new file mode 100644 index 000000000000..ef5177ef6f0c --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/go.mod @@ -0,0 +1,13 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect +) diff --git a/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/go.sum b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/go.sum new file mode 100644 index 000000000000..5c6bee428364 --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/go.sum @@ -0,0 +1,15 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/models.go b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/models.go new file mode 100644 index 000000000000..e68efc3fec89 --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/models.go @@ -0,0 +1,353 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurelargeinstance + +import "time" + +// AzureLargeInstance - Azure Large Instance info on Azure (ARM properties and AzureLargeInstance properties) +type AzureLargeInstance struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Azure Large Instance properties + Properties *Properties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 +} + +// AzureLargeStorageInstance info on Azure (ARM properties and AzureLargeStorageInstance properties) +type AzureLargeStorageInstance struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // AzureLargeStorageInstance properties + Properties *AzureLargeStorageInstanceProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 +} + +// AzureLargeStorageInstanceListResult - The response from the Get AzureLargeStorageInstances operation. +type AzureLargeStorageInstanceListResult struct { + // The URL to get the next set of AzureLargeStorage instances. + NextLink *string + + // The list of AzureLargeStorage instances. + Value []*AzureLargeStorageInstance +} + +// AzureLargeStorageInstanceProperties - Describes the properties of an AzureLargeStorageInstance. +type AzureLargeStorageInstanceProperties struct { + // Specifies the AzureLargeStorageInstance unique ID. + AzureLargeStorageInstanceUniqueIdentifier *string + + // Specifies the storage properties for the AzureLargeStorage instance. + StorageProperties *StorageProperties +} + +// Disk - Specifies the disk information fo the Azure Large Instance +type Disk struct { + // Specifies the size of an empty data disk in gigabytes. + DiskSizeGB *int32 + + // The disk name. + Name *string + + // READ-ONLY; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM + // and therefore must be unique for each data disk attached to a VM. + Lun *int32 +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + +// ForceState - The active state empowers the server with the ability to forcefully terminate and halt any existing processes +// that may be running on the server +type ForceState struct { + // Whether to force restart by shutting all processes. + ForceState *AzureLargeInstanceForcePowerState +} + +// HardwareProfile - Specifies the hardware settings for the Azure Large Instance. +type HardwareProfile struct { + // READ-ONLY; Specifies the Azure Large Instance SKU. + AzureLargeInstanceSize *AzureLargeInstanceSizeNamesEnum + + // READ-ONLY; Name of the hardware type (vendor and/or their product name) + HardwareType *AzureLargeInstanceHardwareTypeNamesEnum +} + +// IPAddress - Specifies the IP address of the network interface. +type IPAddress struct { + // Specifies the IP address of the network interface. + IPAddress *string +} + +// ListResult - The response from the List Azure Large Instances operation. +type ListResult struct { + // The URL to get the next set of Azure Large Instances. + NextLink *string + + // The list of Azure Large Instances. + Value []*AzureLargeInstance +} + +// NetworkProfile - Specifies the network settings for the Azure Large Instance disks. +type NetworkProfile struct { + // Specifies the network interfaces for the Azure Large Instance. + NetworkInterfaces []*IPAddress + + // READ-ONLY; Specifies the circuit id for connecting to express route. + CircuitID *string +} + +// OSProfile - Specifies the operating system settings for the Azure Large Instance. +type OSProfile struct { + // Specifies the host OS name of the Azure Large Instance. + ComputerName *string + + // Specifies the SSH public key used to access the operating system. + SSHPublicKey *string + + // READ-ONLY; This property allows you to specify the type of the OS. + OSType *string + + // READ-ONLY; Specifies version of operating system. + Version *string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/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 this particular 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 { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// OperationStatusResult - The current status of an async operation. +type OperationStatusResult struct { + // REQUIRED; Operation status. + Status *string + + // The end time of the operation. + EndTime *time.Time + + // If present, details of the operation error. + Error *ErrorDetail + + // Fully qualified ID for the async operation. + ID *string + + // Name of the async operation. + Name *string + + // The operations list. + Operations []*OperationStatusResult + + // Percent of the operation that is complete. + PercentComplete *float32 + + // The start time of the operation. + StartTime *time.Time + + // READ-ONLY; Fully qualified ID of the resource against which the original async operation was started. + ResourceID *string +} + +// Properties - Describes the properties of an Azure Large Instance. +type Properties struct { + // Specifies the hardware settings for the Azure Large Instance. + HardwareProfile *HardwareProfile + + // Specifies the network settings for the Azure Large Instance. + NetworkProfile *NetworkProfile + + // Specifies the operating system settings for the Azure Large Instance. + OSProfile *OSProfile + + // ARM ID of another AzureLargeInstance that will share a network with this AzureLargeInstance + PartnerNodeID *string + + // Specifies the storage settings for the Azure Large Instance disks. + StorageProfile *StorageProfile + + // READ-ONLY; Specifies the Azure Large Instance unique ID. + AzureLargeInstanceID *string + + // READ-ONLY; Hardware revision of an Azure Large Instance + HwRevision *string + + // READ-ONLY; Resource power state + PowerState *AzureLargeInstancePowerStateEnum + + // READ-ONLY; State of provisioning of the AzureLargeInstance + ProvisioningState *AzureLargeInstanceProvisioningStatesEnum + + // READ-ONLY; Resource proximity placement group + ProximityPlacementGroup *string +} + +// StorageBillingProperties - Describes the billing related details of the AzureLargeStorageInstance. +type StorageBillingProperties struct { + // the billing mode for the storage instance + BillingMode *string + + // the SKU type that is provisioned + SKU *string +} + +// StorageProfile - Specifies the storage settings for the Azure Large Instance disks. +type StorageProfile struct { + // Specifies information about the operating system disk used by Azure Large Instance. + OSDisks []*Disk + + // READ-ONLY; IP Address to connect to storage. + NfsIPAddress *string +} + +// StorageProperties - described the storage properties of the azure large storage instance +type StorageProperties struct { + // the kind of storage instance + Generation *string + + // the hardware type of the storage instance + HardwareType *string + + // the offering type for which the resource is getting provisioned + OfferingType *string + + // State of provisioning of the AzureLargeStorageInstance + ProvisioningState *ProvisioningState + + // the billing related information for the resource + StorageBillingProperties *StorageBillingProperties + + // the storage protocol for which the resource is getting provisioned + StorageType *string + + // the workload for which the resource is getting provisioned + WorkloadType *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 +} + +// Tags field of the AzureLargeInstance instance. +type Tags struct { + // Tags field of the AzureLargeInstance instance. + Tags map[string]*string +} diff --git a/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/models_serde.go b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/models_serde.go new file mode 100644 index 000000000000..8365ac5458f8 --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/models_serde.go @@ -0,0 +1,927 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurelargeinstance + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AzureLargeInstance. +func (a AzureLargeInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureLargeInstance. +func (a *AzureLargeInstance) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureLargeStorageInstance. +func (a AzureLargeStorageInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureLargeStorageInstance. +func (a *AzureLargeStorageInstance) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureLargeStorageInstanceListResult. +func (a AzureLargeStorageInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureLargeStorageInstanceListResult. +func (a *AzureLargeStorageInstanceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureLargeStorageInstanceProperties. +func (a AzureLargeStorageInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureLargeStorageInstanceUniqueIdentifier", a.AzureLargeStorageInstanceUniqueIdentifier) + populate(objectMap, "storageProperties", a.StorageProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureLargeStorageInstanceProperties. +func (a *AzureLargeStorageInstanceProperties) 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 "azureLargeStorageInstanceUniqueIdentifier": + err = unpopulate(val, "AzureLargeStorageInstanceUniqueIdentifier", &a.AzureLargeStorageInstanceUniqueIdentifier) + delete(rawMsg, key) + case "storageProperties": + err = unpopulate(val, "StorageProperties", &a.StorageProperties) + 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 Disk. +func (d Disk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diskSizeGB", d.DiskSizeGB) + populate(objectMap, "lun", d.Lun) + populate(objectMap, "name", d.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Disk. +func (d *Disk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &d.DiskSizeGB) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &d.Lun) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(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 ForceState. +func (f ForceState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "forceState", f.ForceState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForceState. +func (f *ForceState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "forceState": + err = unpopulate(val, "ForceState", &f.ForceState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HardwareProfile. +func (h HardwareProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureLargeInstanceSize", h.AzureLargeInstanceSize) + populate(objectMap, "hardwareType", h.HardwareType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HardwareProfile. +func (h *HardwareProfile) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureLargeInstanceSize": + err = unpopulate(val, "AzureLargeInstanceSize", &h.AzureLargeInstanceSize) + delete(rawMsg, key) + case "hardwareType": + err = unpopulate(val, "HardwareType", &h.HardwareType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPAddress. +func (i IPAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipAddress", i.IPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPAddress. +func (i *IPAddress) 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 "ipAddress": + err = unpopulate(val, "IPAddress", &i.IPAddress) + 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 ListResult. +func (l ListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListResult. +func (l *ListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkProfile. +func (n NetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "circuitId", n.CircuitID) + populate(objectMap, "networkInterfaces", n.NetworkInterfaces) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfile. +func (n *NetworkProfile) 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", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "circuitId": + err = unpopulate(val, "CircuitID", &n.CircuitID) + delete(rawMsg, key) + case "networkInterfaces": + err = unpopulate(val, "NetworkInterfaces", &n.NetworkInterfaces) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSProfile. +func (o OSProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "computerName", o.ComputerName) + populate(objectMap, "osType", o.OSType) + populate(objectMap, "sshPublicKey", o.SSHPublicKey) + populate(objectMap, "version", o.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSProfile. +func (o *OSProfile) 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 "computerName": + err = unpopulate(val, "ComputerName", &o.ComputerName) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &o.OSType) + delete(rawMsg, key) + case "sshPublicKey": + err = unpopulate(val, "SSHPublicKey", &o.SSHPublicKey) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &o.Version) + 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 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 OperationStatusResult. +func (o OperationStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "operations", o.Operations) + populate(objectMap, "percentComplete", o.PercentComplete) + populate(objectMap, "resourceId", o.ResourceID) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusResult. +func (o *OperationStatusResult) 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 "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "operations": + err = unpopulate(val, "Operations", &o.Operations) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &o.PercentComplete) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &o.ResourceID) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + 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 Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureLargeInstanceId", p.AzureLargeInstanceID) + populate(objectMap, "hardwareProfile", p.HardwareProfile) + populate(objectMap, "hwRevision", p.HwRevision) + populate(objectMap, "networkProfile", p.NetworkProfile) + populate(objectMap, "osProfile", p.OSProfile) + populate(objectMap, "partnerNodeId", p.PartnerNodeID) + populate(objectMap, "powerState", p.PowerState) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "proximityPlacementGroup", p.ProximityPlacementGroup) + populate(objectMap, "storageProfile", p.StorageProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. +func (p *Properties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureLargeInstanceId": + err = unpopulate(val, "AzureLargeInstanceID", &p.AzureLargeInstanceID) + delete(rawMsg, key) + case "hardwareProfile": + err = unpopulate(val, "HardwareProfile", &p.HardwareProfile) + delete(rawMsg, key) + case "hwRevision": + err = unpopulate(val, "HwRevision", &p.HwRevision) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &p.NetworkProfile) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &p.OSProfile) + delete(rawMsg, key) + case "partnerNodeId": + err = unpopulate(val, "PartnerNodeID", &p.PartnerNodeID) + delete(rawMsg, key) + case "powerState": + err = unpopulate(val, "PowerState", &p.PowerState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "proximityPlacementGroup": + err = unpopulate(val, "ProximityPlacementGroup", &p.ProximityPlacementGroup) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &p.StorageProfile) + 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 StorageBillingProperties. +func (s StorageBillingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "billingMode", s.BillingMode) + populate(objectMap, "sku", s.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageBillingProperties. +func (s *StorageBillingProperties) 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 "billingMode": + err = unpopulate(val, "BillingMode", &s.BillingMode) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageProfile. +func (s StorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nfsIpAddress", s.NfsIPAddress) + populate(objectMap, "osDisks", s.OSDisks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfile. +func (s *StorageProfile) 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 "nfsIpAddress": + err = unpopulate(val, "NfsIPAddress", &s.NfsIPAddress) + delete(rawMsg, key) + case "osDisks": + err = unpopulate(val, "OSDisks", &s.OSDisks) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageProperties. +func (s StorageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "generation", s.Generation) + populate(objectMap, "hardwareType", s.HardwareType) + populate(objectMap, "offeringType", s.OfferingType) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "storageBillingProperties", s.StorageBillingProperties) + populate(objectMap, "storageType", s.StorageType) + populate(objectMap, "workloadType", s.WorkloadType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProperties. +func (s *StorageProperties) 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 "generation": + err = unpopulate(val, "Generation", &s.Generation) + delete(rawMsg, key) + case "hardwareType": + err = unpopulate(val, "HardwareType", &s.HardwareType) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &s.OfferingType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "storageBillingProperties": + err = unpopulate(val, "StorageBillingProperties", &s.StorageBillingProperties) + delete(rawMsg, key) + case "storageType": + err = unpopulate(val, "StorageType", &s.StorageType) + delete(rawMsg, key) + case "workloadType": + err = unpopulate(val, "WorkloadType", &s.WorkloadType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Tags. +func (t Tags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Tags. +func (t *Tags) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, 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 populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/operations_client.go b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/operations_client.go new file mode 100644 index 000000000000..464c1366e560 --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/operations_client.go @@ -0,0 +1,93 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurelargeinstance + +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+".OperationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Gets a list of AzureLargeInstance management operations. +// +// Generated from API version 2023-07-20-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) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.AzureLargeInstance/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-07-20-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/azurelargeinstance/armazurelargeinstance/options.go b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/options.go new file mode 100644 index 000000000000..a6bdc61dc4d7 --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/options.go @@ -0,0 +1,80 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurelargeinstance + +// AzureLargeStorageInstanceClientGetOptions contains the optional parameters for the AzureLargeStorageInstanceClient.Get +// method. +type AzureLargeStorageInstanceClientGetOptions struct { + // placeholder for future optional parameters +} + +// AzureLargeStorageInstanceClientListByResourceGroupOptions contains the optional parameters for the AzureLargeStorageInstanceClient.NewListByResourceGroupPager +// method. +type AzureLargeStorageInstanceClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AzureLargeStorageInstanceClientListBySubscriptionOptions contains the optional parameters for the AzureLargeStorageInstanceClient.NewListBySubscriptionPager +// method. +type AzureLargeStorageInstanceClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// AzureLargeStorageInstanceClientUpdateOptions contains the optional parameters for the AzureLargeStorageInstanceClient.Update +// method. +type AzureLargeStorageInstanceClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ClientBeginRestartOptions contains the optional parameters for the Client.BeginRestart method. +type ClientBeginRestartOptions struct { + // When set to 'active', this parameter empowers the server with the ability to forcefully terminate and halt any existing + // processes that may be running on the server + ForceParameter *ForceState + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginShutdownOptions contains the optional parameters for the Client.BeginShutdown method. +type ClientBeginShutdownOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginStartOptions contains the optional parameters for the Client.BeginStart method. +type ClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientGetOptions contains the optional parameters for the Client.Get method. +type ClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method. +type ClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. +type ClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ClientUpdateOptions contains the optional parameters for the Client.Update method. +type ClientUpdateOptions 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/azurelargeinstance/armazurelargeinstance/response_types.go b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/response_types.go new file mode 100644 index 000000000000..b54bf7f15d98 --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/response_types.go @@ -0,0 +1,81 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurelargeinstance + +// AzureLargeStorageInstanceClientGetResponse contains the response from method AzureLargeStorageInstanceClient.Get. +type AzureLargeStorageInstanceClientGetResponse struct { + // AzureLargeStorageInstance info on Azure (ARM properties and AzureLargeStorageInstance properties) + AzureLargeStorageInstance +} + +// AzureLargeStorageInstanceClientListByResourceGroupResponse contains the response from method AzureLargeStorageInstanceClient.NewListByResourceGroupPager. +type AzureLargeStorageInstanceClientListByResourceGroupResponse struct { + // The response from the Get AzureLargeStorageInstances operation. + AzureLargeStorageInstanceListResult +} + +// AzureLargeStorageInstanceClientListBySubscriptionResponse contains the response from method AzureLargeStorageInstanceClient.NewListBySubscriptionPager. +type AzureLargeStorageInstanceClientListBySubscriptionResponse struct { + // The response from the Get AzureLargeStorageInstances operation. + AzureLargeStorageInstanceListResult +} + +// AzureLargeStorageInstanceClientUpdateResponse contains the response from method AzureLargeStorageInstanceClient.Update. +type AzureLargeStorageInstanceClientUpdateResponse struct { + // AzureLargeStorageInstance info on Azure (ARM properties and AzureLargeStorageInstance properties) + AzureLargeStorageInstance +} + +// ClientGetResponse contains the response from method Client.Get. +type ClientGetResponse struct { + // Azure Large Instance info on Azure (ARM properties and AzureLargeInstance properties) + AzureLargeInstance +} + +// ClientListByResourceGroupResponse contains the response from method Client.NewListByResourceGroupPager. +type ClientListByResourceGroupResponse struct { + // The response from the List Azure Large Instances operation. + ListResult +} + +// ClientListBySubscriptionResponse contains the response from method Client.NewListBySubscriptionPager. +type ClientListBySubscriptionResponse struct { + // The response from the List Azure Large Instances operation. + ListResult +} + +// ClientRestartResponse contains the response from method Client.BeginRestart. +type ClientRestartResponse struct { + // The current status of an async operation. + OperationStatusResult +} + +// ClientShutdownResponse contains the response from method Client.BeginShutdown. +type ClientShutdownResponse struct { + // The current status of an async operation. + OperationStatusResult +} + +// ClientStartResponse contains the response from method Client.BeginStart. +type ClientStartResponse struct { + // The current status of an async operation. + OperationStatusResult +} + +// ClientUpdateResponse contains the response from method Client.Update. +type ClientUpdateResponse struct { + // Azure Large Instance info on Azure (ARM properties and AzureLargeInstance properties) + AzureLargeInstance +} + +// 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/azurelargeinstance/armazurelargeinstance/time_rfc3339.go b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/time_rfc3339.go new file mode 100644 index 000000000000..0982c6f3b0d6 --- /dev/null +++ b/sdk/resourcemanager/azurelargeinstance/armazurelargeinstance/time_rfc3339.go @@ -0,0 +1,86 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armazurelargeinstance + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// 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+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(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] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +}