From 4b38bf2441d0da1aae5f0490c1e23e1482e6a65a Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 28 Jul 2023 08:57:21 +0000 Subject: [PATCH] CodeGen from PR 25030 in Azure/azure-rest-api-specs Merge 59873242b5ef6ea20c3db10dfab72e3040973de2 into 5e2f303761697659678ff120202027ff51bb0ea9 --- .../hdinsight/armhdinsightonaks/CHANGELOG.md | 7 + .../hdinsight/armhdinsightonaks/LICENSE.txt | 21 + .../hdinsight/armhdinsightonaks/README.md | 85 + .../hdinsight/armhdinsightonaks/autorest.md | 13 + .../availableclusterpoolversions_client.go | 106 + .../availableclusterversions_client.go | 106 + .../hdinsight/armhdinsightonaks/build.go | 7 + .../hdinsight/armhdinsightonaks/ci.yml | 28 + .../armhdinsightonaks/client_factory.go | 73 + .../armhdinsightonaks/clusterjobs_client.go | 190 + .../armhdinsightonaks/clusterpools_client.go | 427 +++ .../armhdinsightonaks/clusters_client.go | 676 ++++ .../hdinsight/armhdinsightonaks/constants.go | 245 ++ .../hdinsight/armhdinsightonaks/go.mod | 13 + .../hdinsight/armhdinsightonaks/go.sum | 15 + .../hdinsight/armhdinsightonaks/interfaces.go | 18 + .../armhdinsightonaks/locations_client.go | 101 + .../hdinsight/armhdinsightonaks/models.go | 1211 ++++++ .../armhdinsightonaks/models_serde.go | 3237 +++++++++++++++++ .../armhdinsightonaks/operations_client.go | 93 + .../hdinsight/armhdinsightonaks/options.go | 131 + .../armhdinsightonaks/polymorphic_helpers.go | 32 + .../armhdinsightonaks/response_types.go | 133 + .../armhdinsightonaks/time_rfc3339.go | 86 + 24 files changed, 7054 insertions(+) create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/CHANGELOG.md create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/LICENSE.txt create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/README.md create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/autorest.md create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/availableclusterpoolversions_client.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/availableclusterversions_client.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/build.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/ci.yml create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/client_factory.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/clusterjobs_client.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/clusterpools_client.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/clusters_client.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/constants.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/go.mod create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/go.sum create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/interfaces.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/locations_client.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/models.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/models_serde.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/operations_client.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/options.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/polymorphic_helpers.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/response_types.go create mode 100644 sdk/resourcemanager/hdinsight/armhdinsightonaks/time_rfc3339.go diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/CHANGELOG.md b/sdk/resourcemanager/hdinsight/armhdinsightonaks/CHANGELOG.md new file mode 100644 index 000000000000..d655d5835d90 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 0.1.0 (2023-07-28) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsightonaks` 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/hdinsight/armhdinsightonaks/LICENSE.txt b/sdk/resourcemanager/hdinsight/armhdinsightonaks/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/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/hdinsight/armhdinsightonaks/README.md b/sdk/resourcemanager/hdinsight/armhdinsightonaks/README.md new file mode 100644 index 000000000000..214eda0cd3e6 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/README.md @@ -0,0 +1,85 @@ +# Azure Hdinsight Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsightonaks)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsightonaks) + +The `armhdinsightonaks` module provides operations for working with Azure Hdinsight. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/hdinsight/armhdinsightonaks) + +# 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 Hdinsight module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsightonaks +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Hdinsight. 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 Hdinsight 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 := armhdinsightonaks.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, + }, +} +client, err := armhdinsightonaks.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.NewAvailableClusterPoolVersionsClient() +``` + +## 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 `Hdinsight` 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/hdinsight/armhdinsightonaks/autorest.md b/sdk/resourcemanager/hdinsight/armhdinsightonaks/autorest.md new file mode 100644 index 000000000000..02a00e1f3542 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/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/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/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/hdinsight/armhdinsightonaks/availableclusterpoolversions_client.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/availableclusterpoolversions_client.go new file mode 100644 index 000000000000..2d11395f49fb --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/availableclusterpoolversions_client.go @@ -0,0 +1,106 @@ +//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 armhdinsightonaks + +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" +) + +// AvailableClusterPoolVersionsClient contains the methods for the AvailableClusterPoolVersions group. +// Don't use this type directly, use NewAvailableClusterPoolVersionsClient() instead. +type AvailableClusterPoolVersionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAvailableClusterPoolVersionsClient creates a new instance of AvailableClusterPoolVersionsClient 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 NewAvailableClusterPoolVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailableClusterPoolVersionsClient, error) { + cl, err := arm.NewClient(moduleName+".AvailableClusterPoolVersionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AvailableClusterPoolVersionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByLocationPager - Returns a list of available cluster pool versions. +// +// Generated from API version 2023-06-01-preview +// - location - The name of the Azure region. +// - options - AvailableClusterPoolVersionsClientListByLocationOptions contains the optional parameters for the AvailableClusterPoolVersionsClient.NewListByLocationPager +// method. +func (client *AvailableClusterPoolVersionsClient) NewListByLocationPager(location string, options *AvailableClusterPoolVersionsClientListByLocationOptions) *runtime.Pager[AvailableClusterPoolVersionsClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailableClusterPoolVersionsClientListByLocationResponse]{ + More: func(page AvailableClusterPoolVersionsClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailableClusterPoolVersionsClientListByLocationResponse) (AvailableClusterPoolVersionsClientListByLocationResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByLocationCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailableClusterPoolVersionsClientListByLocationResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AvailableClusterPoolVersionsClientListByLocationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailableClusterPoolVersionsClientListByLocationResponse{}, runtime.NewResponseError(resp) + } + return client.listByLocationHandleResponse(resp) + }, + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *AvailableClusterPoolVersionsClient) listByLocationCreateRequest(ctx context.Context, location string, options *AvailableClusterPoolVersionsClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterPoolVersions" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *AvailableClusterPoolVersionsClient) listByLocationHandleResponse(resp *http.Response) (AvailableClusterPoolVersionsClientListByLocationResponse, error) { + result := AvailableClusterPoolVersionsClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterPoolVersionsListResult); err != nil { + return AvailableClusterPoolVersionsClientListByLocationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/availableclusterversions_client.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/availableclusterversions_client.go new file mode 100644 index 000000000000..51d20491f43e --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/availableclusterversions_client.go @@ -0,0 +1,106 @@ +//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 armhdinsightonaks + +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" +) + +// AvailableClusterVersionsClient contains the methods for the AvailableClusterVersions group. +// Don't use this type directly, use NewAvailableClusterVersionsClient() instead. +type AvailableClusterVersionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAvailableClusterVersionsClient creates a new instance of AvailableClusterVersionsClient 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 NewAvailableClusterVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailableClusterVersionsClient, error) { + cl, err := arm.NewClient(moduleName+".AvailableClusterVersionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AvailableClusterVersionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByLocationPager - Returns a list of available cluster versions. +// +// Generated from API version 2023-06-01-preview +// - location - The name of the Azure region. +// - options - AvailableClusterVersionsClientListByLocationOptions contains the optional parameters for the AvailableClusterVersionsClient.NewListByLocationPager +// method. +func (client *AvailableClusterVersionsClient) NewListByLocationPager(location string, options *AvailableClusterVersionsClientListByLocationOptions) *runtime.Pager[AvailableClusterVersionsClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailableClusterVersionsClientListByLocationResponse]{ + More: func(page AvailableClusterVersionsClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailableClusterVersionsClientListByLocationResponse) (AvailableClusterVersionsClientListByLocationResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByLocationCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailableClusterVersionsClientListByLocationResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AvailableClusterVersionsClientListByLocationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailableClusterVersionsClientListByLocationResponse{}, runtime.NewResponseError(resp) + } + return client.listByLocationHandleResponse(resp) + }, + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *AvailableClusterVersionsClient) listByLocationCreateRequest(ctx context.Context, location string, options *AvailableClusterVersionsClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterVersions" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *AvailableClusterVersionsClient) listByLocationHandleResponse(resp *http.Response) (AvailableClusterVersionsClientListByLocationResponse, error) { + result := AvailableClusterVersionsClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterVersionsListResult); err != nil { + return AvailableClusterVersionsClientListByLocationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/build.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/build.go new file mode 100644 index 000000000000..2ec3279cfc6b --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/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/hdinsight/armhdinsightonaks + +package armhdinsightonaks diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/ci.yml b/sdk/resourcemanager/hdinsight/armhdinsightonaks/ci.yml new file mode 100644 index 000000000000..c3f51378528d --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/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/hdinsight/armhdinsightonaks/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/hdinsight/armhdinsightonaks/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/hdinsight/armhdinsightonaks' diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/client_factory.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/client_factory.go new file mode 100644 index 000000000000..4785c234c984 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/client_factory.go @@ -0,0 +1,73 @@ +//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 armhdinsightonaks + +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) NewAvailableClusterPoolVersionsClient() *AvailableClusterPoolVersionsClient { + subClient, _ := NewAvailableClusterPoolVersionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAvailableClusterVersionsClient() *AvailableClusterVersionsClient { + subClient, _ := NewAvailableClusterVersionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewClusterJobsClient() *ClusterJobsClient { + subClient, _ := NewClusterJobsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewClusterPoolsClient() *ClusterPoolsClient { + subClient, _ := NewClusterPoolsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewClustersClient() *ClustersClient { + subClient, _ := NewClustersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLocationsClient() *LocationsClient { + subClient, _ := NewLocationsClient(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/hdinsight/armhdinsightonaks/clusterjobs_client.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/clusterjobs_client.go new file mode 100644 index 000000000000..fc14178756f9 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/clusterjobs_client.go @@ -0,0 +1,190 @@ +//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 armhdinsightonaks + +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" +) + +// ClusterJobsClient contains the methods for the ClusterJobs group. +// Don't use this type directly, use NewClusterJobsClient() instead. +type ClusterJobsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewClusterJobsClient creates a new instance of ClusterJobsClient 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 NewClusterJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClusterJobsClient, error) { + cl, err := arm.NewClient(moduleName+".ClusterJobsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ClusterJobsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Get jobs of HDInsight on AKS cluster. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - clusterName - The name of the HDInsight cluster. +// - options - ClusterJobsClientListOptions contains the optional parameters for the ClusterJobsClient.NewListPager method. +func (client *ClusterJobsClient) NewListPager(resourceGroupName string, clusterPoolName string, clusterName string, options *ClusterJobsClientListOptions) *runtime.Pager[ClusterJobsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ClusterJobsClientListResponse]{ + More: func(page ClusterJobsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClusterJobsClientListResponse) (ClusterJobsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, clusterPoolName, clusterName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClusterJobsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClusterJobsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClusterJobsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ClusterJobsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, options *ClusterJobsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/jobs" + 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 clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ClusterJobsClient) listHandleResponse(resp *http.Response) (ClusterJobsClientListResponse, error) { + result := ClusterJobsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterJobList); err != nil { + return ClusterJobsClientListResponse{}, err + } + return result, nil +} + +// BeginRunJob - Operations on jobs of HDInsight on AKS cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - clusterName - The name of the HDInsight cluster. +// - clusterJob - The Cluster job. +// - options - ClusterJobsClientBeginRunJobOptions contains the optional parameters for the ClusterJobsClient.BeginRunJob method. +func (client *ClusterJobsClient) BeginRunJob(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, clusterJob ClusterJob, options *ClusterJobsClientBeginRunJobOptions) (*runtime.Poller[ClusterJobsClientRunJobResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.runJob(ctx, resourceGroupName, clusterPoolName, clusterName, clusterJob, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClusterJobsClientRunJobResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ClusterJobsClientRunJobResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// RunJob - Operations on jobs of HDInsight on AKS cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +func (client *ClusterJobsClient) runJob(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, clusterJob ClusterJob, options *ClusterJobsClientBeginRunJobOptions) (*http.Response, error) { + var err error + req, err := client.runJobCreateRequest(ctx, resourceGroupName, clusterPoolName, clusterName, clusterJob, 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 +} + +// runJobCreateRequest creates the RunJob request. +func (client *ClusterJobsClient) runJobCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, clusterJob ClusterJob, options *ClusterJobsClientBeginRunJobOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/runJob" + 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 clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, clusterJob); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/clusterpools_client.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/clusterpools_client.go new file mode 100644 index 000000000000..7170ea7b12f9 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/clusterpools_client.go @@ -0,0 +1,427 @@ +//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 armhdinsightonaks + +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" +) + +// ClusterPoolsClient contains the methods for the ClusterPools group. +// Don't use this type directly, use NewClusterPoolsClient() instead. +type ClusterPoolsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewClusterPoolsClient creates a new instance of ClusterPoolsClient 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 NewClusterPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClusterPoolsClient, error) { + cl, err := arm.NewClient(moduleName+".ClusterPoolsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ClusterPoolsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a cluster pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - clusterPool - The Cluster Pool to create. +// - options - ClusterPoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the ClusterPoolsClient.BeginCreateOrUpdate +// method. +func (client *ClusterPoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterPool ClusterPool, options *ClusterPoolsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ClusterPoolsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, clusterPoolName, clusterPool, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClusterPoolsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ClusterPoolsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates a cluster pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +func (client *ClusterPoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterPool ClusterPool, options *ClusterPoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterPoolName, clusterPool, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ClusterPoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterPool ClusterPool, options *ClusterPoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}" + 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 clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, clusterPool); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a Cluster Pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - options - ClusterPoolsClientBeginDeleteOptions contains the optional parameters for the ClusterPoolsClient.BeginDelete +// method. +func (client *ClusterPoolsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterPoolName string, options *ClusterPoolsClientBeginDeleteOptions) (*runtime.Poller[ClusterPoolsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterPoolName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ClusterPoolsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ClusterPoolsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a Cluster Pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +func (client *ClusterPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterPoolName string, options *ClusterPoolsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterPoolName, 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, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ClusterPoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, options *ClusterPoolsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}" + 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 clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a cluster pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - options - ClusterPoolsClientGetOptions contains the optional parameters for the ClusterPoolsClient.Get method. +func (client *ClusterPoolsClient) Get(ctx context.Context, resourceGroupName string, clusterPoolName string, options *ClusterPoolsClientGetOptions) (ClusterPoolsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterPoolName, options) + if err != nil { + return ClusterPoolsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClusterPoolsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClusterPoolsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ClusterPoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, options *ClusterPoolsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}" + 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 clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ClusterPoolsClient) getHandleResponse(resp *http.Response) (ClusterPoolsClientGetResponse, error) { + result := ClusterPoolsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterPool); err != nil { + return ClusterPoolsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists the HDInsight cluster pools under a resource group. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ClusterPoolsClientListByResourceGroupOptions contains the optional parameters for the ClusterPoolsClient.NewListByResourceGroupPager +// method. +func (client *ClusterPoolsClient) NewListByResourceGroupPager(resourceGroupName string, options *ClusterPoolsClientListByResourceGroupOptions) *runtime.Pager[ClusterPoolsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ClusterPoolsClientListByResourceGroupResponse]{ + More: func(page ClusterPoolsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClusterPoolsClientListByResourceGroupResponse) (ClusterPoolsClientListByResourceGroupResponse, 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 ClusterPoolsClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClusterPoolsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClusterPoolsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ClusterPoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClusterPoolsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools" + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ClusterPoolsClient) listByResourceGroupHandleResponse(resp *http.Response) (ClusterPoolsClientListByResourceGroupResponse, error) { + result := ClusterPoolsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterPoolListResult); err != nil { + return ClusterPoolsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Gets the list of Cluster Pools within a Subscription. +// +// Generated from API version 2023-06-01-preview +// - options - ClusterPoolsClientListBySubscriptionOptions contains the optional parameters for the ClusterPoolsClient.NewListBySubscriptionPager +// method. +func (client *ClusterPoolsClient) NewListBySubscriptionPager(options *ClusterPoolsClientListBySubscriptionOptions) *runtime.Pager[ClusterPoolsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ClusterPoolsClientListBySubscriptionResponse]{ + More: func(page ClusterPoolsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClusterPoolsClientListBySubscriptionResponse) (ClusterPoolsClientListBySubscriptionResponse, 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 ClusterPoolsClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClusterPoolsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClusterPoolsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ClusterPoolsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ClusterPoolsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusterpools" + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ClusterPoolsClient) listBySubscriptionHandleResponse(resp *http.Response) (ClusterPoolsClientListBySubscriptionResponse, error) { + result := ClusterPoolsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterPoolListResult); err != nil { + return ClusterPoolsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdateTags - Updates an existing Cluster Pool Tags. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - clusterPoolTags - Parameters supplied to update tags. +// - options - ClusterPoolsClientBeginUpdateTagsOptions contains the optional parameters for the ClusterPoolsClient.BeginUpdateTags +// method. +func (client *ClusterPoolsClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterPoolTags TagsObject, options *ClusterPoolsClientBeginUpdateTagsOptions) (*runtime.Poller[ClusterPoolsClientUpdateTagsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateTags(ctx, resourceGroupName, clusterPoolName, clusterPoolTags, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClusterPoolsClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ClusterPoolsClientUpdateTagsResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// UpdateTags - Updates an existing Cluster Pool Tags. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +func (client *ClusterPoolsClient) updateTags(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterPoolTags TagsObject, options *ClusterPoolsClientBeginUpdateTagsOptions) (*http.Response, error) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, clusterPoolName, clusterPoolTags, 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 +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ClusterPoolsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterPoolTags TagsObject, options *ClusterPoolsClientBeginUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, clusterPoolTags); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/clusters_client.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/clusters_client.go new file mode 100644 index 000000000000..083b4b6087b3 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/clusters_client.go @@ -0,0 +1,676 @@ +//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 armhdinsightonaks + +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" +) + +// ClustersClient contains the methods for the Clusters group. +// Don't use this type directly, use NewClustersClient() instead. +type ClustersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewClustersClient creates a new instance of ClustersClient 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 NewClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClustersClient, error) { + cl, err := arm.NewClient(moduleName+".ClustersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ClustersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - clusterName - The name of the HDInsight cluster. +// - hdInsightCluster - The cluster to create. +// - options - ClustersClientBeginCreateOptions contains the optional parameters for the ClustersClient.BeginCreate method. +func (client *ClustersClient) BeginCreate(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, hdInsightCluster Cluster, options *ClustersClientBeginCreateOptions) (*runtime.Poller[ClustersClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, clusterPoolName, clusterName, hdInsightCluster, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ClustersClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Create - Creates a cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +func (client *ClustersClient) create(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, hdInsightCluster Cluster, options *ClustersClientBeginCreateOptions) (*http.Response, error) { + var err error + req, err := client.createCreateRequest(ctx, resourceGroupName, clusterPoolName, clusterName, hdInsightCluster, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *ClustersClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, hdInsightCluster Cluster, options *ClustersClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}" + 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 clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, hdInsightCluster); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - clusterName - The name of the HDInsight cluster. +// - options - ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. +func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*runtime.Poller[ClustersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterPoolName, clusterName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ClustersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterPoolName, clusterName, 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, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}" + 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 clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a HDInsight cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - clusterName - The name of the HDInsight cluster. +// - options - ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. +func (client *ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, options *ClustersClientGetOptions) (ClustersClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterPoolName, clusterName, options) + if err != nil { + return ClustersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClustersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClustersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, options *ClustersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}" + 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 clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersClientGetResponse, error) { + result := ClustersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil { + return ClustersClientGetResponse{}, err + } + return result, nil +} + +// GetInstanceView - Gets the status of a cluster instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - clusterName - The name of the HDInsight cluster. +// - options - ClustersClientGetInstanceViewOptions contains the optional parameters for the ClustersClient.GetInstanceView +// method. +func (client *ClustersClient) GetInstanceView(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, options *ClustersClientGetInstanceViewOptions) (ClustersClientGetInstanceViewResponse, error) { + var err error + req, err := client.getInstanceViewCreateRequest(ctx, resourceGroupName, clusterPoolName, clusterName, options) + if err != nil { + return ClustersClientGetInstanceViewResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClustersClientGetInstanceViewResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClustersClientGetInstanceViewResponse{}, err + } + resp, err := client.getInstanceViewHandleResponse(httpResp) + return resp, err +} + +// getInstanceViewCreateRequest creates the GetInstanceView request. +func (client *ClustersClient) getInstanceViewCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, options *ClustersClientGetInstanceViewOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/instanceViews/default" + 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 clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getInstanceViewHandleResponse handles the GetInstanceView response. +func (client *ClustersClient) getInstanceViewHandleResponse(resp *http.Response) (ClustersClientGetInstanceViewResponse, error) { + result := ClustersClientGetInstanceViewResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterInstanceViewResult); err != nil { + return ClustersClientGetInstanceViewResponse{}, err + } + return result, nil +} + +// NewListByClusterPoolNamePager - Lists the HDInsight cluster pools under a resource group. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - options - ClustersClientListByClusterPoolNameOptions contains the optional parameters for the ClustersClient.NewListByClusterPoolNamePager +// method. +func (client *ClustersClient) NewListByClusterPoolNamePager(resourceGroupName string, clusterPoolName string, options *ClustersClientListByClusterPoolNameOptions) *runtime.Pager[ClustersClientListByClusterPoolNameResponse] { + return runtime.NewPager(runtime.PagingHandler[ClustersClientListByClusterPoolNameResponse]{ + More: func(page ClustersClientListByClusterPoolNameResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClustersClientListByClusterPoolNameResponse) (ClustersClientListByClusterPoolNameResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByClusterPoolNameCreateRequest(ctx, resourceGroupName, clusterPoolName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClustersClientListByClusterPoolNameResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClustersClientListByClusterPoolNameResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClustersClientListByClusterPoolNameResponse{}, runtime.NewResponseError(resp) + } + return client.listByClusterPoolNameHandleResponse(resp) + }, + }) +} + +// listByClusterPoolNameCreateRequest creates the ListByClusterPoolName request. +func (client *ClustersClient) listByClusterPoolNameCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, options *ClustersClientListByClusterPoolNameOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters" + 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 clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClusterPoolNameHandleResponse handles the ListByClusterPoolName response. +func (client *ClustersClient) listByClusterPoolNameHandleResponse(resp *http.Response) (ClustersClientListByClusterPoolNameResponse, error) { + result := ClustersClientListByClusterPoolNameResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterListResult); err != nil { + return ClustersClientListByClusterPoolNameResponse{}, err + } + return result, nil +} + +// NewListInstanceViewsPager - Lists the lists of instance views +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - clusterName - The name of the HDInsight cluster. +// - options - ClustersClientListInstanceViewsOptions contains the optional parameters for the ClustersClient.NewListInstanceViewsPager +// method. +func (client *ClustersClient) NewListInstanceViewsPager(resourceGroupName string, clusterPoolName string, clusterName string, options *ClustersClientListInstanceViewsOptions) *runtime.Pager[ClustersClientListInstanceViewsResponse] { + return runtime.NewPager(runtime.PagingHandler[ClustersClientListInstanceViewsResponse]{ + More: func(page ClustersClientListInstanceViewsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClustersClientListInstanceViewsResponse) (ClustersClientListInstanceViewsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listInstanceViewsCreateRequest(ctx, resourceGroupName, clusterPoolName, clusterName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClustersClientListInstanceViewsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClustersClientListInstanceViewsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClustersClientListInstanceViewsResponse{}, runtime.NewResponseError(resp) + } + return client.listInstanceViewsHandleResponse(resp) + }, + }) +} + +// listInstanceViewsCreateRequest creates the ListInstanceViews request. +func (client *ClustersClient) listInstanceViewsCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, options *ClustersClientListInstanceViewsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/instanceViews" + 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 clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listInstanceViewsHandleResponse handles the ListInstanceViews response. +func (client *ClustersClient) listInstanceViewsHandleResponse(resp *http.Response) (ClustersClientListInstanceViewsResponse, error) { + result := ClustersClientListInstanceViewsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterInstanceViewsResult); err != nil { + return ClustersClientListInstanceViewsResponse{}, err + } + return result, nil +} + +// NewListServiceConfigsPager - Lists the config dump of all services running in cluster. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - clusterName - The name of the HDInsight cluster. +// - options - ClustersClientListServiceConfigsOptions contains the optional parameters for the ClustersClient.NewListServiceConfigsPager +// method. +func (client *ClustersClient) NewListServiceConfigsPager(resourceGroupName string, clusterPoolName string, clusterName string, options *ClustersClientListServiceConfigsOptions) *runtime.Pager[ClustersClientListServiceConfigsResponse] { + return runtime.NewPager(runtime.PagingHandler[ClustersClientListServiceConfigsResponse]{ + More: func(page ClustersClientListServiceConfigsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClustersClientListServiceConfigsResponse) (ClustersClientListServiceConfigsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listServiceConfigsCreateRequest(ctx, resourceGroupName, clusterPoolName, clusterName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClustersClientListServiceConfigsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClustersClientListServiceConfigsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClustersClientListServiceConfigsResponse{}, runtime.NewResponseError(resp) + } + return client.listServiceConfigsHandleResponse(resp) + }, + }) +} + +// listServiceConfigsCreateRequest creates the ListServiceConfigs request. +func (client *ClustersClient) listServiceConfigsCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, options *ClustersClientListServiceConfigsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/serviceConfigs" + 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 clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listServiceConfigsHandleResponse handles the ListServiceConfigs response. +func (client *ClustersClient) listServiceConfigsHandleResponse(resp *http.Response) (ClustersClientListServiceConfigsResponse, error) { + result := ClustersClientListServiceConfigsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceConfigListResult); err != nil { + return ClustersClientListServiceConfigsResponse{}, err + } + return result, nil +} + +// BeginResize - Resize an existing Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - clusterName - The name of the HDInsight cluster. +// - clusterResizeRequest - Resize a cluster. +// - options - ClustersClientBeginResizeOptions contains the optional parameters for the ClustersClient.BeginResize method. +func (client *ClustersClient) BeginResize(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, clusterResizeRequest ClusterResizeData, options *ClustersClientBeginResizeOptions) (*runtime.Poller[ClustersClientResizeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resize(ctx, resourceGroupName, clusterPoolName, clusterName, clusterResizeRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientResizeResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ClustersClientResizeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Resize - Resize an existing Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +func (client *ClustersClient) resize(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, clusterResizeRequest ClusterResizeData, options *ClustersClientBeginResizeOptions) (*http.Response, error) { + var err error + req, err := client.resizeCreateRequest(ctx, resourceGroupName, clusterPoolName, clusterName, clusterResizeRequest, 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 +} + +// resizeCreateRequest creates the Resize request. +func (client *ClustersClient) resizeCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, clusterResizeRequest ClusterResizeData, options *ClustersClientBeginResizeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/resize" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, clusterResizeRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdate - Updates an existing Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterPoolName - The name of the cluster pool. +// - clusterName - The name of the HDInsight cluster. +// - clusterPatchRequest - Patch a cluster. +// - options - ClustersClientBeginUpdateOptions contains the optional parameters for the ClustersClient.BeginUpdate method. +func (client *ClustersClient) BeginUpdate(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, clusterPatchRequest ClusterPatch, options *ClustersClientBeginUpdateOptions) (*runtime.Poller[ClustersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, clusterPoolName, clusterName, clusterPatchRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ClustersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - Updates an existing Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +func (client *ClustersClient) update(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, clusterPatchRequest ClusterPatch, options *ClustersClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterPoolName, clusterName, clusterPatchRequest, 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 +} + +// updateCreateRequest creates the Update request. +func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterPoolName string, clusterName string, clusterPatchRequest ClusterPatch, options *ClustersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if clusterPoolName == "" { + return nil, errors.New("parameter clusterPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterPoolName}", url.PathEscape(clusterPoolName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, clusterPatchRequest); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/constants.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/constants.go new file mode 100644 index 000000000000..58bb21eba153 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/constants.go @@ -0,0 +1,245 @@ +//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 armhdinsightonaks + +const ( + moduleName = "armhdinsightonaks" + moduleVersion = "v0.1.0" +) + +// Action - A string property that indicates the action to be performed on the Flink job. It can have one of the following +// enum values => NEW, UPDATE, STATELESSUPDATE, STOP, START, CANCEL, SAVEPOINT, LIST +// SAVEPOINT, or DELETE. +type Action string + +const ( + ActionCANCEL Action = "CANCEL" + ActionDELETE Action = "DELETE" + ActionLISTSAVEPOINT Action = "LIST_SAVEPOINT" + ActionNEW Action = "NEW" + ActionSAVEPOINT Action = "SAVEPOINT" + ActionSTART Action = "START" + ActionSTATELESSUPDATE Action = "STATELESS_UPDATE" + ActionSTOP Action = "STOP" + ActionUPDATE Action = "UPDATE" +) + +// PossibleActionValues returns the possible values for the Action const type. +func PossibleActionValues() []Action { + return []Action{ + ActionCANCEL, + ActionDELETE, + ActionLISTSAVEPOINT, + ActionNEW, + ActionSAVEPOINT, + ActionSTART, + ActionSTATELESSUPDATE, + ActionSTOP, + ActionUPDATE, + } +} + +// 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, + } +} + +// AutoscaleType - User to specify which type of Autoscale to be implemented - Scheduled Based or Load Based. +type AutoscaleType string + +const ( + AutoscaleTypeLoadBased AutoscaleType = "LoadBased" + AutoscaleTypeScheduleBased AutoscaleType = "ScheduleBased" +) + +// PossibleAutoscaleTypeValues returns the possible values for the AutoscaleType const type. +func PossibleAutoscaleTypeValues() []AutoscaleType { + return []AutoscaleType{ + AutoscaleTypeLoadBased, + AutoscaleTypeScheduleBased, + } +} + +// ComparisonOperator - The comparison operator. +type ComparisonOperator string + +const ( + ComparisonOperatorGreaterThan ComparisonOperator = "greaterThan" + ComparisonOperatorGreaterThanOrEqual ComparisonOperator = "greaterThanOrEqual" + ComparisonOperatorLessThan ComparisonOperator = "lessThan" + ComparisonOperatorLessThanOrEqual ComparisonOperator = "lessThanOrEqual" +) + +// PossibleComparisonOperatorValues returns the possible values for the ComparisonOperator const type. +func PossibleComparisonOperatorValues() []ComparisonOperator { + return []ComparisonOperator{ + ComparisonOperatorGreaterThan, + ComparisonOperatorGreaterThanOrEqual, + ComparisonOperatorLessThan, + ComparisonOperatorLessThanOrEqual, + } +} + +// ContentEncoding - This property indicates if the content is encoded and is case-insensitive. Please set the value to base64 +// if the content is base64 encoded. Set it to none or skip it if the content is plain text. +type ContentEncoding string + +const ( + ContentEncodingBase64 ContentEncoding = "Base64" + ContentEncodingNone ContentEncoding = "None" +) + +// PossibleContentEncodingValues returns the possible values for the ContentEncoding const type. +func PossibleContentEncodingValues() []ContentEncoding { + return []ContentEncoding{ + ContentEncodingBase64, + ContentEncodingNone, + } +} + +// 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, + } +} + +// JobType - Type of cluster job. +type JobType string + +const ( + JobTypeFlinkJob JobType = "FlinkJob" +) + +// PossibleJobTypeValues returns the possible values for the JobType const type. +func PossibleJobTypeValues() []JobType { + return []JobType{ + JobTypeFlinkJob, + } +} + +// KeyVaultObjectType - Type of key vault object: secret, key or certificate. +type KeyVaultObjectType string + +const ( + KeyVaultObjectTypeCertificate KeyVaultObjectType = "Certificate" + KeyVaultObjectTypeKey KeyVaultObjectType = "Key" + KeyVaultObjectTypeSecret KeyVaultObjectType = "Secret" +) + +// PossibleKeyVaultObjectTypeValues returns the possible values for the KeyVaultObjectType const type. +func PossibleKeyVaultObjectTypeValues() []KeyVaultObjectType { + return []KeyVaultObjectType{ + KeyVaultObjectTypeCertificate, + KeyVaultObjectTypeKey, + KeyVaultObjectTypeSecret, + } +} + +// 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, + } +} + +// ProvisioningStatus - Provisioning state of the resource. +type ProvisioningStatus string + +const ( + ProvisioningStatusAccepted ProvisioningStatus = "Accepted" + ProvisioningStatusCanceled ProvisioningStatus = "Canceled" + ProvisioningStatusFailed ProvisioningStatus = "Failed" + ProvisioningStatusSucceeded ProvisioningStatus = "Succeeded" +) + +// PossibleProvisioningStatusValues returns the possible values for the ProvisioningStatus const type. +func PossibleProvisioningStatusValues() []ProvisioningStatus { + return []ProvisioningStatus{ + ProvisioningStatusAccepted, + ProvisioningStatusCanceled, + ProvisioningStatusFailed, + ProvisioningStatusSucceeded, + } +} + +// ScaleActionType - The action type. +type ScaleActionType string + +const ( + ScaleActionTypeScaledown ScaleActionType = "scaledown" + ScaleActionTypeScaleup ScaleActionType = "scaleup" +) + +// PossibleScaleActionTypeValues returns the possible values for the ScaleActionType const type. +func PossibleScaleActionTypeValues() []ScaleActionType { + return []ScaleActionType{ + ScaleActionTypeScaledown, + ScaleActionTypeScaleup, + } +} + +type ScheduleDay string + +const ( + ScheduleDayFriday ScheduleDay = "Friday" + ScheduleDayMonday ScheduleDay = "Monday" + ScheduleDaySaturday ScheduleDay = "Saturday" + ScheduleDaySunday ScheduleDay = "Sunday" + ScheduleDayThursday ScheduleDay = "Thursday" + ScheduleDayTuesday ScheduleDay = "Tuesday" + ScheduleDayWednesday ScheduleDay = "Wednesday" +) + +// PossibleScheduleDayValues returns the possible values for the ScheduleDay const type. +func PossibleScheduleDayValues() []ScheduleDay { + return []ScheduleDay{ + ScheduleDayFriday, + ScheduleDayMonday, + ScheduleDaySaturday, + ScheduleDaySunday, + ScheduleDayThursday, + ScheduleDayTuesday, + ScheduleDayWednesday, + } +} diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/go.mod b/sdk/resourcemanager/hdinsight/armhdinsightonaks/go.mod new file mode 100644 index 000000000000..a0821faf8e5d --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/go.mod @@ -0,0 +1,13 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsightonaks + +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/hdinsight/armhdinsightonaks/go.sum b/sdk/resourcemanager/hdinsight/armhdinsightonaks/go.sum new file mode 100644 index 000000000000..5c6bee428364 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/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/hdinsight/armhdinsightonaks/interfaces.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/interfaces.go new file mode 100644 index 000000000000..1d03106823f8 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/interfaces.go @@ -0,0 +1,18 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhdinsightonaks + +// ClusterJobPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetClusterJobProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ClusterJobProperties, *FlinkJobProperties +type ClusterJobPropertiesClassification interface { + // GetClusterJobProperties returns the ClusterJobProperties content of the underlying type. + GetClusterJobProperties() *ClusterJobProperties +} diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/locations_client.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/locations_client.go new file mode 100644 index 000000000000..4c208cf28344 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/locations_client.go @@ -0,0 +1,101 @@ +//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 armhdinsightonaks + +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" +) + +// LocationsClient contains the methods for the Locations group. +// Don't use this type directly, use NewLocationsClient() instead. +type LocationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewLocationsClient creates a new instance of LocationsClient 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 NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationsClient, error) { + cl, err := arm.NewClient(moduleName+".LocationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LocationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CheckNameAvailability - Check the availability of the resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - location - The name of the Azure region. +// - nameAvailabilityParameters - The name and type of the resource. +// - options - LocationsClientCheckNameAvailabilityOptions contains the optional parameters for the LocationsClient.CheckNameAvailability +// method. +func (client *LocationsClient) CheckNameAvailability(ctx context.Context, location string, nameAvailabilityParameters NameAvailabilityParameters, options *LocationsClientCheckNameAvailabilityOptions) (LocationsClientCheckNameAvailabilityResponse, error) { + var err error + req, err := client.checkNameAvailabilityCreateRequest(ctx, location, nameAvailabilityParameters, options) + if err != nil { + return LocationsClientCheckNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocationsClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LocationsClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *LocationsClient) checkNameAvailabilityCreateRequest(ctx context.Context, location string, nameAvailabilityParameters NameAvailabilityParameters, options *LocationsClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, nameAvailabilityParameters); err != nil { + return nil, err + } + return req, nil +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *LocationsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (LocationsClientCheckNameAvailabilityResponse, error) { + result := LocationsClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailabilityResult); err != nil { + return LocationsClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/models.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/models.go new file mode 100644 index 000000000000..e2750a3beff6 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/models.go @@ -0,0 +1,1211 @@ +//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 armhdinsightonaks + +import "time" + +// AksClusterProfileAksClusterAgentPoolIdentityProfile - Identity properties of the AKS cluster agentpool MSI +type AksClusterProfileAksClusterAgentPoolIdentityProfile struct { + // REQUIRED; ClientId of the MSI. + MsiClientID *string + + // REQUIRED; ObjectId of the MSI. + MsiObjectID *string + + // REQUIRED; ResourceId of the MSI. + MsiResourceID *string +} + +// AuthorizationProfile - Authorization profile with details of AAD user Ids and group Ids authorized for data plane access. +type AuthorizationProfile struct { + // AAD group Ids authorized for data plane access. + GroupIDs []*string + + // AAD user Ids authorized for data plane access. + UserIDs []*string +} + +// AutoscaleProfile - This is the Autoscale profile for the cluster. This will allow customer to create cluster enabled with +// Autoscale. +type AutoscaleProfile struct { + // REQUIRED; This indicates whether auto scale is enabled on HDInsight on AKS cluster. + Enabled *bool + + // User to specify which type of Autoscale to be implemented - Scheduled Based or Load Based. + AutoscaleType *AutoscaleType + + // This property is for graceful decommission timeout; It has a default setting of 3600 seconds before forced shutdown takes + // place. This is the maximal time to wait for running containers and + // applications to complete before transition a DECOMMISSIONING node into DECOMMISSIONED. The default value is 3600 seconds. + // Negative value (like -1) is handled as infinite timeout. + GracefulDecommissionTimeout *int32 + + // Profiles of load based Autoscale. + LoadBasedConfig *LoadBasedConfig + + // Profiles of schedule based Autoscale. + ScheduleBasedConfig *ScheduleBasedConfig +} + +// CatalogOptions - Trino cluster catalog options. +type CatalogOptions struct { + // hive catalog options. + Hive []*HiveCatalogOption +} + +// Cluster - The cluster. +type Cluster struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Gets or sets the properties. Define cluster specific properties. + Properties *ClusterResourceProperties + + // 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 +} + +type ClusterComponentsItem struct { + Name *string + Version *string +} + +// ClusterConfigFile - Cluster configuration files. +type ClusterConfigFile struct { + // REQUIRED; Configuration file name. + FileName *string + + // Free form content of the entire configuration file. + Content *string + + // This property indicates if the content is encoded and is case-insensitive. Please set the value to base64 if the content + // is base64 encoded. Set it to none or skip it if the content is plain text. + Encoding *ContentEncoding + + // Path of the config file if content is specified. + Path *string + + // List of key value pairs where key represents a valid service configuration name and value represents the value of the config. + Values map[string]*string +} + +// ClusterInstanceViewPropertiesStatus - Status of the instance view. +type ClusterInstanceViewPropertiesStatus struct { + // REQUIRED; The cluster ready status + Ready *string + + // The additional message. + Message *string + + // The status reason. + Reason *string +} + +// ClusterInstanceViewResult - Cluster Instance View. +type ClusterInstanceViewResult struct { + // REQUIRED; Name of the instance view. + Name *string + + // REQUIRED; Properties of the instance view. + Properties *ClusterInstanceViewResultProperties +} + +// ClusterInstanceViewResultProperties - Properties of the instance view. +type ClusterInstanceViewResultProperties struct { + // REQUIRED; List of statuses of relevant services that make up the HDInsight on aks cluster to surface to the customer. + ServiceStatuses []*ServiceStatus + + // REQUIRED; Status of the instance view. + Status *ClusterInstanceViewPropertiesStatus +} + +// ClusterInstanceViewsResult - The instance view of a HDInsight Cluster. +type ClusterInstanceViewsResult struct { + // Cluster instance view array. + Value []*ClusterInstanceViewResult + + // READ-ONLY; The link (url) to the next page of results. + NextLink *string +} + +// ClusterJob - Cluster job. +type ClusterJob struct { + // REQUIRED; Properties of cluster job. + Properties ClusterJobPropertiesClassification + + // 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 +} + +// ClusterJobList - Collection of cluster job. +type ClusterJobList struct { + // REQUIRED; Collection of cluster job. + Value []*ClusterJob + + // The Url of next result page. + NextLink *string +} + +// ClusterJobProperties - Properties of cluster job. +type ClusterJobProperties struct { + // REQUIRED; Type of cluster job. + JobType *JobType +} + +// GetClusterJobProperties implements the ClusterJobPropertiesClassification interface for type ClusterJobProperties. +func (c *ClusterJobProperties) GetClusterJobProperties() *ClusterJobProperties { return c } + +// ClusterListResult - The list cluster operation response. +type ClusterListResult struct { + // The list of clusters. + Value []*Cluster + + // READ-ONLY; The link (url) to the next page of results. + NextLink *string +} + +// ClusterLogAnalyticsApplicationLogs - Collection of logs to be enabled or disabled for log analytics. +type ClusterLogAnalyticsApplicationLogs struct { + // True if stderror is enabled, otherwise false. + StdErrorEnabled *bool + + // True if stdout is enabled, otherwise false. + StdOutEnabled *bool +} + +// ClusterLogAnalyticsProfile - Cluster log analytics profile to enable or disable OMS agent for cluster. +type ClusterLogAnalyticsProfile struct { + // REQUIRED; True if log analytics is enabled for the cluster, otherwise false. + Enabled *bool + + // Collection of logs to be enabled or disabled for log analytics. + ApplicationLogs *ClusterLogAnalyticsApplicationLogs + + // True if metrics are enabled, otherwise false. + MetricsEnabled *bool +} + +// ClusterPatch - The patch for a cluster. +type ClusterPatch struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Define cluster patch specific properties. + Properties *ClusterPatchProperties + + // 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 +} + +// ClusterPatchProperties - Cluster resource patch data. +type ClusterPatchProperties struct { + // Cluster resource patch properties. + ClusterProfile *UpdatableClusterProfile +} + +// ClusterPool - Cluster pool. +type ClusterPool struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Gets or sets the properties. Define cluster pool specific properties. + Properties *ClusterPoolResourceProperties + + // 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 +} + +// ClusterPoolListResult - The list cluster pools operation response. +type ClusterPoolListResult struct { + // The list of cluster pools. + Value []*ClusterPool + + // READ-ONLY; The link (url) to the next page of results. + NextLink *string +} + +// ClusterPoolResourceProperties - Cluster pool resource properties. +type ClusterPoolResourceProperties struct { + // REQUIRED; CLuster pool compute profile. + ComputeProfile *ClusterPoolResourcePropertiesComputeProfile + + // CLuster pool profile. + ClusterPoolProfile *ClusterPoolResourcePropertiesClusterPoolProfile + + // Cluster pool log analytics profile to enable OMS agent for AKS cluster. + LogAnalyticsProfile *ClusterPoolResourcePropertiesLogAnalyticsProfile + + // A resource group created by RP, to hold the resources created by RP on-behalf of customers. It will also be used to generate + // aksManagedResourceGroupName by pattern: MC{managedResourceGroupName} + // {clusterPoolName}_{region}. Please make sure it meets resource group name restriction. + ManagedResourceGroupName *string + + // Cluster pool network profile. + NetworkProfile *ClusterPoolResourcePropertiesNetworkProfile + + // READ-ONLY; Properties of underlying AKS cluster. + AksClusterProfile *ClusterPoolResourcePropertiesAksClusterProfile + + // READ-ONLY; A resource group created by AKS, to hold the infrastructure resources created by AKS on-behalf of customers. + // It is generated by cluster pool name and managed resource group name by pattern: MC + // {managedResourceGroupName}{clusterPoolName}_{region} + AksManagedResourceGroupName *string + + // READ-ONLY; A unique id generated by the RP to identify the resource. + DeploymentID *string + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningStatus + + // READ-ONLY; Business status of the resource. + Status *string +} + +// ClusterPoolResourcePropertiesAksClusterProfile - Properties of underlying AKS cluster. +type ClusterPoolResourcePropertiesAksClusterProfile struct { + // Identity properties of the AKS cluster agentpool MSI + AksClusterAgentPoolIdentityProfile *AksClusterProfileAksClusterAgentPoolIdentityProfile + + // ARM Resource ID of the AKS cluster + AksClusterResourceID *string + + // READ-ONLY; AKS control plane and default node pool version of this ClusterPool + AksVersion *string +} + +// ClusterPoolResourcePropertiesClusterPoolProfile - CLuster pool profile. +type ClusterPoolResourcePropertiesClusterPoolProfile struct { + // REQUIRED; Cluster pool version is a 2-part version. + ClusterPoolVersion *string +} + +// ClusterPoolResourcePropertiesComputeProfile - CLuster pool compute profile. +type ClusterPoolResourcePropertiesComputeProfile struct { + // REQUIRED; The virtual machine SKU. + VMSize *string + + // The number of virtual machines. + Count *int32 +} + +// ClusterPoolResourcePropertiesLogAnalyticsProfile - Cluster pool log analytics profile to enable OMS agent for AKS cluster. +type ClusterPoolResourcePropertiesLogAnalyticsProfile struct { + // REQUIRED; True if log analytics is enabled for cluster pool, otherwise false. + Enabled *bool + + // Log analytics workspace to associate with the OMS agent. + WorkspaceID *string +} + +// ClusterPoolResourcePropertiesNetworkProfile - Cluster pool network profile. +type ClusterPoolResourcePropertiesNetworkProfile struct { + // REQUIRED; Cluster pool subnet resource id. + SubnetID *string +} + +// ClusterPoolVersion - Available cluster pool version. +type ClusterPoolVersion struct { + // Cluster pool version properties. + Properties *ClusterPoolVersionProperties + + // 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 +} + +// ClusterPoolVersionProperties - Cluster pool version properties. +type ClusterPoolVersionProperties struct { + // AKS version. + AksVersion *string + + // Cluster pool version is a 2-part version. + ClusterPoolVersion *string + + // Indicate if this version is in preview or not. + IsPreview *bool +} + +// ClusterPoolVersionsListResult - Represents a list of cluster pool versions. +type ClusterPoolVersionsListResult struct { + // The list of cluster pool versions. + Value []*ClusterPoolVersion + + // READ-ONLY; The link (url) to the next page of results. + NextLink *string +} + +// ClusterProfile - Cluster profile. +type ClusterProfile struct { + // REQUIRED; Authorization profile with details of AAD user Ids and group Ids authorized for data plane access. + AuthorizationProfile *AuthorizationProfile + + // REQUIRED; Version with 3/4 part. + ClusterVersion *string + + // REQUIRED; Identity Profile with details of an MSI. + IdentityProfile *IdentityProfile + + // REQUIRED; Version with three part. + OssVersion *string + + // This is the Autoscale profile for the cluster. This will allow customer to create cluster enabled with Autoscale. + AutoscaleProfile *AutoscaleProfile + + // The Flink cluster profile. + FlinkProfile *FlinkProfile + + // Kafka cluster profile. + KafkaProfile map[string]any + + // LLAP cluster profile. + LlapProfile map[string]any + + // Cluster log analytics profile to enable or disable OMS agent for cluster. + LogAnalyticsProfile *ClusterLogAnalyticsProfile + + // Cluster Prometheus profile. + PrometheusProfile *ClusterPrometheusProfile + + // Ssh profile for the cluster. + SSHProfile *SSHProfile + + // The script action profile list. + ScriptActionProfiles []*ScriptActionProfile + + // The cluster secret profile. + SecretsProfile *SecretsProfile + + // The service configs profiles. + ServiceConfigsProfiles []*ClusterServiceConfigsProfile + + // The spark cluster profile. + SparkProfile *SparkProfile + + // Stub cluster profile. + StubProfile map[string]any + + // Trino Cluster profile. + TrinoProfile *TrinoProfile + + // READ-ONLY; Component list of this cluster type and version. + Components []*ClusterComponentsItem + + // READ-ONLY; Cluster connectivity profile. + ConnectivityProfile *ConnectivityProfile +} + +// ClusterPrometheusProfile - Cluster Prometheus profile. +type ClusterPrometheusProfile struct { + // REQUIRED; Enable Prometheus for cluster or not. + Enabled *bool +} + +// ClusterResizeData - The parameters for resizing a cluster. +type ClusterResizeData struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Sets the properties. Define cluster resize specific properties. + Properties *ClusterResizeProperties + + // 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 +} + +// ClusterResizeProperties - The properties for resizing a cluster. +type ClusterResizeProperties struct { + // REQUIRED; Target node count of worker node. + TargetWorkerNodeCount *int32 +} + +// ClusterResourceProperties - Cluster resource properties. +type ClusterResourceProperties struct { + // REQUIRED; Cluster profile. + ClusterProfile *ClusterProfile + + // REQUIRED; The type of cluster. + ClusterType *string + + // REQUIRED; The compute profile. + ComputeProfile *ComputeProfile + + // READ-ONLY; A unique id generated by the RP to identify the resource. + DeploymentID *string + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningStatus + + // READ-ONLY; Business status of the resource. + Status *string +} + +// ClusterServiceConfig - Cluster configs per component. +type ClusterServiceConfig struct { + // REQUIRED; Name of the component the config files should apply to. + Component *string + + // REQUIRED; List of Config Files. + Files []*ClusterConfigFile +} + +// ClusterServiceConfigsProfile - Cluster service configs. +type ClusterServiceConfigsProfile struct { + // REQUIRED; List of service configs. + Configs []*ClusterServiceConfig + + // REQUIRED; Name of the service the configurations should apply to. + ServiceName *string +} + +// ClusterVersion - Available cluster version. +type ClusterVersion struct { + // Cluster version properties. + Properties *ClusterVersionProperties + + // 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 +} + +// ClusterVersionProperties - Cluster version properties. +type ClusterVersionProperties struct { + // The two part cluster pool version. If the cluster version is before cluster pool version on-board, the return value will + // be empty string + ClusterPoolVersion *string + + // The type of cluster. + ClusterType *string + + // Version with three part. + ClusterVersion *string + + // Indicate if this version is in preview or not. + IsPreview *bool + + // Version with three part. + OssVersion *string + + // READ-ONLY; Component list of this cluster type and version. + Components []*ClusterComponentsItem +} + +// ClusterVersionsListResult - Represents a list of cluster versions. +type ClusterVersionsListResult struct { + // The list of cluster versions. + Value []*ClusterVersion + + // READ-ONLY; The link (url) to the next page of results. + NextLink *string +} + +// ComparisonRule - The comparison rule. +type ComparisonRule struct { + // REQUIRED; The comparison operator. + Operator *ComparisonOperator + + // REQUIRED; Threshold setting. + Threshold *float32 +} + +// ComputeProfile - The compute profile. +type ComputeProfile struct { + // REQUIRED; The nodes definitions. + Nodes []*NodeProfile +} + +// ComputeResourceDefinition - The cpu and memory requirement definition. +type ComputeResourceDefinition struct { + // REQUIRED; The required CPU. + CPU *float32 + + // REQUIRED; The required memory in MB, Container memory will be 110 percentile + Memory *int64 +} + +// ConnectivityProfile - Cluster connectivity profile. +type ConnectivityProfile struct { + // REQUIRED; Web connectivity endpoint details. + Web *ConnectivityProfileWeb + + // List of SSH connectivity endpoints. + SSH []*SSHConnectivityEndpoint +} + +// ConnectivityProfileWeb - Web connectivity endpoint details. +type ConnectivityProfileWeb struct { + // REQUIRED; Web connectivity endpoint. + Fqdn *string +} + +// FlinkCatalogOptions - Flink cluster catalog options. +type FlinkCatalogOptions struct { + // Hive Catalog Option for Flink cluster. + Hive *FlinkHiveCatalogOption +} + +// FlinkHiveCatalogOption - Hive Catalog Option for Flink cluster. +type FlinkHiveCatalogOption struct { + // REQUIRED; Secret reference name from secretsProfile.secrets containing password for database connection. + MetastoreDbConnectionPasswordSecret *string + + // REQUIRED; Connection string for hive metastore database. + MetastoreDbConnectionURL *string + + // REQUIRED; User name for database connection. + MetastoreDbConnectionUserName *string +} + +// FlinkJobProperties - Properties of flink job. +type FlinkJobProperties struct { + // REQUIRED; Name of job + JobName *string + + // REQUIRED; Type of cluster job. + JobType *JobType + + // A string property that indicates the action to be performed on the Flink job. It can have one of the following enum values + // => NEW, UPDATE, STATELESSUPDATE, STOP, START, CANCEL, SAVEPOINT, LIST + // SAVEPOINT, or DELETE. + Action *Action + + // A string property representing additional JVM arguments for the Flink job. It should be space separated value. + Args *string + + // A string property that specifies the entry class for the Flink job. + EntryClass *string + + // Additional properties used to configure Flink jobs. It allows users to set properties such as parallelism and jobSavePointDirectory. + // It accepts additional key-value pairs as properties, where the keys + // are strings and the values are strings as well. + FlinkConfiguration map[string]*string + + // A string property that represents the name of the job JAR. + JarName *string + + // A string property that specifies the directory where the job JAR is located. + JobJarDirectory *string + + // A string property that represents the name of the savepoint for the Flink job + SavePointName *string + + // READ-ONLY; Action result of job. + ActionResult *string + + // READ-ONLY; Unique id for identifying a job + JobID *string + + // READ-ONLY; Output of job. + JobOutput *string + + // READ-ONLY; The last savepoint. + LastSavePoint *string + + // READ-ONLY; Status of job. + Status *string +} + +// GetClusterJobProperties implements the ClusterJobPropertiesClassification interface for type FlinkJobProperties. +func (f *FlinkJobProperties) GetClusterJobProperties() *ClusterJobProperties { + return &ClusterJobProperties{ + JobType: f.JobType, + } +} + +// FlinkProfile - The Flink cluster profile. +type FlinkProfile struct { + // REQUIRED; Job Manager container/ process CPU and memory requirements + JobManager *ComputeResourceDefinition + + // REQUIRED; The storage profile + Storage *FlinkStorageProfile + + // REQUIRED; Task Manager container/ process CPU and memory requirements + TaskManager *ComputeResourceDefinition + + // Flink cluster catalog options. + CatalogOptions *FlinkCatalogOptions + + // History Server container/ process CPU and memory requirements + HistoryServer *ComputeResourceDefinition + + // The number of task managers. + NumReplicas *int32 +} + +// FlinkStorageProfile - The storage profile +type FlinkStorageProfile struct { + // REQUIRED; Storage account uri which is used for savepoint and checkpoint state. + StorageURI *string + + // Storage key is only required for wasb(s) storage. + Storagekey *string +} + +// HiveCatalogOption - Hive Catalog Option +type HiveCatalogOption struct { + // REQUIRED; Name of trino catalog which should use specified hive metastore. + CatalogName *string + + // REQUIRED; Secret reference name from secretsProfile.secrets containing password for database connection. + MetastoreDbConnectionPasswordSecret *string + + // REQUIRED; Connection string for hive metastore database. + MetastoreDbConnectionURL *string + + // REQUIRED; User name for database connection. + MetastoreDbConnectionUserName *string + + // REQUIRED; Metastore root directory URI, format: abfs[s]://@.dfs.core.windows.net/. More details: https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-introduction-abfs-uri + MetastoreWarehouseDir *string +} + +// IdentityProfile - Identity Profile with details of an MSI. +type IdentityProfile struct { + // REQUIRED; ClientId of the MSI. + MsiClientID *string + + // REQUIRED; ObjectId of the MSI. + MsiObjectID *string + + // REQUIRED; ResourceId of the MSI. + MsiResourceID *string +} + +// LoadBasedConfig - Profile of load based Autoscale. +type LoadBasedConfig struct { + // REQUIRED; User needs to set the maximum number of nodes for load based scaling, the load based scaling will use this to + // scale up and scale down between minimum and maximum number of nodes. + MaxNodes *int32 + + // REQUIRED; User needs to set the minimum number of nodes for load based scaling, the load based scaling will use this to + // scale up and scale down between minimum and maximum number of nodes. + MinNodes *int32 + + // REQUIRED; The scaling rules. + ScalingRules []*ScalingRule + + // This is a cool down period, this is a time period in seconds, which determines the amount of time that must elapse between + // a scaling activity started by a rule and the start of the next scaling + // activity, regardless of the rule that triggers it. The default value is 300 seconds. + CooldownPeriod *int32 + + // User can specify the poll interval, this is the time period (in seconds) after which scaling metrics are polled for triggering + // a scaling operation. + PollInterval *int32 +} + +// NameAvailabilityParameters - Details of check name availability request body. +type NameAvailabilityParameters struct { + // Name for checking availability. + Name *string + + // The resource type in Microsoft.HDInsight. + Type *string +} + +// NameAvailabilityResult - Result of check name availability. +type NameAvailabilityResult struct { + // The error message of unavailability. + Message *string + + // Indicator of availability of the Microsoft.HDInsight resource name. + NameAvailable *bool + + // The reason of unavailability. + Reason *string +} + +// NodeProfile - The node profile. +type NodeProfile struct { + // REQUIRED; The number of virtual machines. + Count *int32 + + // REQUIRED; The node type. + Type *string + + // REQUIRED; The virtual machine SKU. + VMSize *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 +} + +// SSHConnectivityEndpoint - SSH connectivity endpoint details. +type SSHConnectivityEndpoint struct { + // REQUIRED; SSH connectivity endpoint. + Endpoint *string +} + +// SSHProfile - Ssh profile for the cluster. +type SSHProfile struct { + // REQUIRED; Number of ssh pods per cluster. + Count *int32 + + // READ-ONLY; Prefix of the pod names. Pod number will be appended to the prefix. The ingress URLs for the pods will be available + // at //- + PodPrefix *string +} + +// ScalingRule - The scaling rule. +type ScalingRule struct { + // REQUIRED; The action type. + ActionType *ScaleActionType + + // REQUIRED; The comparison rule. + ComparisonRule *ComparisonRule + + // REQUIRED; This is an evaluation count for a scaling condition, the number of times a trigger condition should be successful, + // before scaling activity is triggered. + EvaluationCount *int32 + + // REQUIRED; Metrics name for individual workloads. For example: cpu + ScalingMetric *string +} + +// Schedule definition. +type Schedule struct { + // REQUIRED; User has to set the node count anticipated at end of the scaling operation of the set current schedule configuration, + // format is integer. + Count *int32 + + // REQUIRED; User has to set the days where schedule has to be set for autoscale operation. + Days []*ScheduleDay + + // REQUIRED; User has to set the end time of current schedule configuration, format like 10:30 (HH:MM). + EndTime *string + + // REQUIRED; User has to set the start time of current schedule configuration, format like 10:30 (HH:MM). + StartTime *string +} + +// ScheduleBasedConfig - Profile of schedule based Autoscale. +type ScheduleBasedConfig struct { + // REQUIRED; Setting default node count of current schedule configuration. Default node count specifies the number of nodes + // which are default when an specified scaling operation is executed (scale up/scale down) + DefaultCount *int32 + + // REQUIRED; This specifies the schedules where scheduled based Autoscale to be enabled, the user has a choice to set multiple + // rules within the schedule across days and times (start/end). + Schedules []*Schedule + + // REQUIRED; User has to specify the timezone on which the schedule has to be set for schedule based autoscale configuration. + TimeZone *string +} + +// ScriptActionProfile - The script action profile. +type ScriptActionProfile struct { + // REQUIRED; Script name. + Name *string + + // REQUIRED; List of services to apply the script action. + Services []*string + + // REQUIRED; Type of the script action. Supported type is bash scripts. + Type *string + + // REQUIRED; Url of the script file. + URL *string + + // Additional parameters for the script action. It should be space-separated list of arguments required for script execution. + Parameters *string + + // Specify if the script should persist on the cluster. + ShouldPersist *bool + + // Timeout duration for the script action in minutes. + TimeoutInMinutes *int32 +} + +// SecretReference - Secret reference and corresponding properties of a key vault secret. +type SecretReference struct { + // REQUIRED; Object identifier name of the secret in key vault. + KeyVaultObjectName *string + + // REQUIRED; Reference name of the secret to be used in service configs. + ReferenceName *string + + // REQUIRED; Type of key vault object: secret, key or certificate. + Type *KeyVaultObjectType + + // Version of the secret in key vault. + Version *string +} + +// SecretsProfile - The cluster secret profile. +type SecretsProfile struct { + // REQUIRED; Name of the user Key Vault where all the cluster specific user secrets are stored. + KeyVaultResourceID *string + + // Properties of Key Vault secret. + Secrets []*SecretReference +} + +// ServiceConfigListResult - Cluster instance service configs api response. +type ServiceConfigListResult struct { + // Cluster instance service config array. + Value []*ServiceConfigResult + + // READ-ONLY; The link (url) to the next page of results. + NextLink *string +} + +// ServiceConfigListResultValueEntity - Default config details. +type ServiceConfigListResultValueEntity struct { + // REQUIRED; Config value. + Value *string + + // Config description. + Description *string +} + +// ServiceConfigResult - Cluster instance service config. +type ServiceConfigResult struct { + // Cluster instance service config properties. + Properties *ServiceConfigResultProperties +} + +// ServiceConfigResultProperties - Cluster instance service config properties. +type ServiceConfigResultProperties struct { + // REQUIRED; Component Name. + ComponentName *string + + // REQUIRED; File Name. + FileName *string + + // REQUIRED; Service Config Name. + ServiceName *string + + // Content in the service config file. + Content *string + + // The custom keys. + CustomKeys map[string]*string + + // The default keys. + DefaultKeys map[string]*ServiceConfigListResultValueEntity + + // Config file path. + Path *string + + // Config type. + Type *string +} + +// ServiceStatus - Describes the status of a service of a HDInsight on aks cluster. +type ServiceStatus struct { + // REQUIRED; Kind of the service. E.g. "Zookeeper". + Kind *string + + // REQUIRED; Indicates if the service is ready / healthy. Values can be "true", "false", "unknown" or anything else. + Ready *string + + // A message describing the error if any. + Message *string +} + +// SparkMetastoreSpec - The metastore specification for Spark cluster. +type SparkMetastoreSpec struct { + // REQUIRED; The secret name which contains the database user password. + DbPasswordSecretName *string + + // REQUIRED; The database server host. + DbServerHost *string + + // REQUIRED; The database user name. + DbUserName *string + + // REQUIRED; The key vault resource id. + KeyVaultID *string + + // The database name. + DbName *string + + // The thrift url. + ThriftURL *string +} + +// SparkProfile - The spark cluster profile. +type SparkProfile struct { + // The default storage URL. + DefaultStorageURL *string + + // The metastore specification for Spark cluster. + MetastoreSpec *SparkMetastoreSpec + + // Spark user plugins spec + UserPluginsSpec *SparkUserPlugins +} + +// SparkUserPlugin - Spark user plugin. +type SparkUserPlugin struct { + // REQUIRED; Fully qualified path to the folder containing the plugins. + Path *string +} + +// SparkUserPlugins - Spark user plugins spec +type SparkUserPlugins struct { + // Spark user plugins. + Plugins []*SparkUserPlugin +} + +// 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 +} + +// TagsObject - Tags object for patch operations. +type TagsObject struct { + // Resource tags. + Tags map[string]*string +} + +// TrinoCoordinator - Trino Coordinator. +type TrinoCoordinator struct { + // Trino debug configuration. + Debug *TrinoDebugConfig + + // The flag that if enable coordinator HA, uses multiple coordinator replicas with auto failover, one per each head node. + // Default: true. + HighAvailabilityEnabled *bool +} + +// TrinoDebugConfig - Trino debug configuration. +type TrinoDebugConfig struct { + // The flag that if enable debug or not. + Enable *bool + + // The debug port. + Port *int32 + + // The flag that if suspend debug or not. + Suspend *bool +} + +// TrinoProfile - Trino Cluster profile. +type TrinoProfile struct { + // Trino cluster catalog options. + CatalogOptions *CatalogOptions + + // Trino Coordinator. + Coordinator *TrinoCoordinator + + // Trino user plugins spec + UserPluginsSpec *TrinoUserPlugins + + // User telemetry + UserTelemetrySpec *TrinoUserTelemetry + + // Trino worker. + Worker *TrinoWorker +} + +// TrinoTelemetryConfig - Trino user telemetry definition. +type TrinoTelemetryConfig struct { + // Hive Catalog name used to mount external tables on the logs written by trino, if not specified there tables are not created. + HivecatalogName *string + + // Schema of the above catalog to use, to mount query logs as external tables, if not specified tables will be mounted under + // schema trinologs. + HivecatalogSchema *string + + // Retention period for query log table partitions, this doesn't have any affect on actual data. + PartitionRetentionInDays *int32 + + // Azure storage location of the blobs. + Path *string +} + +// TrinoUserPlugin - Trino user plugin. +type TrinoUserPlugin struct { + // Denotes whether the plugin is active or not. + Enabled *bool + + // This field maps to the sub-directory in trino plugins location, that will contain all the plugins under path. + Name *string + + // Fully qualified path to the folder containing the plugins. + Path *string +} + +// TrinoUserPlugins - Trino user plugins spec +type TrinoUserPlugins struct { + // Trino user plugins. + Plugins []*TrinoUserPlugin +} + +// TrinoUserTelemetry - User telemetry +type TrinoUserTelemetry struct { + // Trino user telemetry definition. + Storage *TrinoTelemetryConfig +} + +// TrinoWorker - Trino worker. +type TrinoWorker struct { + // Trino debug configuration. + Debug *TrinoDebugConfig +} + +// UpdatableClusterProfile - Cluster resource patch properties. +type UpdatableClusterProfile struct { + // Authorization profile with details of AAD user Ids and group Ids authorized for data plane access. + AuthorizationProfile *AuthorizationProfile + + // This is the Autoscale profile for the cluster. This will allow customer to create cluster enabled with Autoscale. + AutoscaleProfile *AutoscaleProfile + + // Cluster log analytics profile to enable or disable OMS agent for cluster. + LogAnalyticsProfile *ClusterLogAnalyticsProfile + + // Cluster Prometheus profile. + PrometheusProfile *ClusterPrometheusProfile + + // Ssh profile for the cluster. + SSHProfile *SSHProfile + + // The script action profile list. + ScriptActionProfiles []*ScriptActionProfile + + // The service configs profiles. + ServiceConfigsProfiles []*ClusterServiceConfigsProfile +} diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/models_serde.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/models_serde.go new file mode 100644 index 000000000000..8f921c41b935 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/models_serde.go @@ -0,0 +1,3237 @@ +//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 armhdinsightonaks + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AksClusterProfileAksClusterAgentPoolIdentityProfile. +func (a AksClusterProfileAksClusterAgentPoolIdentityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "msiClientId", a.MsiClientID) + populate(objectMap, "msiObjectId", a.MsiObjectID) + populate(objectMap, "msiResourceId", a.MsiResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AksClusterProfileAksClusterAgentPoolIdentityProfile. +func (a *AksClusterProfileAksClusterAgentPoolIdentityProfile) 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 "msiClientId": + err = unpopulate(val, "MsiClientID", &a.MsiClientID) + delete(rawMsg, key) + case "msiObjectId": + err = unpopulate(val, "MsiObjectID", &a.MsiObjectID) + delete(rawMsg, key) + case "msiResourceId": + err = unpopulate(val, "MsiResourceID", &a.MsiResourceID) + 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 AuthorizationProfile. +func (a AuthorizationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", a.GroupIDs) + populate(objectMap, "userIds", a.UserIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationProfile. +func (a *AuthorizationProfile) 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 "groupIds": + err = unpopulate(val, "GroupIDs", &a.GroupIDs) + delete(rawMsg, key) + case "userIds": + err = unpopulate(val, "UserIDs", &a.UserIDs) + 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 AutoscaleProfile. +func (a AutoscaleProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "autoscaleType", a.AutoscaleType) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "gracefulDecommissionTimeout", a.GracefulDecommissionTimeout) + populate(objectMap, "loadBasedConfig", a.LoadBasedConfig) + populate(objectMap, "scheduleBasedConfig", a.ScheduleBasedConfig) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleProfile. +func (a *AutoscaleProfile) 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 "autoscaleType": + err = unpopulate(val, "AutoscaleType", &a.AutoscaleType) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "gracefulDecommissionTimeout": + err = unpopulate(val, "GracefulDecommissionTimeout", &a.GracefulDecommissionTimeout) + delete(rawMsg, key) + case "loadBasedConfig": + err = unpopulate(val, "LoadBasedConfig", &a.LoadBasedConfig) + delete(rawMsg, key) + case "scheduleBasedConfig": + err = unpopulate(val, "ScheduleBasedConfig", &a.ScheduleBasedConfig) + 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 CatalogOptions. +func (c CatalogOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hive", c.Hive) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CatalogOptions. +func (c *CatalogOptions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hive": + err = unpopulate(val, "Hive", &c.Hive) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Cluster. +func (c Cluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Cluster. +func (c *Cluster) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterComponentsItem. +func (c ClusterComponentsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populate(objectMap, "version", c.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterComponentsItem. +func (c *ClusterComponentsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &c.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterConfigFile. +func (c ClusterConfigFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "content", c.Content) + populate(objectMap, "encoding", c.Encoding) + populate(objectMap, "fileName", c.FileName) + populate(objectMap, "path", c.Path) + populate(objectMap, "values", c.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterConfigFile. +func (c *ClusterConfigFile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "content": + err = unpopulate(val, "Content", &c.Content) + delete(rawMsg, key) + case "encoding": + err = unpopulate(val, "Encoding", &c.Encoding) + delete(rawMsg, key) + case "fileName": + err = unpopulate(val, "FileName", &c.FileName) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &c.Path) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &c.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterInstanceViewPropertiesStatus. +func (c ClusterInstanceViewPropertiesStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", c.Message) + populate(objectMap, "ready", c.Ready) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterInstanceViewPropertiesStatus. +func (c *ClusterInstanceViewPropertiesStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "ready": + err = unpopulate(val, "Ready", &c.Ready) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterInstanceViewResult. +func (c ClusterInstanceViewResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterInstanceViewResult. +func (c *ClusterInstanceViewResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterInstanceViewResultProperties. +func (c ClusterInstanceViewResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "serviceStatuses", c.ServiceStatuses) + populate(objectMap, "status", c.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterInstanceViewResultProperties. +func (c *ClusterInstanceViewResultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "serviceStatuses": + err = unpopulate(val, "ServiceStatuses", &c.ServiceStatuses) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterInstanceViewsResult. +func (c ClusterInstanceViewsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterInstanceViewsResult. +func (c *ClusterInstanceViewsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterJob. +func (c ClusterJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterJob. +func (c *ClusterJob) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + c.Properties, err = unmarshalClusterJobPropertiesClassification(val) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterJobList. +func (c ClusterJobList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterJobList. +func (c *ClusterJobList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterJobProperties. +func (c ClusterJobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["jobType"] = c.JobType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterJobProperties. +func (c *ClusterJobProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "jobType": + err = unpopulate(val, "JobType", &c.JobType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterListResult. +func (c ClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterListResult. +func (c *ClusterListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterLogAnalyticsApplicationLogs. +func (c ClusterLogAnalyticsApplicationLogs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "stdErrorEnabled", c.StdErrorEnabled) + populate(objectMap, "stdOutEnabled", c.StdOutEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterLogAnalyticsApplicationLogs. +func (c *ClusterLogAnalyticsApplicationLogs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "stdErrorEnabled": + err = unpopulate(val, "StdErrorEnabled", &c.StdErrorEnabled) + delete(rawMsg, key) + case "stdOutEnabled": + err = unpopulate(val, "StdOutEnabled", &c.StdOutEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterLogAnalyticsProfile. +func (c ClusterLogAnalyticsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicationLogs", c.ApplicationLogs) + populate(objectMap, "enabled", c.Enabled) + populate(objectMap, "metricsEnabled", c.MetricsEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterLogAnalyticsProfile. +func (c *ClusterLogAnalyticsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationLogs": + err = unpopulate(val, "ApplicationLogs", &c.ApplicationLogs) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &c.Enabled) + delete(rawMsg, key) + case "metricsEnabled": + err = unpopulate(val, "MetricsEnabled", &c.MetricsEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPatch. +func (c ClusterPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPatch. +func (c *ClusterPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPatchProperties. +func (c ClusterPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterProfile", c.ClusterProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPatchProperties. +func (c *ClusterPatchProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterProfile": + err = unpopulate(val, "ClusterProfile", &c.ClusterProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPool. +func (c ClusterPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPool. +func (c *ClusterPool) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPoolListResult. +func (c ClusterPoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPoolListResult. +func (c *ClusterPoolListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPoolResourceProperties. +func (c ClusterPoolResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aksClusterProfile", c.AksClusterProfile) + populate(objectMap, "aksManagedResourceGroupName", c.AksManagedResourceGroupName) + populate(objectMap, "clusterPoolProfile", c.ClusterPoolProfile) + populate(objectMap, "computeProfile", c.ComputeProfile) + populate(objectMap, "deploymentId", c.DeploymentID) + populate(objectMap, "logAnalyticsProfile", c.LogAnalyticsProfile) + populate(objectMap, "managedResourceGroupName", c.ManagedResourceGroupName) + populate(objectMap, "networkProfile", c.NetworkProfile) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "status", c.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPoolResourceProperties. +func (c *ClusterPoolResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aksClusterProfile": + err = unpopulate(val, "AksClusterProfile", &c.AksClusterProfile) + delete(rawMsg, key) + case "aksManagedResourceGroupName": + err = unpopulate(val, "AksManagedResourceGroupName", &c.AksManagedResourceGroupName) + delete(rawMsg, key) + case "clusterPoolProfile": + err = unpopulate(val, "ClusterPoolProfile", &c.ClusterPoolProfile) + delete(rawMsg, key) + case "computeProfile": + err = unpopulate(val, "ComputeProfile", &c.ComputeProfile) + delete(rawMsg, key) + case "deploymentId": + err = unpopulate(val, "DeploymentID", &c.DeploymentID) + delete(rawMsg, key) + case "logAnalyticsProfile": + err = unpopulate(val, "LogAnalyticsProfile", &c.LogAnalyticsProfile) + delete(rawMsg, key) + case "managedResourceGroupName": + err = unpopulate(val, "ManagedResourceGroupName", &c.ManagedResourceGroupName) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &c.NetworkProfile) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPoolResourcePropertiesAksClusterProfile. +func (c ClusterPoolResourcePropertiesAksClusterProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aksClusterAgentPoolIdentityProfile", c.AksClusterAgentPoolIdentityProfile) + populate(objectMap, "aksClusterResourceId", c.AksClusterResourceID) + populate(objectMap, "aksVersion", c.AksVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPoolResourcePropertiesAksClusterProfile. +func (c *ClusterPoolResourcePropertiesAksClusterProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aksClusterAgentPoolIdentityProfile": + err = unpopulate(val, "AksClusterAgentPoolIdentityProfile", &c.AksClusterAgentPoolIdentityProfile) + delete(rawMsg, key) + case "aksClusterResourceId": + err = unpopulate(val, "AksClusterResourceID", &c.AksClusterResourceID) + delete(rawMsg, key) + case "aksVersion": + err = unpopulate(val, "AksVersion", &c.AksVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPoolResourcePropertiesClusterPoolProfile. +func (c ClusterPoolResourcePropertiesClusterPoolProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterPoolVersion", c.ClusterPoolVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPoolResourcePropertiesClusterPoolProfile. +func (c *ClusterPoolResourcePropertiesClusterPoolProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterPoolVersion": + err = unpopulate(val, "ClusterPoolVersion", &c.ClusterPoolVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPoolResourcePropertiesComputeProfile. +func (c ClusterPoolResourcePropertiesComputeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", c.Count) + populate(objectMap, "vmSize", c.VMSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPoolResourcePropertiesComputeProfile. +func (c *ClusterPoolResourcePropertiesComputeProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &c.Count) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &c.VMSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPoolResourcePropertiesLogAnalyticsProfile. +func (c ClusterPoolResourcePropertiesLogAnalyticsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", c.Enabled) + populate(objectMap, "workspaceId", c.WorkspaceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPoolResourcePropertiesLogAnalyticsProfile. +func (c *ClusterPoolResourcePropertiesLogAnalyticsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &c.Enabled) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &c.WorkspaceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPoolResourcePropertiesNetworkProfile. +func (c ClusterPoolResourcePropertiesNetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "subnetId", c.SubnetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPoolResourcePropertiesNetworkProfile. +func (c *ClusterPoolResourcePropertiesNetworkProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "subnetId": + err = unpopulate(val, "SubnetID", &c.SubnetID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPoolVersion. +func (c ClusterPoolVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPoolVersion. +func (c *ClusterPoolVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPoolVersionProperties. +func (c ClusterPoolVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aksVersion", c.AksVersion) + populate(objectMap, "clusterPoolVersion", c.ClusterPoolVersion) + populate(objectMap, "isPreview", c.IsPreview) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPoolVersionProperties. +func (c *ClusterPoolVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aksVersion": + err = unpopulate(val, "AksVersion", &c.AksVersion) + delete(rawMsg, key) + case "clusterPoolVersion": + err = unpopulate(val, "ClusterPoolVersion", &c.ClusterPoolVersion) + delete(rawMsg, key) + case "isPreview": + err = unpopulate(val, "IsPreview", &c.IsPreview) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPoolVersionsListResult. +func (c ClusterPoolVersionsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPoolVersionsListResult. +func (c *ClusterPoolVersionsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterProfile. +func (c ClusterProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authorizationProfile", c.AuthorizationProfile) + populate(objectMap, "autoscaleProfile", c.AutoscaleProfile) + populate(objectMap, "clusterVersion", c.ClusterVersion) + populate(objectMap, "components", c.Components) + populate(objectMap, "connectivityProfile", c.ConnectivityProfile) + populate(objectMap, "flinkProfile", c.FlinkProfile) + populate(objectMap, "identityProfile", c.IdentityProfile) + populate(objectMap, "kafkaProfile", c.KafkaProfile) + populate(objectMap, "llapProfile", c.LlapProfile) + populate(objectMap, "logAnalyticsProfile", c.LogAnalyticsProfile) + populate(objectMap, "ossVersion", c.OssVersion) + populate(objectMap, "prometheusProfile", c.PrometheusProfile) + populate(objectMap, "sshProfile", c.SSHProfile) + populate(objectMap, "scriptActionProfiles", c.ScriptActionProfiles) + populate(objectMap, "secretsProfile", c.SecretsProfile) + populate(objectMap, "serviceConfigsProfiles", c.ServiceConfigsProfiles) + populate(objectMap, "sparkProfile", c.SparkProfile) + populate(objectMap, "stubProfile", c.StubProfile) + populate(objectMap, "trinoProfile", c.TrinoProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterProfile. +func (c *ClusterProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizationProfile": + err = unpopulate(val, "AuthorizationProfile", &c.AuthorizationProfile) + delete(rawMsg, key) + case "autoscaleProfile": + err = unpopulate(val, "AutoscaleProfile", &c.AutoscaleProfile) + delete(rawMsg, key) + case "clusterVersion": + err = unpopulate(val, "ClusterVersion", &c.ClusterVersion) + delete(rawMsg, key) + case "components": + err = unpopulate(val, "Components", &c.Components) + delete(rawMsg, key) + case "connectivityProfile": + err = unpopulate(val, "ConnectivityProfile", &c.ConnectivityProfile) + delete(rawMsg, key) + case "flinkProfile": + err = unpopulate(val, "FlinkProfile", &c.FlinkProfile) + delete(rawMsg, key) + case "identityProfile": + err = unpopulate(val, "IdentityProfile", &c.IdentityProfile) + delete(rawMsg, key) + case "kafkaProfile": + err = unpopulate(val, "KafkaProfile", &c.KafkaProfile) + delete(rawMsg, key) + case "llapProfile": + err = unpopulate(val, "LlapProfile", &c.LlapProfile) + delete(rawMsg, key) + case "logAnalyticsProfile": + err = unpopulate(val, "LogAnalyticsProfile", &c.LogAnalyticsProfile) + delete(rawMsg, key) + case "ossVersion": + err = unpopulate(val, "OssVersion", &c.OssVersion) + delete(rawMsg, key) + case "prometheusProfile": + err = unpopulate(val, "PrometheusProfile", &c.PrometheusProfile) + delete(rawMsg, key) + case "sshProfile": + err = unpopulate(val, "SSHProfile", &c.SSHProfile) + delete(rawMsg, key) + case "scriptActionProfiles": + err = unpopulate(val, "ScriptActionProfiles", &c.ScriptActionProfiles) + delete(rawMsg, key) + case "secretsProfile": + err = unpopulate(val, "SecretsProfile", &c.SecretsProfile) + delete(rawMsg, key) + case "serviceConfigsProfiles": + err = unpopulate(val, "ServiceConfigsProfiles", &c.ServiceConfigsProfiles) + delete(rawMsg, key) + case "sparkProfile": + err = unpopulate(val, "SparkProfile", &c.SparkProfile) + delete(rawMsg, key) + case "stubProfile": + err = unpopulate(val, "StubProfile", &c.StubProfile) + delete(rawMsg, key) + case "trinoProfile": + err = unpopulate(val, "TrinoProfile", &c.TrinoProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPrometheusProfile. +func (c ClusterPrometheusProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", c.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPrometheusProfile. +func (c *ClusterPrometheusProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &c.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterResizeData. +func (c ClusterResizeData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterResizeData. +func (c *ClusterResizeData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterResizeProperties. +func (c ClusterResizeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "targetWorkerNodeCount", c.TargetWorkerNodeCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterResizeProperties. +func (c *ClusterResizeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "targetWorkerNodeCount": + err = unpopulate(val, "TargetWorkerNodeCount", &c.TargetWorkerNodeCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterResourceProperties. +func (c ClusterResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterProfile", c.ClusterProfile) + populate(objectMap, "clusterType", c.ClusterType) + populate(objectMap, "computeProfile", c.ComputeProfile) + populate(objectMap, "deploymentId", c.DeploymentID) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "status", c.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterResourceProperties. +func (c *ClusterResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterProfile": + err = unpopulate(val, "ClusterProfile", &c.ClusterProfile) + delete(rawMsg, key) + case "clusterType": + err = unpopulate(val, "ClusterType", &c.ClusterType) + delete(rawMsg, key) + case "computeProfile": + err = unpopulate(val, "ComputeProfile", &c.ComputeProfile) + delete(rawMsg, key) + case "deploymentId": + err = unpopulate(val, "DeploymentID", &c.DeploymentID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterServiceConfig. +func (c ClusterServiceConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "component", c.Component) + populate(objectMap, "files", c.Files) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterServiceConfig. +func (c *ClusterServiceConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "component": + err = unpopulate(val, "Component", &c.Component) + delete(rawMsg, key) + case "files": + err = unpopulate(val, "Files", &c.Files) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterServiceConfigsProfile. +func (c ClusterServiceConfigsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "configs", c.Configs) + populate(objectMap, "serviceName", c.ServiceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterServiceConfigsProfile. +func (c *ClusterServiceConfigsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configs": + err = unpopulate(val, "Configs", &c.Configs) + delete(rawMsg, key) + case "serviceName": + err = unpopulate(val, "ServiceName", &c.ServiceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterVersion. +func (c ClusterVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterVersion. +func (c *ClusterVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterVersionProperties. +func (c ClusterVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterPoolVersion", c.ClusterPoolVersion) + populate(objectMap, "clusterType", c.ClusterType) + populate(objectMap, "clusterVersion", c.ClusterVersion) + populate(objectMap, "components", c.Components) + populate(objectMap, "isPreview", c.IsPreview) + populate(objectMap, "ossVersion", c.OssVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterVersionProperties. +func (c *ClusterVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterPoolVersion": + err = unpopulate(val, "ClusterPoolVersion", &c.ClusterPoolVersion) + delete(rawMsg, key) + case "clusterType": + err = unpopulate(val, "ClusterType", &c.ClusterType) + delete(rawMsg, key) + case "clusterVersion": + err = unpopulate(val, "ClusterVersion", &c.ClusterVersion) + delete(rawMsg, key) + case "components": + err = unpopulate(val, "Components", &c.Components) + delete(rawMsg, key) + case "isPreview": + err = unpopulate(val, "IsPreview", &c.IsPreview) + delete(rawMsg, key) + case "ossVersion": + err = unpopulate(val, "OssVersion", &c.OssVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterVersionsListResult. +func (c ClusterVersionsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterVersionsListResult. +func (c *ClusterVersionsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComparisonRule. +func (c ComparisonRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operator", c.Operator) + populate(objectMap, "threshold", c.Threshold) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComparisonRule. +func (c *ComparisonRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operator": + err = unpopulate(val, "Operator", &c.Operator) + delete(rawMsg, key) + case "threshold": + err = unpopulate(val, "Threshold", &c.Threshold) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComputeProfile. +func (c ComputeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nodes", c.Nodes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeProfile. +func (c *ComputeProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nodes": + err = unpopulate(val, "Nodes", &c.Nodes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComputeResourceDefinition. +func (c ComputeResourceDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cpu", c.CPU) + populate(objectMap, "memory", c.Memory) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeResourceDefinition. +func (c *ComputeResourceDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cpu": + err = unpopulate(val, "CPU", &c.CPU) + delete(rawMsg, key) + case "memory": + err = unpopulate(val, "Memory", &c.Memory) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityProfile. +func (c ConnectivityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ssh", c.SSH) + populate(objectMap, "web", c.Web) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityProfile. +func (c *ConnectivityProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ssh": + err = unpopulate(val, "SSH", &c.SSH) + delete(rawMsg, key) + case "web": + err = unpopulate(val, "Web", &c.Web) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityProfileWeb. +func (c ConnectivityProfileWeb) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "fqdn", c.Fqdn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityProfileWeb. +func (c *ConnectivityProfileWeb) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fqdn": + err = unpopulate(val, "Fqdn", &c.Fqdn) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FlinkCatalogOptions. +func (f FlinkCatalogOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hive", f.Hive) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlinkCatalogOptions. +func (f *FlinkCatalogOptions) 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 "hive": + err = unpopulate(val, "Hive", &f.Hive) + 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 FlinkHiveCatalogOption. +func (f FlinkHiveCatalogOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "metastoreDbConnectionPasswordSecret", f.MetastoreDbConnectionPasswordSecret) + populate(objectMap, "metastoreDbConnectionURL", f.MetastoreDbConnectionURL) + populate(objectMap, "metastoreDbConnectionUserName", f.MetastoreDbConnectionUserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlinkHiveCatalogOption. +func (f *FlinkHiveCatalogOption) 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 "metastoreDbConnectionPasswordSecret": + err = unpopulate(val, "MetastoreDbConnectionPasswordSecret", &f.MetastoreDbConnectionPasswordSecret) + delete(rawMsg, key) + case "metastoreDbConnectionURL": + err = unpopulate(val, "MetastoreDbConnectionURL", &f.MetastoreDbConnectionURL) + delete(rawMsg, key) + case "metastoreDbConnectionUserName": + err = unpopulate(val, "MetastoreDbConnectionUserName", &f.MetastoreDbConnectionUserName) + 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 FlinkJobProperties. +func (f FlinkJobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", f.Action) + populate(objectMap, "actionResult", f.ActionResult) + populate(objectMap, "args", f.Args) + populate(objectMap, "entryClass", f.EntryClass) + populate(objectMap, "flinkConfiguration", f.FlinkConfiguration) + populate(objectMap, "jarName", f.JarName) + populate(objectMap, "jobId", f.JobID) + populate(objectMap, "jobJarDirectory", f.JobJarDirectory) + populate(objectMap, "jobName", f.JobName) + populate(objectMap, "jobOutput", f.JobOutput) + objectMap["jobType"] = JobTypeFlinkJob + populate(objectMap, "lastSavePoint", f.LastSavePoint) + populate(objectMap, "savePointName", f.SavePointName) + populate(objectMap, "status", f.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlinkJobProperties. +func (f *FlinkJobProperties) 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 "action": + err = unpopulate(val, "Action", &f.Action) + delete(rawMsg, key) + case "actionResult": + err = unpopulate(val, "ActionResult", &f.ActionResult) + delete(rawMsg, key) + case "args": + err = unpopulate(val, "Args", &f.Args) + delete(rawMsg, key) + case "entryClass": + err = unpopulate(val, "EntryClass", &f.EntryClass) + delete(rawMsg, key) + case "flinkConfiguration": + err = unpopulate(val, "FlinkConfiguration", &f.FlinkConfiguration) + delete(rawMsg, key) + case "jarName": + err = unpopulate(val, "JarName", &f.JarName) + delete(rawMsg, key) + case "jobId": + err = unpopulate(val, "JobID", &f.JobID) + delete(rawMsg, key) + case "jobJarDirectory": + err = unpopulate(val, "JobJarDirectory", &f.JobJarDirectory) + delete(rawMsg, key) + case "jobName": + err = unpopulate(val, "JobName", &f.JobName) + delete(rawMsg, key) + case "jobOutput": + err = unpopulate(val, "JobOutput", &f.JobOutput) + delete(rawMsg, key) + case "jobType": + err = unpopulate(val, "JobType", &f.JobType) + delete(rawMsg, key) + case "lastSavePoint": + err = unpopulate(val, "LastSavePoint", &f.LastSavePoint) + delete(rawMsg, key) + case "savePointName": + err = unpopulate(val, "SavePointName", &f.SavePointName) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &f.Status) + 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 FlinkProfile. +func (f FlinkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "catalogOptions", f.CatalogOptions) + populate(objectMap, "historyServer", f.HistoryServer) + populate(objectMap, "jobManager", f.JobManager) + populate(objectMap, "numReplicas", f.NumReplicas) + populate(objectMap, "storage", f.Storage) + populate(objectMap, "taskManager", f.TaskManager) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlinkProfile. +func (f *FlinkProfile) 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 "catalogOptions": + err = unpopulate(val, "CatalogOptions", &f.CatalogOptions) + delete(rawMsg, key) + case "historyServer": + err = unpopulate(val, "HistoryServer", &f.HistoryServer) + delete(rawMsg, key) + case "jobManager": + err = unpopulate(val, "JobManager", &f.JobManager) + delete(rawMsg, key) + case "numReplicas": + err = unpopulate(val, "NumReplicas", &f.NumReplicas) + delete(rawMsg, key) + case "storage": + err = unpopulate(val, "Storage", &f.Storage) + delete(rawMsg, key) + case "taskManager": + err = unpopulate(val, "TaskManager", &f.TaskManager) + 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 FlinkStorageProfile. +func (f FlinkStorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "storageUri", f.StorageURI) + populate(objectMap, "storagekey", f.Storagekey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlinkStorageProfile. +func (f *FlinkStorageProfile) 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 "storageUri": + err = unpopulate(val, "StorageURI", &f.StorageURI) + delete(rawMsg, key) + case "storagekey": + err = unpopulate(val, "Storagekey", &f.Storagekey) + 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 HiveCatalogOption. +func (h HiveCatalogOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "catalogName", h.CatalogName) + populate(objectMap, "metastoreDbConnectionPasswordSecret", h.MetastoreDbConnectionPasswordSecret) + populate(objectMap, "metastoreDbConnectionURL", h.MetastoreDbConnectionURL) + populate(objectMap, "metastoreDbConnectionUserName", h.MetastoreDbConnectionUserName) + populate(objectMap, "metastoreWarehouseDir", h.MetastoreWarehouseDir) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HiveCatalogOption. +func (h *HiveCatalogOption) 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 "catalogName": + err = unpopulate(val, "CatalogName", &h.CatalogName) + delete(rawMsg, key) + case "metastoreDbConnectionPasswordSecret": + err = unpopulate(val, "MetastoreDbConnectionPasswordSecret", &h.MetastoreDbConnectionPasswordSecret) + delete(rawMsg, key) + case "metastoreDbConnectionURL": + err = unpopulate(val, "MetastoreDbConnectionURL", &h.MetastoreDbConnectionURL) + delete(rawMsg, key) + case "metastoreDbConnectionUserName": + err = unpopulate(val, "MetastoreDbConnectionUserName", &h.MetastoreDbConnectionUserName) + delete(rawMsg, key) + case "metastoreWarehouseDir": + err = unpopulate(val, "MetastoreWarehouseDir", &h.MetastoreWarehouseDir) + 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 IdentityProfile. +func (i IdentityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "msiClientId", i.MsiClientID) + populate(objectMap, "msiObjectId", i.MsiObjectID) + populate(objectMap, "msiResourceId", i.MsiResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProfile. +func (i *IdentityProfile) 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 "msiClientId": + err = unpopulate(val, "MsiClientID", &i.MsiClientID) + delete(rawMsg, key) + case "msiObjectId": + err = unpopulate(val, "MsiObjectID", &i.MsiObjectID) + delete(rawMsg, key) + case "msiResourceId": + err = unpopulate(val, "MsiResourceID", &i.MsiResourceID) + 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 LoadBasedConfig. +func (l LoadBasedConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cooldownPeriod", l.CooldownPeriod) + populate(objectMap, "maxNodes", l.MaxNodes) + populate(objectMap, "minNodes", l.MinNodes) + populate(objectMap, "pollInterval", l.PollInterval) + populate(objectMap, "scalingRules", l.ScalingRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBasedConfig. +func (l *LoadBasedConfig) 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 "cooldownPeriod": + err = unpopulate(val, "CooldownPeriod", &l.CooldownPeriod) + delete(rawMsg, key) + case "maxNodes": + err = unpopulate(val, "MaxNodes", &l.MaxNodes) + delete(rawMsg, key) + case "minNodes": + err = unpopulate(val, "MinNodes", &l.MinNodes) + delete(rawMsg, key) + case "pollInterval": + err = unpopulate(val, "PollInterval", &l.PollInterval) + delete(rawMsg, key) + case "scalingRules": + err = unpopulate(val, "ScalingRules", &l.ScalingRules) + 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 NameAvailabilityParameters. +func (n NameAvailabilityParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", n.Name) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NameAvailabilityParameters. +func (n *NameAvailabilityParameters) 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 "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + 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 NameAvailabilityResult. +func (n NameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", n.Message) + populate(objectMap, "nameAvailable", n.NameAvailable) + populate(objectMap, "reason", n.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NameAvailabilityResult. +func (n *NameAvailabilityResult) 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 "message": + err = unpopulate(val, "Message", &n.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &n.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &n.Reason) + 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 NodeProfile. +func (n NodeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", n.Count) + populate(objectMap, "type", n.Type) + populate(objectMap, "vmSize", n.VMSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NodeProfile. +func (n *NodeProfile) 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 "count": + err = unpopulate(val, "Count", &n.Count) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &n.VMSize) + 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 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 SSHConnectivityEndpoint. +func (s SSHConnectivityEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endpoint", s.Endpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHConnectivityEndpoint. +func (s *SSHConnectivityEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpoint": + err = unpopulate(val, "Endpoint", &s.Endpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSHProfile. +func (s SSHProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", s.Count) + populate(objectMap, "podPrefix", s.PodPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHProfile. +func (s *SSHProfile) 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 "count": + err = unpopulate(val, "Count", &s.Count) + delete(rawMsg, key) + case "podPrefix": + err = unpopulate(val, "PodPrefix", &s.PodPrefix) + 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 ScalingRule. +func (s ScalingRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", s.ActionType) + populate(objectMap, "comparisonRule", s.ComparisonRule) + populate(objectMap, "evaluationCount", s.EvaluationCount) + populate(objectMap, "scalingMetric", s.ScalingMetric) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScalingRule. +func (s *ScalingRule) 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 "actionType": + err = unpopulate(val, "ActionType", &s.ActionType) + delete(rawMsg, key) + case "comparisonRule": + err = unpopulate(val, "ComparisonRule", &s.ComparisonRule) + delete(rawMsg, key) + case "evaluationCount": + err = unpopulate(val, "EvaluationCount", &s.EvaluationCount) + delete(rawMsg, key) + case "scalingMetric": + err = unpopulate(val, "ScalingMetric", &s.ScalingMetric) + 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 Schedule. +func (s Schedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", s.Count) + populate(objectMap, "days", s.Days) + populate(objectMap, "endTime", s.EndTime) + populate(objectMap, "startTime", s.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Schedule. +func (s *Schedule) 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 "count": + err = unpopulate(val, "Count", &s.Count) + delete(rawMsg, key) + case "days": + err = unpopulate(val, "Days", &s.Days) + delete(rawMsg, key) + case "endTime": + err = unpopulate(val, "EndTime", &s.EndTime) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &s.StartTime) + 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 ScheduleBasedConfig. +func (s ScheduleBasedConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "defaultCount", s.DefaultCount) + populate(objectMap, "schedules", s.Schedules) + populate(objectMap, "timeZone", s.TimeZone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduleBasedConfig. +func (s *ScheduleBasedConfig) 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 "defaultCount": + err = unpopulate(val, "DefaultCount", &s.DefaultCount) + delete(rawMsg, key) + case "schedules": + err = unpopulate(val, "Schedules", &s.Schedules) + delete(rawMsg, key) + case "timeZone": + err = unpopulate(val, "TimeZone", &s.TimeZone) + 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 ScriptActionProfile. +func (s ScriptActionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + populate(objectMap, "parameters", s.Parameters) + populate(objectMap, "services", s.Services) + populate(objectMap, "shouldPersist", s.ShouldPersist) + populate(objectMap, "timeoutInMinutes", s.TimeoutInMinutes) + populate(objectMap, "type", s.Type) + populate(objectMap, "url", s.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptActionProfile. +func (s *ScriptActionProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &s.Parameters) + delete(rawMsg, key) + case "services": + err = unpopulate(val, "Services", &s.Services) + delete(rawMsg, key) + case "shouldPersist": + err = unpopulate(val, "ShouldPersist", &s.ShouldPersist) + delete(rawMsg, key) + case "timeoutInMinutes": + err = unpopulate(val, "TimeoutInMinutes", &s.TimeoutInMinutes) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &s.URL) + 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 SecretReference. +func (s SecretReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyVaultObjectName", s.KeyVaultObjectName) + populate(objectMap, "referenceName", s.ReferenceName) + populate(objectMap, "type", s.Type) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretReference. +func (s *SecretReference) 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 "keyVaultObjectName": + err = unpopulate(val, "KeyVaultObjectName", &s.KeyVaultObjectName) + delete(rawMsg, key) + case "referenceName": + err = unpopulate(val, "ReferenceName", &s.ReferenceName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + 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 SecretsProfile. +func (s SecretsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyVaultResourceId", s.KeyVaultResourceID) + populate(objectMap, "secrets", s.Secrets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretsProfile. +func (s *SecretsProfile) 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 "keyVaultResourceId": + err = unpopulate(val, "KeyVaultResourceID", &s.KeyVaultResourceID) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &s.Secrets) + 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 ServiceConfigListResult. +func (s ServiceConfigListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceConfigListResult. +func (s *ServiceConfigListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceConfigListResultValueEntity. +func (s ServiceConfigListResultValueEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", s.Description) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceConfigListResultValueEntity. +func (s *ServiceConfigListResultValueEntity) 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 "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceConfigResult. +func (s ServiceConfigResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceConfigResult. +func (s *ServiceConfigResult) 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 "properties": + err = unpopulate(val, "Properties", &s.Properties) + 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 ServiceConfigResultProperties. +func (s ServiceConfigResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "componentName", s.ComponentName) + populate(objectMap, "content", s.Content) + populate(objectMap, "customKeys", s.CustomKeys) + populate(objectMap, "defaultKeys", s.DefaultKeys) + populate(objectMap, "fileName", s.FileName) + populate(objectMap, "path", s.Path) + populate(objectMap, "serviceName", s.ServiceName) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceConfigResultProperties. +func (s *ServiceConfigResultProperties) 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 "componentName": + err = unpopulate(val, "ComponentName", &s.ComponentName) + delete(rawMsg, key) + case "content": + err = unpopulate(val, "Content", &s.Content) + delete(rawMsg, key) + case "customKeys": + err = unpopulate(val, "CustomKeys", &s.CustomKeys) + delete(rawMsg, key) + case "defaultKeys": + err = unpopulate(val, "DefaultKeys", &s.DefaultKeys) + delete(rawMsg, key) + case "fileName": + err = unpopulate(val, "FileName", &s.FileName) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &s.Path) + delete(rawMsg, key) + case "serviceName": + err = unpopulate(val, "ServiceName", &s.ServiceName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceStatus. +func (s ServiceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "message", s.Message) + populate(objectMap, "ready", s.Ready) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceStatus. +func (s *ServiceStatus) 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 "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &s.Message) + delete(rawMsg, key) + case "ready": + err = unpopulate(val, "Ready", &s.Ready) + 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 SparkMetastoreSpec. +func (s SparkMetastoreSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dbName", s.DbName) + populate(objectMap, "dbPasswordSecretName", s.DbPasswordSecretName) + populate(objectMap, "dbServerHost", s.DbServerHost) + populate(objectMap, "dbUserName", s.DbUserName) + populate(objectMap, "keyVaultId", s.KeyVaultID) + populate(objectMap, "thriftUrl", s.ThriftURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SparkMetastoreSpec. +func (s *SparkMetastoreSpec) 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 "dbName": + err = unpopulate(val, "DbName", &s.DbName) + delete(rawMsg, key) + case "dbPasswordSecretName": + err = unpopulate(val, "DbPasswordSecretName", &s.DbPasswordSecretName) + delete(rawMsg, key) + case "dbServerHost": + err = unpopulate(val, "DbServerHost", &s.DbServerHost) + delete(rawMsg, key) + case "dbUserName": + err = unpopulate(val, "DbUserName", &s.DbUserName) + delete(rawMsg, key) + case "keyVaultId": + err = unpopulate(val, "KeyVaultID", &s.KeyVaultID) + delete(rawMsg, key) + case "thriftUrl": + err = unpopulate(val, "ThriftURL", &s.ThriftURL) + 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 SparkProfile. +func (s SparkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "defaultStorageUrl", s.DefaultStorageURL) + populate(objectMap, "metastoreSpec", s.MetastoreSpec) + populate(objectMap, "userPluginsSpec", s.UserPluginsSpec) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SparkProfile. +func (s *SparkProfile) 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 "defaultStorageUrl": + err = unpopulate(val, "DefaultStorageURL", &s.DefaultStorageURL) + delete(rawMsg, key) + case "metastoreSpec": + err = unpopulate(val, "MetastoreSpec", &s.MetastoreSpec) + delete(rawMsg, key) + case "userPluginsSpec": + err = unpopulate(val, "UserPluginsSpec", &s.UserPluginsSpec) + 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 SparkUserPlugin. +func (s SparkUserPlugin) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "path", s.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SparkUserPlugin. +func (s *SparkUserPlugin) 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 "path": + err = unpopulate(val, "Path", &s.Path) + 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 SparkUserPlugins. +func (s SparkUserPlugins) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "plugins", s.Plugins) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SparkUserPlugins. +func (s *SparkUserPlugins) 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 "plugins": + err = unpopulate(val, "Plugins", &s.Plugins) + 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 TagsObject. +func (t TagsObject) 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 TagsObject. +func (t *TagsObject) 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 +} + +// MarshalJSON implements the json.Marshaller interface for type TrinoCoordinator. +func (t TrinoCoordinator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "debug", t.Debug) + populate(objectMap, "highAvailabilityEnabled", t.HighAvailabilityEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrinoCoordinator. +func (t *TrinoCoordinator) 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 "debug": + err = unpopulate(val, "Debug", &t.Debug) + delete(rawMsg, key) + case "highAvailabilityEnabled": + err = unpopulate(val, "HighAvailabilityEnabled", &t.HighAvailabilityEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrinoDebugConfig. +func (t TrinoDebugConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enable", t.Enable) + populate(objectMap, "port", t.Port) + populate(objectMap, "suspend", t.Suspend) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrinoDebugConfig. +func (t *TrinoDebugConfig) 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 "enable": + err = unpopulate(val, "Enable", &t.Enable) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &t.Port) + delete(rawMsg, key) + case "suspend": + err = unpopulate(val, "Suspend", &t.Suspend) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrinoProfile. +func (t TrinoProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "catalogOptions", t.CatalogOptions) + populate(objectMap, "coordinator", t.Coordinator) + populate(objectMap, "userPluginsSpec", t.UserPluginsSpec) + populate(objectMap, "userTelemetrySpec", t.UserTelemetrySpec) + populate(objectMap, "worker", t.Worker) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrinoProfile. +func (t *TrinoProfile) 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 "catalogOptions": + err = unpopulate(val, "CatalogOptions", &t.CatalogOptions) + delete(rawMsg, key) + case "coordinator": + err = unpopulate(val, "Coordinator", &t.Coordinator) + delete(rawMsg, key) + case "userPluginsSpec": + err = unpopulate(val, "UserPluginsSpec", &t.UserPluginsSpec) + delete(rawMsg, key) + case "userTelemetrySpec": + err = unpopulate(val, "UserTelemetrySpec", &t.UserTelemetrySpec) + delete(rawMsg, key) + case "worker": + err = unpopulate(val, "Worker", &t.Worker) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrinoTelemetryConfig. +func (t TrinoTelemetryConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hivecatalogName", t.HivecatalogName) + populate(objectMap, "hivecatalogSchema", t.HivecatalogSchema) + populate(objectMap, "partitionRetentionInDays", t.PartitionRetentionInDays) + populate(objectMap, "path", t.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrinoTelemetryConfig. +func (t *TrinoTelemetryConfig) 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 "hivecatalogName": + err = unpopulate(val, "HivecatalogName", &t.HivecatalogName) + delete(rawMsg, key) + case "hivecatalogSchema": + err = unpopulate(val, "HivecatalogSchema", &t.HivecatalogSchema) + delete(rawMsg, key) + case "partitionRetentionInDays": + err = unpopulate(val, "PartitionRetentionInDays", &t.PartitionRetentionInDays) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &t.Path) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrinoUserPlugin. +func (t TrinoUserPlugin) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", t.Enabled) + populate(objectMap, "name", t.Name) + populate(objectMap, "path", t.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrinoUserPlugin. +func (t *TrinoUserPlugin) 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 "enabled": + err = unpopulate(val, "Enabled", &t.Enabled) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &t.Path) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrinoUserPlugins. +func (t TrinoUserPlugins) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "plugins", t.Plugins) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrinoUserPlugins. +func (t *TrinoUserPlugins) 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 "plugins": + err = unpopulate(val, "Plugins", &t.Plugins) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrinoUserTelemetry. +func (t TrinoUserTelemetry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "storage", t.Storage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrinoUserTelemetry. +func (t *TrinoUserTelemetry) 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 "storage": + err = unpopulate(val, "Storage", &t.Storage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrinoWorker. +func (t TrinoWorker) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "debug", t.Debug) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrinoWorker. +func (t *TrinoWorker) 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 "debug": + err = unpopulate(val, "Debug", &t.Debug) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdatableClusterProfile. +func (u UpdatableClusterProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authorizationProfile", u.AuthorizationProfile) + populate(objectMap, "autoscaleProfile", u.AutoscaleProfile) + populate(objectMap, "logAnalyticsProfile", u.LogAnalyticsProfile) + populate(objectMap, "prometheusProfile", u.PrometheusProfile) + populate(objectMap, "sshProfile", u.SSHProfile) + populate(objectMap, "scriptActionProfiles", u.ScriptActionProfiles) + populate(objectMap, "serviceConfigsProfiles", u.ServiceConfigsProfiles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdatableClusterProfile. +func (u *UpdatableClusterProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizationProfile": + err = unpopulate(val, "AuthorizationProfile", &u.AuthorizationProfile) + delete(rawMsg, key) + case "autoscaleProfile": + err = unpopulate(val, "AutoscaleProfile", &u.AutoscaleProfile) + delete(rawMsg, key) + case "logAnalyticsProfile": + err = unpopulate(val, "LogAnalyticsProfile", &u.LogAnalyticsProfile) + delete(rawMsg, key) + case "prometheusProfile": + err = unpopulate(val, "PrometheusProfile", &u.PrometheusProfile) + delete(rawMsg, key) + case "sshProfile": + err = unpopulate(val, "SSHProfile", &u.SSHProfile) + delete(rawMsg, key) + case "scriptActionProfiles": + err = unpopulate(val, "ScriptActionProfiles", &u.ScriptActionProfiles) + delete(rawMsg, key) + case "serviceConfigsProfiles": + err = unpopulate(val, "ServiceConfigsProfiles", &u.ServiceConfigsProfiles) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/operations_client.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/operations_client.go new file mode 100644 index 000000000000..bf4fab40d095 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/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 armhdinsightonaks + +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 - Returns list of operations. +// +// Generated from API version 2023-06-01-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + 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.HDInsight/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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/options.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/options.go new file mode 100644 index 000000000000..92aa905179fe --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/options.go @@ -0,0 +1,131 @@ +//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 armhdinsightonaks + +// AvailableClusterPoolVersionsClientListByLocationOptions contains the optional parameters for the AvailableClusterPoolVersionsClient.NewListByLocationPager +// method. +type AvailableClusterPoolVersionsClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// AvailableClusterVersionsClientListByLocationOptions contains the optional parameters for the AvailableClusterVersionsClient.NewListByLocationPager +// method. +type AvailableClusterVersionsClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// ClusterJobsClientBeginRunJobOptions contains the optional parameters for the ClusterJobsClient.BeginRunJob method. +type ClusterJobsClientBeginRunJobOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClusterJobsClientListOptions contains the optional parameters for the ClusterJobsClient.NewListPager method. +type ClusterJobsClientListOptions struct { + // placeholder for future optional parameters +} + +// ClusterPoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the ClusterPoolsClient.BeginCreateOrUpdate +// method. +type ClusterPoolsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClusterPoolsClientBeginDeleteOptions contains the optional parameters for the ClusterPoolsClient.BeginDelete method. +type ClusterPoolsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClusterPoolsClientBeginUpdateTagsOptions contains the optional parameters for the ClusterPoolsClient.BeginUpdateTags method. +type ClusterPoolsClientBeginUpdateTagsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClusterPoolsClientGetOptions contains the optional parameters for the ClusterPoolsClient.Get method. +type ClusterPoolsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClusterPoolsClientListByResourceGroupOptions contains the optional parameters for the ClusterPoolsClient.NewListByResourceGroupPager +// method. +type ClusterPoolsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ClusterPoolsClientListBySubscriptionOptions contains the optional parameters for the ClusterPoolsClient.NewListBySubscriptionPager +// method. +type ClusterPoolsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientBeginCreateOptions contains the optional parameters for the ClustersClient.BeginCreate method. +type ClustersClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. +type ClustersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginResizeOptions contains the optional parameters for the ClustersClient.BeginResize method. +type ClustersClientBeginResizeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginUpdateOptions contains the optional parameters for the ClustersClient.BeginUpdate method. +type ClustersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientGetInstanceViewOptions contains the optional parameters for the ClustersClient.GetInstanceView method. +type ClustersClientGetInstanceViewOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. +type ClustersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListByClusterPoolNameOptions contains the optional parameters for the ClustersClient.NewListByClusterPoolNamePager +// method. +type ClustersClientListByClusterPoolNameOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListInstanceViewsOptions contains the optional parameters for the ClustersClient.NewListInstanceViewsPager +// method. +type ClustersClientListInstanceViewsOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListServiceConfigsOptions contains the optional parameters for the ClustersClient.NewListServiceConfigsPager +// method. +type ClustersClientListServiceConfigsOptions struct { + // placeholder for future optional parameters +} + +// LocationsClientCheckNameAvailabilityOptions contains the optional parameters for the LocationsClient.CheckNameAvailability +// method. +type LocationsClientCheckNameAvailabilityOptions 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/hdinsight/armhdinsightonaks/polymorphic_helpers.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/polymorphic_helpers.go new file mode 100644 index 000000000000..43cbd43f2f00 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/polymorphic_helpers.go @@ -0,0 +1,32 @@ +//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 armhdinsightonaks + +import "encoding/json" + +func unmarshalClusterJobPropertiesClassification(rawMsg json.RawMessage) (ClusterJobPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ClusterJobPropertiesClassification + switch m["jobType"] { + case string(JobTypeFlinkJob): + b = &FlinkJobProperties{} + default: + b = &ClusterJobProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/resourcemanager/hdinsight/armhdinsightonaks/response_types.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/response_types.go new file mode 100644 index 000000000000..92519d4be54d --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/response_types.go @@ -0,0 +1,133 @@ +//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 armhdinsightonaks + +// AvailableClusterPoolVersionsClientListByLocationResponse contains the response from method AvailableClusterPoolVersionsClient.NewListByLocationPager. +type AvailableClusterPoolVersionsClientListByLocationResponse struct { + // Represents a list of cluster pool versions. + ClusterPoolVersionsListResult +} + +// AvailableClusterVersionsClientListByLocationResponse contains the response from method AvailableClusterVersionsClient.NewListByLocationPager. +type AvailableClusterVersionsClientListByLocationResponse struct { + // Represents a list of cluster versions. + ClusterVersionsListResult +} + +// ClusterJobsClientListResponse contains the response from method ClusterJobsClient.NewListPager. +type ClusterJobsClientListResponse struct { + // Collection of cluster job. + ClusterJobList +} + +// ClusterJobsClientRunJobResponse contains the response from method ClusterJobsClient.BeginRunJob. +type ClusterJobsClientRunJobResponse struct { + // Cluster job. + ClusterJob +} + +// ClusterPoolsClientCreateOrUpdateResponse contains the response from method ClusterPoolsClient.BeginCreateOrUpdate. +type ClusterPoolsClientCreateOrUpdateResponse struct { + // Cluster pool. + ClusterPool +} + +// ClusterPoolsClientDeleteResponse contains the response from method ClusterPoolsClient.BeginDelete. +type ClusterPoolsClientDeleteResponse struct { + // placeholder for future response values +} + +// ClusterPoolsClientGetResponse contains the response from method ClusterPoolsClient.Get. +type ClusterPoolsClientGetResponse struct { + // Cluster pool. + ClusterPool +} + +// ClusterPoolsClientListByResourceGroupResponse contains the response from method ClusterPoolsClient.NewListByResourceGroupPager. +type ClusterPoolsClientListByResourceGroupResponse struct { + // The list cluster pools operation response. + ClusterPoolListResult +} + +// ClusterPoolsClientListBySubscriptionResponse contains the response from method ClusterPoolsClient.NewListBySubscriptionPager. +type ClusterPoolsClientListBySubscriptionResponse struct { + // The list cluster pools operation response. + ClusterPoolListResult +} + +// ClusterPoolsClientUpdateTagsResponse contains the response from method ClusterPoolsClient.BeginUpdateTags. +type ClusterPoolsClientUpdateTagsResponse struct { + // Cluster pool. + ClusterPool +} + +// ClustersClientCreateResponse contains the response from method ClustersClient.BeginCreate. +type ClustersClientCreateResponse struct { + // The cluster. + Cluster +} + +// ClustersClientDeleteResponse contains the response from method ClustersClient.BeginDelete. +type ClustersClientDeleteResponse struct { + // placeholder for future response values +} + +// ClustersClientGetInstanceViewResponse contains the response from method ClustersClient.GetInstanceView. +type ClustersClientGetInstanceViewResponse struct { + // Cluster Instance View. + ClusterInstanceViewResult +} + +// ClustersClientGetResponse contains the response from method ClustersClient.Get. +type ClustersClientGetResponse struct { + // The cluster. + Cluster +} + +// ClustersClientListByClusterPoolNameResponse contains the response from method ClustersClient.NewListByClusterPoolNamePager. +type ClustersClientListByClusterPoolNameResponse struct { + // The list cluster operation response. + ClusterListResult +} + +// ClustersClientListInstanceViewsResponse contains the response from method ClustersClient.NewListInstanceViewsPager. +type ClustersClientListInstanceViewsResponse struct { + // The instance view of a HDInsight Cluster. + ClusterInstanceViewsResult +} + +// ClustersClientListServiceConfigsResponse contains the response from method ClustersClient.NewListServiceConfigsPager. +type ClustersClientListServiceConfigsResponse struct { + // Cluster instance service configs api response. + ServiceConfigListResult +} + +// ClustersClientResizeResponse contains the response from method ClustersClient.BeginResize. +type ClustersClientResizeResponse struct { + // The cluster. + Cluster +} + +// ClustersClientUpdateResponse contains the response from method ClustersClient.BeginUpdate. +type ClustersClientUpdateResponse struct { + // The cluster. + Cluster +} + +// LocationsClientCheckNameAvailabilityResponse contains the response from method LocationsClient.CheckNameAvailability. +type LocationsClientCheckNameAvailabilityResponse struct { + // Result of check name availability. + NameAvailabilityResult +} + +// 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/hdinsight/armhdinsightonaks/time_rfc3339.go b/sdk/resourcemanager/hdinsight/armhdinsightonaks/time_rfc3339.go new file mode 100644 index 000000000000..1fa3ee5863d7 --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsightonaks/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 armhdinsightonaks + +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 +}