diff --git a/sdk/resourcemanager/workloads/armconnector/CHANGELOG.md b/sdk/resourcemanager/workloads/armconnector/CHANGELOG.md new file mode 100644 index 000000000000..388501f1734b --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 0.1.0 (2023-10-10) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armconnector` 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/workloads/armconnector/LICENSE.txt b/sdk/resourcemanager/workloads/armconnector/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/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/workloads/armconnector/README.md b/sdk/resourcemanager/workloads/armconnector/README.md new file mode 100644 index 000000000000..188bc0948070 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/README.md @@ -0,0 +1,85 @@ +# Azure Workloads Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armconnector)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armconnector) + +The `armconnector` module provides operations for working with Azure Workloads. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/workloads/armconnector) + +# 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 Workloads module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armconnector +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Workloads. 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 Workloads 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 := armconnector.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armconnector.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.NewConnectorsClient() +``` + +## 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 `Workloads` 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/workloads/armconnector/acssbackupconnections_client.go b/sdk/resourcemanager/workloads/armconnector/acssbackupconnections_client.go new file mode 100644 index 000000000000..2551c8309245 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/acssbackupconnections_client.go @@ -0,0 +1,409 @@ +//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 armconnector + +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" +) + +// ACSSBackupConnectionsClient contains the methods for the ACSSBackupConnections group. +// Don't use this type directly, use NewACSSBackupConnectionsClient() instead. +type ACSSBackupConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewACSSBackupConnectionsClient creates a new instance of ACSSBackupConnectionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewACSSBackupConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ACSSBackupConnectionsClient, error) { + cl, err := arm.NewClient(moduleName+".ACSSBackupConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ACSSBackupConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates the backup connection resource of virtual instance for SAP. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectorName - The name of the connector resource +// - backupName - The name of the backup connection resource of virtual instance for SAP. +// - body - The request body of backup connection of virtual instance for SAP. +// - options - ACSSBackupConnectionsClientBeginCreateOptions contains the optional parameters for the ACSSBackupConnectionsClient.BeginCreate +// method. +func (client *ACSSBackupConnectionsClient) BeginCreate(ctx context.Context, resourceGroupName string, connectorName string, backupName string, body ACSSBackupConnection, options *ACSSBackupConnectionsClientBeginCreateOptions) (*runtime.Poller[ACSSBackupConnectionsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, connectorName, backupName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ACSSBackupConnectionsClientCreateResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ACSSBackupConnectionsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Create - Creates the backup connection resource of virtual instance for SAP. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ACSSBackupConnectionsClient) create(ctx context.Context, resourceGroupName string, connectorName string, backupName string, body ACSSBackupConnection, options *ACSSBackupConnectionsClientBeginCreateOptions) (*http.Response, error) { + var err error + req, err := client.createCreateRequest(ctx, resourceGroupName, connectorName, backupName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *ACSSBackupConnectionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, connectorName string, backupName string, body ACSSBackupConnection, options *ACSSBackupConnectionsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/connectors/{connectorName}/acssBackups/{backupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the backup connection resource of virtual instance for SAP. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectorName - The name of the connector resource +// - backupName - The name of the backup connection resource of virtual instance for SAP. +// - options - ACSSBackupConnectionsClientBeginDeleteOptions contains the optional parameters for the ACSSBackupConnectionsClient.BeginDelete +// method. +func (client *ACSSBackupConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, connectorName string, backupName string, options *ACSSBackupConnectionsClientBeginDeleteOptions) (*runtime.Poller[ACSSBackupConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, connectorName, backupName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ACSSBackupConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ACSSBackupConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the backup connection resource of virtual instance for SAP. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ACSSBackupConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, connectorName string, backupName string, options *ACSSBackupConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, connectorName, backupName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ACSSBackupConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectorName string, backupName string, options *ACSSBackupConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/connectors/{connectorName}/acssBackups/{backupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the backup connection resource of virtual instance for SAP. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectorName - The name of the connector resource +// - backupName - The name of the backup connection resource of virtual instance for SAP. +// - options - ACSSBackupConnectionsClientGetOptions contains the optional parameters for the ACSSBackupConnectionsClient.Get +// method. +func (client *ACSSBackupConnectionsClient) Get(ctx context.Context, resourceGroupName string, connectorName string, backupName string, options *ACSSBackupConnectionsClientGetOptions) (ACSSBackupConnectionsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, connectorName, backupName, options) + if err != nil { + return ACSSBackupConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ACSSBackupConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ACSSBackupConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ACSSBackupConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, connectorName string, backupName string, options *ACSSBackupConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/connectors/{connectorName}/acssBackups/{backupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + 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-10-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 *ACSSBackupConnectionsClient) getHandleResponse(resp *http.Response) (ACSSBackupConnectionsClientGetResponse, error) { + result := ACSSBackupConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ACSSBackupConnection); err != nil { + return ACSSBackupConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the backup connection resources of virtual instance for SAP under the given connector resource. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectorName - The name of the connector resource +// - options - ACSSBackupConnectionsClientListOptions contains the optional parameters for the ACSSBackupConnectionsClient.NewListPager +// method. +func (client *ACSSBackupConnectionsClient) NewListPager(resourceGroupName string, connectorName string, options *ACSSBackupConnectionsClientListOptions) *runtime.Pager[ACSSBackupConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ACSSBackupConnectionsClientListResponse]{ + More: func(page ACSSBackupConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ACSSBackupConnectionsClientListResponse) (ACSSBackupConnectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, connectorName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ACSSBackupConnectionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ACSSBackupConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ACSSBackupConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ACSSBackupConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, connectorName string, options *ACSSBackupConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/connectors/{connectorName}/acssBackups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-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 *ACSSBackupConnectionsClient) listHandleResponse(resp *http.Response) (ACSSBackupConnectionsClientListResponse, error) { + result := ACSSBackupConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ACSSBackupConnectionList); err != nil { + return ACSSBackupConnectionsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates the backup connection resource of virtual instance for SAP. +// This can be used to update tags on the resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectorName - The name of the connector resource +// - backupName - The name of the backup connection resource of virtual instance for SAP. +// - body - The request body of backup connection resource of virtual instance for SAP. +// - options - ACSSBackupConnectionsClientBeginUpdateOptions contains the optional parameters for the ACSSBackupConnectionsClient.BeginUpdate +// method. +func (client *ACSSBackupConnectionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, connectorName string, backupName string, body UpdateACSSBackupConnectionRequest, options *ACSSBackupConnectionsClientBeginUpdateOptions) (*runtime.Poller[ACSSBackupConnectionsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, connectorName, backupName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ACSSBackupConnectionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ACSSBackupConnectionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - Updates the backup connection resource of virtual instance for SAP. +// This can be used to update tags on the resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ACSSBackupConnectionsClient) update(ctx context.Context, resourceGroupName string, connectorName string, backupName string, body UpdateACSSBackupConnectionRequest, options *ACSSBackupConnectionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, connectorName, backupName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ACSSBackupConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, connectorName string, backupName string, body UpdateACSSBackupConnectionRequest, options *ACSSBackupConnectionsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/connectors/{connectorName}/acssBackups/{backupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/workloads/armconnector/autorest.md b/sdk/resourcemanager/workloads/armconnector/autorest.md new file mode 100644 index 000000000000..543cb0ba5e52 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/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/workloads/resource-manager/Microsoft.Workloads/connectors/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/workloads/resource-manager/Microsoft.Workloads/connectors/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/workloads/armconnector/build.go b/sdk/resourcemanager/workloads/armconnector/build.go new file mode 100644 index 000000000000..7231e717cf65 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/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/workloads/armconnector + +package armconnector diff --git a/sdk/resourcemanager/workloads/armconnector/ci.yml b/sdk/resourcemanager/workloads/armconnector/ci.yml new file mode 100644 index 000000000000..5c3facf3b854 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/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/workloads/armconnector/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/workloads/armconnector/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/workloads/armconnector' diff --git a/sdk/resourcemanager/workloads/armconnector/client_factory.go b/sdk/resourcemanager/workloads/armconnector/client_factory.go new file mode 100644 index 000000000000..7e6fa6471cfd --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/client_factory.go @@ -0,0 +1,53 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armconnector + +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. +// - 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) NewACSSBackupConnectionsClient() *ACSSBackupConnectionsClient { + subClient, _ := NewACSSBackupConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewConnectorsClient() *ConnectorsClient { + subClient, _ := NewConnectorsClient(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/workloads/armconnector/connectors_client.go b/sdk/resourcemanager/workloads/armconnector/connectors_client.go new file mode 100644 index 000000000000..e311eaeb9c86 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/connectors_client.go @@ -0,0 +1,433 @@ +//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 armconnector + +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" +) + +// ConnectorsClient contains the methods for the Connectors group. +// Don't use this type directly, use NewConnectorsClient() instead. +type ConnectorsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewConnectorsClient creates a new instance of ConnectorsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewConnectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectorsClient, error) { + cl, err := arm.NewClient(moduleName+".ConnectorsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ConnectorsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a connector resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectorName - The name of the connector resource +// - body - Connector resource request body. +// - options - ConnectorsClientBeginCreateOptions contains the optional parameters for the ConnectorsClient.BeginCreate method. +func (client *ConnectorsClient) BeginCreate(ctx context.Context, resourceGroupName string, connectorName string, body Connector, options *ConnectorsClientBeginCreateOptions) (*runtime.Poller[ConnectorsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, connectorName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ConnectorsClientCreateResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ConnectorsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Create - Creates a connector resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ConnectorsClient) create(ctx context.Context, resourceGroupName string, connectorName string, body Connector, options *ConnectorsClientBeginCreateOptions) (*http.Response, error) { + var err error + req, err := client.createCreateRequest(ctx, resourceGroupName, connectorName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *ConnectorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, connectorName string, body Connector, options *ConnectorsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/connectors/{connectorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a connector resource and its child resources, which are the associated connection resources. All +// the child resources have to be deleted before deleting the connector resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectorName - The name of the connector resource +// - options - ConnectorsClientBeginDeleteOptions contains the optional parameters for the ConnectorsClient.BeginDelete method. +func (client *ConnectorsClient) BeginDelete(ctx context.Context, resourceGroupName string, connectorName string, options *ConnectorsClientBeginDeleteOptions) (*runtime.Poller[ConnectorsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, connectorName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ConnectorsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ConnectorsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a connector resource and its child resources, which are the associated connection resources. All the child +// resources have to be deleted before deleting the connector resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ConnectorsClient) deleteOperation(ctx context.Context, resourceGroupName string, connectorName string, options *ConnectorsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, connectorName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectorName string, options *ConnectorsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/connectors/{connectorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a connector resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectorName - The name of the connector resource +// - options - ConnectorsClientGetOptions contains the optional parameters for the ConnectorsClient.Get method. +func (client *ConnectorsClient) Get(ctx context.Context, resourceGroupName string, connectorName string, options *ConnectorsClientGetOptions) (ConnectorsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, connectorName, options) + if err != nil { + return ConnectorsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ConnectorsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ConnectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, connectorName string, options *ConnectorsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/connectors/{connectorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-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 *ConnectorsClient) getHandleResponse(resp *http.Response) (ConnectorsClientGetResponse, error) { + result := ConnectorsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Connector); err != nil { + return ConnectorsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets all connector resources in a Resource Group. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ConnectorsClientListByResourceGroupOptions contains the optional parameters for the ConnectorsClient.NewListByResourceGroupPager +// method. +func (client *ConnectorsClient) NewListByResourceGroupPager(resourceGroupName string, options *ConnectorsClientListByResourceGroupOptions) *runtime.Pager[ConnectorsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectorsClientListByResourceGroupResponse]{ + More: func(page ConnectorsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectorsClientListByResourceGroupResponse) (ConnectorsClientListByResourceGroupResponse, 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 ConnectorsClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectorsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectorsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ConnectorsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ConnectorsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/connectors" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-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 *ConnectorsClient) listByResourceGroupHandleResponse(resp *http.Response) (ConnectorsClientListByResourceGroupResponse, error) { + result := ConnectorsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.List); err != nil { + return ConnectorsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Gets all connector resources in a Subscription. +// +// Generated from API version 2023-10-01-preview +// - options - ConnectorsClientListBySubscriptionOptions contains the optional parameters for the ConnectorsClient.NewListBySubscriptionPager +// method. +func (client *ConnectorsClient) NewListBySubscriptionPager(options *ConnectorsClientListBySubscriptionOptions) *runtime.Pager[ConnectorsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectorsClientListBySubscriptionResponse]{ + More: func(page ConnectorsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectorsClientListBySubscriptionResponse) (ConnectorsClientListBySubscriptionResponse, 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 ConnectorsClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectorsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectorsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ConnectorsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ConnectorsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/connectors" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-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 *ConnectorsClient) listBySubscriptionHandleResponse(resp *http.Response) (ConnectorsClientListBySubscriptionResponse, error) { + result := ConnectorsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.List); err != nil { + return ConnectorsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Updates a connector resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - connectorName - The name of the connector resource +// - body - Request body to update a connector resource. +// - options - ConnectorsClientUpdateOptions contains the optional parameters for the ConnectorsClient.Update method. +func (client *ConnectorsClient) Update(ctx context.Context, resourceGroupName string, connectorName string, body UpdateConnectorRequest, options *ConnectorsClientUpdateOptions) (ConnectorsClientUpdateResponse, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, connectorName, body, options) + if err != nil { + return ConnectorsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectorsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ConnectorsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *ConnectorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, connectorName string, body UpdateConnectorRequest, options *ConnectorsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/connectors/{connectorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if connectorName == "" { + return nil, errors.New("parameter connectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *ConnectorsClient) updateHandleResponse(resp *http.Response) (ConnectorsClientUpdateResponse, error) { + result := ConnectorsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Connector); err != nil { + return ConnectorsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/workloads/armconnector/constants.go b/sdk/resourcemanager/workloads/armconnector/constants.go new file mode 100644 index 000000000000..d1605b5e96a8 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/constants.go @@ -0,0 +1,416 @@ +//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 armconnector + +const ( + moduleName = "armconnector" + moduleVersion = "v0.1.0" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// BackupType - The type of backup, VM, SQL or HANA. +type BackupType string + +const ( + BackupTypeHANA BackupType = "HANA" + BackupTypeSQL BackupType = "SQL" + BackupTypeVM BackupType = "VM" +) + +// PossibleBackupTypeValues returns the possible values for the BackupType const type. +func PossibleBackupTypeValues() []BackupType { + return []BackupType{ + BackupTypeHANA, + BackupTypeSQL, + BackupTypeVM, + } +} + +// ConnectorProvisioningState - Defines the provisioning states. +type ConnectorProvisioningState string + +const ( + ConnectorProvisioningStateCanceled ConnectorProvisioningState = "Canceled" + ConnectorProvisioningStateCreating ConnectorProvisioningState = "Creating" + ConnectorProvisioningStateDeleting ConnectorProvisioningState = "Deleting" + ConnectorProvisioningStateFailed ConnectorProvisioningState = "Failed" + ConnectorProvisioningStateSucceeded ConnectorProvisioningState = "Succeeded" + ConnectorProvisioningStateUpdating ConnectorProvisioningState = "Updating" +) + +// PossibleConnectorProvisioningStateValues returns the possible values for the ConnectorProvisioningState const type. +func PossibleConnectorProvisioningStateValues() []ConnectorProvisioningState { + return []ConnectorProvisioningState{ + ConnectorProvisioningStateCanceled, + ConnectorProvisioningStateCreating, + ConnectorProvisioningStateDeleting, + ConnectorProvisioningStateFailed, + ConnectorProvisioningStateSucceeded, + ConnectorProvisioningStateUpdating, + } +} + +// 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, + } +} + +type DayOfWeek string + +const ( + DayOfWeekFriday DayOfWeek = "Friday" + DayOfWeekMonday DayOfWeek = "Monday" + DayOfWeekSaturday DayOfWeek = "Saturday" + DayOfWeekSunday DayOfWeek = "Sunday" + DayOfWeekThursday DayOfWeek = "Thursday" + DayOfWeekTuesday DayOfWeek = "Tuesday" + DayOfWeekWednesday DayOfWeek = "Wednesday" +) + +// PossibleDayOfWeekValues returns the possible values for the DayOfWeek const type. +func PossibleDayOfWeekValues() []DayOfWeek { + return []DayOfWeek{ + DayOfWeekFriday, + DayOfWeekMonday, + DayOfWeekSaturday, + DayOfWeekSunday, + DayOfWeekThursday, + DayOfWeekTuesday, + DayOfWeekWednesday, + } +} + +// IAASVMPolicyType - The policy type. +type IAASVMPolicyType string + +const ( + IAASVMPolicyTypeInvalid IAASVMPolicyType = "Invalid" + IAASVMPolicyTypeV1 IAASVMPolicyType = "V1" + IAASVMPolicyTypeV2 IAASVMPolicyType = "V2" +) + +// PossibleIAASVMPolicyTypeValues returns the possible values for the IAASVMPolicyType const type. +func PossibleIAASVMPolicyTypeValues() []IAASVMPolicyType { + return []IAASVMPolicyType{ + IAASVMPolicyTypeInvalid, + IAASVMPolicyTypeV1, + IAASVMPolicyTypeV2, + } +} + +// ManagedServiceIdentityType - Type of managed service identity (only None, UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeUserAssigned, + } +} + +type MonthOfYear string + +const ( + MonthOfYearApril MonthOfYear = "April" + MonthOfYearAugust MonthOfYear = "August" + MonthOfYearDecember MonthOfYear = "December" + MonthOfYearFebruary MonthOfYear = "February" + MonthOfYearInvalid MonthOfYear = "Invalid" + MonthOfYearJanuary MonthOfYear = "January" + MonthOfYearJuly MonthOfYear = "July" + MonthOfYearJune MonthOfYear = "June" + MonthOfYearMarch MonthOfYear = "March" + MonthOfYearMay MonthOfYear = "May" + MonthOfYearNovember MonthOfYear = "November" + MonthOfYearOctober MonthOfYear = "October" + MonthOfYearSeptember MonthOfYear = "September" +) + +// PossibleMonthOfYearValues returns the possible values for the MonthOfYear const type. +func PossibleMonthOfYearValues() []MonthOfYear { + return []MonthOfYear{ + MonthOfYearApril, + MonthOfYearAugust, + MonthOfYearDecember, + MonthOfYearFebruary, + MonthOfYearInvalid, + MonthOfYearJanuary, + MonthOfYearJuly, + MonthOfYearJune, + MonthOfYearMarch, + MonthOfYearMay, + MonthOfYearNovember, + MonthOfYearOctober, + MonthOfYearSeptember, + } +} + +// 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, + } +} + +// PolicyType - Type of backup policy type +type PolicyType string + +const ( + PolicyTypeCopyOnlyFull PolicyType = "CopyOnlyFull" + PolicyTypeDifferential PolicyType = "Differential" + PolicyTypeFull PolicyType = "Full" + PolicyTypeIncremental PolicyType = "Incremental" + PolicyTypeInvalid PolicyType = "Invalid" + PolicyTypeLog PolicyType = "Log" + PolicyTypeSnapshotCopyOnlyFull PolicyType = "SnapshotCopyOnlyFull" + PolicyTypeSnapshotFull PolicyType = "SnapshotFull" +) + +// PossiblePolicyTypeValues returns the possible values for the PolicyType const type. +func PossiblePolicyTypeValues() []PolicyType { + return []PolicyType{ + PolicyTypeCopyOnlyFull, + PolicyTypeDifferential, + PolicyTypeFull, + PolicyTypeIncremental, + PolicyTypeInvalid, + PolicyTypeLog, + PolicyTypeSnapshotCopyOnlyFull, + PolicyTypeSnapshotFull, + } +} + +// RetentionDurationType - Retention duration type: days/weeks/months/years Used only if TieringMode is set to TierAfter +type RetentionDurationType string + +const ( + RetentionDurationTypeDays RetentionDurationType = "Days" + RetentionDurationTypeInvalid RetentionDurationType = "Invalid" + RetentionDurationTypeMonths RetentionDurationType = "Months" + RetentionDurationTypeWeeks RetentionDurationType = "Weeks" + RetentionDurationTypeYears RetentionDurationType = "Years" +) + +// PossibleRetentionDurationTypeValues returns the possible values for the RetentionDurationType const type. +func PossibleRetentionDurationTypeValues() []RetentionDurationType { + return []RetentionDurationType{ + RetentionDurationTypeDays, + RetentionDurationTypeInvalid, + RetentionDurationTypeMonths, + RetentionDurationTypeWeeks, + RetentionDurationTypeYears, + } +} + +// RetentionScheduleFormat - Retention schedule format type for monthly retention policy. +type RetentionScheduleFormat string + +const ( + RetentionScheduleFormatDaily RetentionScheduleFormat = "Daily" + RetentionScheduleFormatInvalid RetentionScheduleFormat = "Invalid" + RetentionScheduleFormatWeekly RetentionScheduleFormat = "Weekly" +) + +// PossibleRetentionScheduleFormatValues returns the possible values for the RetentionScheduleFormat const type. +func PossibleRetentionScheduleFormatValues() []RetentionScheduleFormat { + return []RetentionScheduleFormat{ + RetentionScheduleFormatDaily, + RetentionScheduleFormatInvalid, + RetentionScheduleFormatWeekly, + } +} + +// SSLCryptoProvider - Specify the crypto provider being used (commoncrypto/openssl). If this argument is not provided, it +// is automatically determined by searching in the configuration files. +type SSLCryptoProvider string + +const ( + SSLCryptoProviderCommoncrypto SSLCryptoProvider = "commoncrypto" + SSLCryptoProviderOpenssl SSLCryptoProvider = "openssl" +) + +// PossibleSSLCryptoProviderValues returns the possible values for the SSLCryptoProvider const type. +func PossibleSSLCryptoProviderValues() []SSLCryptoProvider { + return []SSLCryptoProvider{ + SSLCryptoProviderCommoncrypto, + SSLCryptoProviderOpenssl, + } +} + +// ScheduleRunType - Frequency of the schedule operation of this policy. +type ScheduleRunType string + +const ( + ScheduleRunTypeDaily ScheduleRunType = "Daily" + ScheduleRunTypeHourly ScheduleRunType = "Hourly" + ScheduleRunTypeInvalid ScheduleRunType = "Invalid" + ScheduleRunTypeWeekly ScheduleRunType = "Weekly" +) + +// PossibleScheduleRunTypeValues returns the possible values for the ScheduleRunType const type. +func PossibleScheduleRunTypeValues() []ScheduleRunType { + return []ScheduleRunType{ + ScheduleRunTypeDaily, + ScheduleRunTypeHourly, + ScheduleRunTypeInvalid, + ScheduleRunTypeWeekly, + } +} + +// TieringMode - Tiering Mode to control automatic tiering of recovery points. Supported values are: +// 1. TierRecommended: Tier all recovery points recommended to be tiered +// 2. TierAfter: Tier all recovery points after a fixed period, as specified in duration + durationType below. +// 3. DoNotTier: Do not tier any recovery points +type TieringMode string + +const ( + TieringModeDoNotTier TieringMode = "DoNotTier" + TieringModeInvalid TieringMode = "Invalid" + TieringModeTierAfter TieringMode = "TierAfter" + TieringModeTierRecommended TieringMode = "TierRecommended" +) + +// PossibleTieringModeValues returns the possible values for the TieringMode const type. +func PossibleTieringModeValues() []TieringMode { + return []TieringMode{ + TieringModeDoNotTier, + TieringModeInvalid, + TieringModeTierAfter, + TieringModeTierRecommended, + } +} + +// VaultType - The vault type, whether it is existing or has to be created. +type VaultType string + +const ( + VaultTypeExisting VaultType = "Existing" + VaultTypeNew VaultType = "New" +) + +// PossibleVaultTypeValues returns the possible values for the VaultType const type. +func PossibleVaultTypeValues() []VaultType { + return []VaultType{ + VaultTypeExisting, + VaultTypeNew, + } +} + +type WeekOfMonth string + +const ( + WeekOfMonthFirst WeekOfMonth = "First" + WeekOfMonthFourth WeekOfMonth = "Fourth" + WeekOfMonthInvalid WeekOfMonth = "Invalid" + WeekOfMonthLast WeekOfMonth = "Last" + WeekOfMonthSecond WeekOfMonth = "Second" + WeekOfMonthThird WeekOfMonth = "Third" +) + +// PossibleWeekOfMonthValues returns the possible values for the WeekOfMonth const type. +func PossibleWeekOfMonthValues() []WeekOfMonth { + return []WeekOfMonth{ + WeekOfMonthFirst, + WeekOfMonthFourth, + WeekOfMonthInvalid, + WeekOfMonthLast, + WeekOfMonthSecond, + WeekOfMonthThird, + } +} + +// WorkloadType - Type of workload for the backup management +type WorkloadType string + +const ( + WorkloadTypeAzureFileShare WorkloadType = "AzureFileShare" + WorkloadTypeAzureSQLDb WorkloadType = "AzureSqlDb" + WorkloadTypeClient WorkloadType = "Client" + WorkloadTypeExchange WorkloadType = "Exchange" + WorkloadTypeFileFolder WorkloadType = "FileFolder" + WorkloadTypeGenericDataSource WorkloadType = "GenericDataSource" + WorkloadTypeInvalid WorkloadType = "Invalid" + WorkloadTypeSAPAseDatabase WorkloadType = "SAPAseDatabase" + WorkloadTypeSAPHanaDBInstance WorkloadType = "SAPHanaDBInstance" + WorkloadTypeSAPHanaDatabase WorkloadType = "SAPHanaDatabase" + WorkloadTypeSQLDB WorkloadType = "SQLDB" + WorkloadTypeSQLDataBase WorkloadType = "SQLDataBase" + WorkloadTypeSharepoint WorkloadType = "Sharepoint" + WorkloadTypeSystemState WorkloadType = "SystemState" + WorkloadTypeVM WorkloadType = "VM" + WorkloadTypeVMwareVM WorkloadType = "VMwareVM" +) + +// PossibleWorkloadTypeValues returns the possible values for the WorkloadType const type. +func PossibleWorkloadTypeValues() []WorkloadType { + return []WorkloadType{ + WorkloadTypeAzureFileShare, + WorkloadTypeAzureSQLDb, + WorkloadTypeClient, + WorkloadTypeExchange, + WorkloadTypeFileFolder, + WorkloadTypeGenericDataSource, + WorkloadTypeInvalid, + WorkloadTypeSAPAseDatabase, + WorkloadTypeSAPHanaDBInstance, + WorkloadTypeSAPHanaDatabase, + WorkloadTypeSQLDB, + WorkloadTypeSQLDataBase, + WorkloadTypeSharepoint, + WorkloadTypeSystemState, + WorkloadTypeVM, + WorkloadTypeVMwareVM, + } +} diff --git a/sdk/resourcemanager/workloads/armconnector/go.mod b/sdk/resourcemanager/workloads/armconnector/go.mod new file mode 100644 index 000000000000..ef185ade99a6 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/go.mod @@ -0,0 +1,13 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armconnector + +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/workloads/armconnector/go.sum b/sdk/resourcemanager/workloads/armconnector/go.sum new file mode 100644 index 000000000000..5c6bee428364 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/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/workloads/armconnector/interfaces.go b/sdk/resourcemanager/workloads/armconnector/interfaces.go new file mode 100644 index 000000000000..80fc9e1e3ac2 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/interfaces.go @@ -0,0 +1,54 @@ +//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 armconnector + +// BackupDataClassification provides polymorphic access to related types. +// Call the interface's GetBackupData() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BackupData, *HanaBackupData, *SQLBackupData, *VMBackupData +type BackupDataClassification interface { + // GetBackupData returns the BackupData content of the underlying type. + GetBackupData() *BackupData +} + +// ProtectionPolicyClassification provides polymorphic access to related types. +// Call the interface's GetProtectionPolicy() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureIaaSVMProtectionPolicy, *AzureVMWorkloadProtectionPolicy, *ProtectionPolicy +type ProtectionPolicyClassification interface { + // GetProtectionPolicy returns the ProtectionPolicy content of the underlying type. + GetProtectionPolicy() *ProtectionPolicy +} + +// RecoveryServicesVaultPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetRecoveryServicesVaultProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ExistingRecoveryServicesVault, *NewRecoveryServicesVault, *RecoveryServicesVaultProperties +type RecoveryServicesVaultPropertiesClassification interface { + // GetRecoveryServicesVaultProperties returns the RecoveryServicesVaultProperties content of the underlying type. + GetRecoveryServicesVaultProperties() *RecoveryServicesVaultProperties +} + +// RetentionPolicyClassification provides polymorphic access to related types. +// Call the interface's GetRetentionPolicy() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *LongTermRetentionPolicy, *RetentionPolicy, *SimpleRetentionPolicy +type RetentionPolicyClassification interface { + // GetRetentionPolicy returns the RetentionPolicy content of the underlying type. + GetRetentionPolicy() *RetentionPolicy +} + +// SchedulePolicyClassification provides polymorphic access to related types. +// Call the interface's GetSchedulePolicy() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *LogSchedulePolicy, *LongTermSchedulePolicy, *SchedulePolicy, *SimpleSchedulePolicy, *SimpleSchedulePolicyV2 +type SchedulePolicyClassification interface { + // GetSchedulePolicy returns the SchedulePolicy content of the underlying type. + GetSchedulePolicy() *SchedulePolicy +} diff --git a/sdk/resourcemanager/workloads/armconnector/models.go b/sdk/resourcemanager/workloads/armconnector/models.go new file mode 100644 index 000000000000..ee1c80e9210d --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/models.go @@ -0,0 +1,851 @@ +//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 armconnector + +import "time" + +// ACSSBackupConnection - Define the backup connection resource of virtual instance for SAP.. +type ACSSBackupConnection struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Defines the backup connection properties for a virtual instance for SAP. + Properties *ACSSBackupConnectionProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ACSSBackupConnectionList - Defines the collection of backup connection resources of virtual instances for SAP. +type ACSSBackupConnectionList struct { + // REQUIRED; Gets the list of backup connection resources of virtual instances for SAP. + Value []*ACSSBackupConnection + + // Gets the value of next link. + NextLink *string +} + +// ACSSBackupConnectionProperties - Defines the backup connection properties for a virtual instance for SAP. +type ACSSBackupConnectionProperties struct { + // Information about the recovery services vault and backup policy used for backup. + BackupData BackupDataClassification + + // READ-ONLY; Defines the errors related to backup connection resource of virtual instance for SAP. + Errors *ErrorDefinition + + // READ-ONLY; Defines the provisioning states. + ProvisioningState *ConnectorProvisioningState +} + +// AzureIaaSVMProtectionPolicy - IaaS VM workload-specific backup policy. +type AzureIaaSVMProtectionPolicy struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + BackupManagementType *string + + // Instant recovery point additional details. + InstantRPDetails *InstantRPAdditionalDetails + + // Instant RP retention policy range in days + InstantRpRetentionRangeInDays *int32 + + // The policy type. + PolicyType *IAASVMPolicyType + + // Number of items associated with this policy. + ProtectedItemsCount *int32 + + // ResourceGuard Operation Requests + ResourceGuardOperationRequests []*string + + // Retention policy with the details on backup copy retention ranges. + RetentionPolicy RetentionPolicyClassification + + // Backup schedule specified as part of backup policy. + SchedulePolicy SchedulePolicyClassification + + // Tiering policy to automatically move RPs to another tier Key is Target Tier, defined in RecoveryPointTierType enum. Tiering + // policy specifies the criteria to move RP to the target tier. + TieringPolicy map[string]*TieringPolicy + + // Time zone optional input as string. For example: "Pacific Standard Time". + TimeZone *string +} + +// GetProtectionPolicy implements the ProtectionPolicyClassification interface for type AzureIaaSVMProtectionPolicy. +func (a *AzureIaaSVMProtectionPolicy) GetProtectionPolicy() *ProtectionPolicy { + return &ProtectionPolicy{ + BackupManagementType: a.BackupManagementType, + ProtectedItemsCount: a.ProtectedItemsCount, + ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, + } +} + +// AzureVMWorkloadProtectionPolicy - Azure VM (Mercury) workload-specific backup policy. +type AzureVMWorkloadProtectionPolicy struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + BackupManagementType *string + + // Fix the policy inconsistency + MakePolicyConsistent *bool + + // Number of items associated with this policy. + ProtectedItemsCount *int32 + + // ResourceGuard Operation Requests + ResourceGuardOperationRequests []*string + + // Common settings for the backup management + Settings *Settings + + // List of sub-protection policies which includes schedule and retention + SubProtectionPolicy []*SubProtectionPolicy + + // Type of workload for the backup management + WorkLoadType *WorkloadType +} + +// GetProtectionPolicy implements the ProtectionPolicyClassification interface for type AzureVMWorkloadProtectionPolicy. +func (a *AzureVMWorkloadProtectionPolicy) GetProtectionPolicy() *ProtectionPolicy { + return &ProtectionPolicy{ + BackupManagementType: a.BackupManagementType, + ProtectedItemsCount: a.ProtectedItemsCount, + ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, + } +} + +// BackupData - Information about the recovery services vault and backup policy used for backup. +type BackupData struct { + // REQUIRED; The type of backup, VM, SQL or HANA. + BackupType *BackupType + + // REQUIRED; The properties of the recovery services vault used for backup. + RecoveryServicesVault RecoveryServicesVaultPropertiesClassification +} + +// GetBackupData implements the BackupDataClassification interface for type BackupData. +func (b *BackupData) GetBackupData() *BackupData { return b } + +// Connector - Define the connector resource. +type Connector struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // REQUIRED; Defines the connector resource properties. + Properties *Properties + + // Managed service identity (user assigned identities) + Identity *UserAssignedServiceIdentity + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// DBBackupPolicyProperties - Defines the policy properties for database backup. +type DBBackupPolicyProperties struct { + // REQUIRED; The name of the DB backup policy. + Name *string + + // Azure VM (Mercury) workload-specific backup policy. + Properties *AzureVMWorkloadProtectionPolicy +} + +// DailyRetentionFormat - Daily retention format. +type DailyRetentionFormat struct { + // List of days of the month. + DaysOfTheMonth []*Day +} + +// DailyRetentionSchedule - Daily retention schedule. +type DailyRetentionSchedule struct { + // Retention duration of retention Policy. + RetentionDuration *RetentionDuration + + // Retention times of retention policy. + RetentionTimes []*time.Time +} + +// DailySchedule - Daily schedule. +type DailySchedule struct { + // List of times of day this schedule has to be run. + ScheduleRunTimes []*time.Time +} + +// Day of the week. +type Day struct { + // Date of the month + Date *int32 + + // Whether Date is last date of month + IsLast *bool +} + +// DiskExclusionProperties - Defines the disk exclusion properties for virtual machine backup. +type DiskExclusionProperties struct { + // REQUIRED; List of Disks' Logical Unit Numbers (LUN) to be used for VM Protection. + DiskLunList []*int32 + + // REQUIRED; Flag to indicate whether DiskLunList is to be included/ excluded from backup. + IsInclusionList *bool +} + +// ErrorDefinition - Error definition. +type ErrorDefinition struct { + // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. + Code *string + + // READ-ONLY; Internal error details. + Details []*ErrorDefinition + + // READ-ONLY; Description of the error. + Message *string +} + +// ExistingRecoveryServicesVault - Existing recovery services vault. +type ExistingRecoveryServicesVault struct { + // REQUIRED; The resource ID of the recovery services vault that has been created. + ID *string + + // REQUIRED; The vault type, whether it is existing or has to be created. + VaultType *VaultType +} + +// GetRecoveryServicesVaultProperties implements the RecoveryServicesVaultPropertiesClassification interface for type ExistingRecoveryServicesVault. +func (e *ExistingRecoveryServicesVault) GetRecoveryServicesVaultProperties() *RecoveryServicesVaultProperties { + return &RecoveryServicesVaultProperties{ + VaultType: e.VaultType, + } +} + +// HanaBackupData - Defines the HANA Backup data for a virtual instance for SAP. +type HanaBackupData struct { + // REQUIRED; Defines the policy properties for database backup. + BackupPolicy *DBBackupPolicyProperties + + // REQUIRED; The type of backup, VM, SQL or HANA. + BackupType *BackupType + + // REQUIRED; Name of the HANA Database User Store Key. + HdbuserstoreKeyName *string + + // REQUIRED; The properties of the recovery services vault used for backup. + RecoveryServicesVault RecoveryServicesVaultPropertiesClassification + + // Defines the policy properties for database backup. + DbInstanceSnapshotBackupPolicy *DBBackupPolicyProperties + + // Gets or sets the database instance number. + InstanceNumber *string + + // Path of the SSL key store. + SSLConfiguration *SSLConfiguration +} + +// GetBackupData implements the BackupDataClassification interface for type HanaBackupData. +func (h *HanaBackupData) GetBackupData() *BackupData { + return &BackupData{ + BackupType: h.BackupType, + RecoveryServicesVault: h.RecoveryServicesVault, + } +} + +// HourlySchedule - Hourly schedule. +type HourlySchedule struct { + // Interval at which backup needs to be triggered. For hourly the value can be 4/6/8/12 + Interval *int32 + + // To specify duration of the backup window + ScheduleWindowDuration *int32 + + // To specify start time of the backup window + ScheduleWindowStartTime *time.Time +} + +// InstantRPAdditionalDetails - Instant recovery point additional details. +type InstantRPAdditionalDetails struct { + // Azure backup resource group name prefix. + AzureBackupRGNamePrefix *string + + // Azure backup resource group name suffix. + AzureBackupRGNameSuffix *string +} + +// List - Defines the collection of connector resources. +type List struct { + // REQUIRED; Gets the list of connector resources. + Value []*Connector + + // Gets the value of next link. + NextLink *string +} + +// LogSchedulePolicy - Log policy schedule. +type LogSchedulePolicy struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + SchedulePolicyType *string + + // Frequency of the log schedule operation of this policy in minutes. + ScheduleFrequencyInMins *int32 +} + +// GetSchedulePolicy implements the SchedulePolicyClassification interface for type LogSchedulePolicy. +func (l *LogSchedulePolicy) GetSchedulePolicy() *SchedulePolicy { + return &SchedulePolicy{ + SchedulePolicyType: l.SchedulePolicyType, + } +} + +// LongTermRetentionPolicy - Long term retention policy. +type LongTermRetentionPolicy struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + RetentionPolicyType *string + + // Daily retention schedule of the protection policy. + DailySchedule *DailyRetentionSchedule + + // Monthly retention schedule of the protection policy. + MonthlySchedule *MonthlyRetentionSchedule + + // Weekly retention schedule of the protection policy. + WeeklySchedule *WeeklyRetentionSchedule + + // Yearly retention schedule of the protection policy. + YearlySchedule *YearlyRetentionSchedule +} + +// GetRetentionPolicy implements the RetentionPolicyClassification interface for type LongTermRetentionPolicy. +func (l *LongTermRetentionPolicy) GetRetentionPolicy() *RetentionPolicy { + return &RetentionPolicy{ + RetentionPolicyType: l.RetentionPolicyType, + } +} + +// LongTermSchedulePolicy - Long term policy schedule. +type LongTermSchedulePolicy struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + SchedulePolicyType *string +} + +// GetSchedulePolicy implements the SchedulePolicyClassification interface for type LongTermSchedulePolicy. +func (l *LongTermSchedulePolicy) GetSchedulePolicy() *SchedulePolicy { + return &SchedulePolicy{ + SchedulePolicyType: l.SchedulePolicyType, + } +} + +// ManagedRGConfiguration - Managed resource group configuration +type ManagedRGConfiguration struct { + // Managed resource group name + Name *string +} + +// MonthlyRetentionSchedule - Monthly retention schedule. +type MonthlyRetentionSchedule struct { + // Retention duration of retention Policy. + RetentionDuration *RetentionDuration + + // Daily retention format for monthly retention policy. + RetentionScheduleDaily *DailyRetentionFormat + + // Retention schedule format type for monthly retention policy. + RetentionScheduleFormatType *RetentionScheduleFormat + + // Weekly retention format for monthly retention policy. + RetentionScheduleWeekly *WeeklyRetentionFormat + + // Retention times of retention policy. + RetentionTimes []*time.Time +} + +// NewRecoveryServicesVault - New recovery services vault. +type NewRecoveryServicesVault struct { + // REQUIRED; The name of the recovery services vault has to be created. + Name *string + + // REQUIRED; The name of the resource group where the recovery services vault has to be created. + ResourceGroup *string + + // REQUIRED; The vault type, whether it is existing or has to be created. + VaultType *VaultType +} + +// GetRecoveryServicesVaultProperties implements the RecoveryServicesVaultPropertiesClassification interface for type NewRecoveryServicesVault. +func (n *NewRecoveryServicesVault) GetRecoveryServicesVaultProperties() *RecoveryServicesVaultProperties { + return &RecoveryServicesVaultProperties{ + VaultType: n.VaultType, + } +} + +// 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 +} + +// Properties - Defines the connector resource properties. +type Properties struct { + // REQUIRED; Defines the ID of the connector's source resource. + SourceResourceID *string + + // Managed resource group configuration + ManagedResourceGroupConfiguration *ManagedRGConfiguration + + // READ-ONLY; Indicates any errors on the connector resource. + Errors *ErrorDefinition + + // READ-ONLY; Defines the provisioning states. + ProvisioningState *ConnectorProvisioningState +} + +// ProtectionPolicy - Base class for backup policy. Workload-specific backup policies are derived from this class. +type ProtectionPolicy struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + BackupManagementType *string + + // Number of items associated with this policy. + ProtectedItemsCount *int32 + + // ResourceGuard Operation Requests + ResourceGuardOperationRequests []*string +} + +// GetProtectionPolicy implements the ProtectionPolicyClassification interface for type ProtectionPolicy. +func (p *ProtectionPolicy) GetProtectionPolicy() *ProtectionPolicy { return p } + +// RecoveryServicesVaultProperties - The properties of the recovery services vault used for backup. +type RecoveryServicesVaultProperties struct { + // REQUIRED; The vault type, whether it is existing or has to be created. + VaultType *VaultType +} + +// GetRecoveryServicesVaultProperties implements the RecoveryServicesVaultPropertiesClassification interface for type RecoveryServicesVaultProperties. +func (r *RecoveryServicesVaultProperties) GetRecoveryServicesVaultProperties() *RecoveryServicesVaultProperties { + return r +} + +// RetentionDuration - Retention duration. +type RetentionDuration struct { + // Count of duration types. Retention duration is obtained by the counting the duration type Count times. For example, when + // Count = 3 and DurationType = Weeks, retention duration will be three weeks. + Count *int32 + + // Retention duration type of retention policy. + DurationType *RetentionDurationType +} + +// RetentionPolicy - Base class for retention policy. +type RetentionPolicy struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + RetentionPolicyType *string +} + +// GetRetentionPolicy implements the RetentionPolicyClassification interface for type RetentionPolicy. +func (r *RetentionPolicy) GetRetentionPolicy() *RetentionPolicy { return r } + +// SQLBackupData - Defines the SQL Backup data for a virtual instance for SAP. +type SQLBackupData struct { + // REQUIRED; Defines the policy properties for database backup. + BackupPolicy *DBBackupPolicyProperties + + // REQUIRED; The type of backup, VM, SQL or HANA. + BackupType *BackupType + + // REQUIRED; The properties of the recovery services vault used for backup. + RecoveryServicesVault RecoveryServicesVaultPropertiesClassification +} + +// GetBackupData implements the BackupDataClassification interface for type SQLBackupData. +func (s *SQLBackupData) GetBackupData() *BackupData { + return &BackupData{ + BackupType: s.BackupType, + RecoveryServicesVault: s.RecoveryServicesVault, + } +} + +// SSLConfiguration - Specify the HANA database TLS/SSL properties which will be used for enabling Azure Backup for this database. +// You need to specify these details if you have enabled secure communication for your HANA +// database. +type SSLConfiguration struct { + // Specify the crypto provider being used (commoncrypto/openssl). If this argument is not provided, it is automatically determined + // by searching in the configuration files. + SSLCryptoProvider *SSLCryptoProvider + + // Specify the hostname as mentioned in the SSL certificate. If this argument is not provided, it is automatically determined + // by searching in the SSL certificate. + SSLHostNameInCertificate *string + + // Specify the name of the keystore file that contains the client's identity (eg. sapsrv.pse). The script will search for + // the file in the appropriate directory depending on the crypto provider mentioned. + // If this argument is not provided, it is automatically determined by searching in the configuration files. + SSLKeyStore *string + + // Specify the name of the trust store file that contains the server’s public certificates (eg. sapsrv.pse). The script will + // search for the file in the appropriate directory depending on the crypto + // provider mentioned. If this argument is not provided, it is automatically determined by searching in the configuration + // files. + SSLTrustStore *string +} + +// SchedulePolicy - Base class for backup schedule. +type SchedulePolicy struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + SchedulePolicyType *string +} + +// GetSchedulePolicy implements the SchedulePolicyClassification interface for type SchedulePolicy. +func (s *SchedulePolicy) GetSchedulePolicy() *SchedulePolicy { return s } + +// Settings - Common settings field for backup management +type Settings struct { + // Workload compression flag. This has been added so that 'isSqlCompression' will be deprecated once clients upgrade to consider + // this flag. + IsCompression *bool + + // SQL compression flag + Issqlcompression *bool + + // TimeZone optional input as string. For example: TimeZone = "Pacific Standard Time". + TimeZone *string +} + +// SimpleRetentionPolicy - Simple policy retention. +type SimpleRetentionPolicy struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + RetentionPolicyType *string + + // Retention duration of the protection policy. + RetentionDuration *RetentionDuration +} + +// GetRetentionPolicy implements the RetentionPolicyClassification interface for type SimpleRetentionPolicy. +func (s *SimpleRetentionPolicy) GetRetentionPolicy() *RetentionPolicy { + return &RetentionPolicy{ + RetentionPolicyType: s.RetentionPolicyType, + } +} + +// SimpleSchedulePolicy - Simple policy schedule. +type SimpleSchedulePolicy struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + SchedulePolicyType *string + + // Hourly Schedule of this Policy + HourlySchedule *HourlySchedule + + // List of days of week this schedule has to be run. + ScheduleRunDays []*DayOfWeek + + // Frequency of the schedule operation of this policy. + ScheduleRunFrequency *ScheduleRunType + + // List of times of day this schedule has to be run. + ScheduleRunTimes []*time.Time + + // At every number weeks this schedule has to be run. + ScheduleWeeklyFrequency *int32 +} + +// GetSchedulePolicy implements the SchedulePolicyClassification interface for type SimpleSchedulePolicy. +func (s *SimpleSchedulePolicy) GetSchedulePolicy() *SchedulePolicy { + return &SchedulePolicy{ + SchedulePolicyType: s.SchedulePolicyType, + } +} + +// SimpleSchedulePolicyV2 - The V2 policy schedule for IaaS that supports hourly backups. +type SimpleSchedulePolicyV2 struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + SchedulePolicyType *string + + // Daily schedule of this policy + DailySchedule *DailySchedule + + // hourly schedule of this policy + HourlySchedule *HourlySchedule + + // Frequency of the schedule operation of this policy. + ScheduleRunFrequency *ScheduleRunType + + // Weekly schedule of this policy + WeeklySchedule *WeeklySchedule +} + +// GetSchedulePolicy implements the SchedulePolicyClassification interface for type SimpleSchedulePolicyV2. +func (s *SimpleSchedulePolicyV2) GetSchedulePolicy() *SchedulePolicy { + return &SchedulePolicy{ + SchedulePolicyType: s.SchedulePolicyType, + } +} + +// SnapshotBackupAdditionalDetails - Snapshot Backup related fields for WorkloadType SAP Hana system +type SnapshotBackupAdditionalDetails struct { + // Instant RP details for the snapshot. + InstantRPDetails *string + + // Retention range for instant Rp in days. + InstantRpRetentionRangeInDays *int32 + + // User Assigned managed identity details used for snapshot policy. + UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails +} + +// SubProtectionPolicy - Sub-protection policy which includes schedule and retention +type SubProtectionPolicy struct { + // Type of backup policy type + PolicyType *PolicyType + + // Retention policy with the details on backup copy retention ranges. + RetentionPolicy RetentionPolicyClassification + + // Backup schedule specified as part of backup policy. + SchedulePolicy SchedulePolicyClassification + + // Hana DB instance snapshot backup additional details. + SnapshotBackupAdditionalDetails *SnapshotBackupAdditionalDetails + + // Tiering policy to automatically move RPs to another tier. Key is Target Tier, defined in RecoveryPointTierType enum. Tiering + // policy specifies the criteria to move RP to the target tier. + TieringPolicy map[string]*TieringPolicy +} + +// 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 +} + +// TieringPolicy - Tiering Policy for a target tier. If the policy is not specified for a given target tier, service retains +// the existing configured tiering policy for that tier +type TieringPolicy struct { + // Number of days/weeks/months/years to retain backups in current tier before tiering. Used only if TieringMode is set to + // TierAfter + Duration *int32 + + // Retention duration type: days/weeks/months/years Used only if TieringMode is set to TierAfter + DurationType *RetentionDurationType + + // Tiering Mode to control automatic tiering of recovery points. Supported values are: + // 1. TierRecommended: Tier all recovery points recommended to be tiered + // 2. TierAfter: Tier all recovery points after a fixed period, as specified in duration + durationType below. + // 3. DoNotTier: Do not tier any recovery points + TieringMode *TieringMode +} + +// UpdateACSSBackupConnectionRequest - Defines the request body for updating backup connection resource of virtual instance +// for SAP. +type UpdateACSSBackupConnectionRequest struct { + // Gets or sets the Resource tags. + Tags map[string]*string +} + +// UpdateConnectorRequest - Defines the request body for updating a connector. +type UpdateConnectorRequest struct { + // Managed service identity (user assigned identities) + Identity *UserAssignedServiceIdentity + + // Gets or sets the resource tags. + Tags map[string]*string +} + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} + +// UserAssignedIdentityProperties - User assigned managed identity properties. +type UserAssignedIdentityProperties struct { + ClientID *string + PrincipalID *string +} + +// UserAssignedManagedIdentityDetails - User assigned managed identity details. +type UserAssignedManagedIdentityDetails struct { + IdentityArmID *string + IdentityName *string + + // User assigned managed identity properties. + UserAssignedIdentityProperties *UserAssignedIdentityProperties +} + +// UserAssignedServiceIdentity - Managed service identity (user assigned identities) +type UserAssignedServiceIdentity struct { + // REQUIRED; Type of manage identity + Type *ManagedServiceIdentityType + + // User assigned identities dictionary + UserAssignedIdentities map[string]*UserAssignedIdentity +} + +// VMBackupData - Defines the VM Backup data for a virtual instance for SAP. +type VMBackupData struct { + // REQUIRED; Defines the policy properties for virtual machine backup. + BackupPolicy *VMBackupPolicyProperties + + // REQUIRED; The type of backup, VM, SQL or HANA. + BackupType *BackupType + + // REQUIRED; The properties of the recovery services vault used for backup. + RecoveryServicesVault RecoveryServicesVaultPropertiesClassification + + // Defines the disk exclusion properties for virtual machine backup. + DiskExclusionProperties *DiskExclusionProperties +} + +// GetBackupData implements the BackupDataClassification interface for type VMBackupData. +func (v *VMBackupData) GetBackupData() *BackupData { + return &BackupData{ + BackupType: v.BackupType, + RecoveryServicesVault: v.RecoveryServicesVault, + } +} + +// VMBackupPolicyProperties - Defines the policy properties for virtual machine backup. +type VMBackupPolicyProperties struct { + // REQUIRED; The name of the VM Backup policy. + Name *string + + // IaaS VM workload-specific backup policy. + Properties *AzureIaaSVMProtectionPolicy +} + +// WeeklyRetentionFormat - Weekly retention format. +type WeeklyRetentionFormat struct { + // List of days of the week. + DaysOfTheWeek []*DayOfWeek + + // List of weeks of month. + WeeksOfTheMonth []*WeekOfMonth +} + +// WeeklyRetentionSchedule - Weekly retention schedule. +type WeeklyRetentionSchedule struct { + // List of days of week for weekly retention policy. + DaysOfTheWeek []*DayOfWeek + + // Retention duration of retention Policy. + RetentionDuration *RetentionDuration + + // Retention times of retention policy. + RetentionTimes []*time.Time +} + +// WeeklySchedule - Weekly schedule. +type WeeklySchedule struct { + // Schedule run days. + ScheduleRunDays []*DayOfWeek + + // List of times of day this schedule has to be run. + ScheduleRunTimes []*time.Time +} + +// YearlyRetentionSchedule - Yearly retention schedule. +type YearlyRetentionSchedule struct { + // List of months of year of yearly retention policy. + MonthsOfYear []*MonthOfYear + + // Retention duration of retention Policy. + RetentionDuration *RetentionDuration + + // Daily retention format for yearly retention policy. + RetentionScheduleDaily *DailyRetentionFormat + + // Retention schedule format for yearly retention policy. + RetentionScheduleFormatType *RetentionScheduleFormat + + // Weekly retention format for yearly retention policy. + RetentionScheduleWeekly *WeeklyRetentionFormat + + // Retention times of retention policy. + RetentionTimes []*time.Time +} diff --git a/sdk/resourcemanager/workloads/armconnector/models_serde.go b/sdk/resourcemanager/workloads/armconnector/models_serde.go new file mode 100644 index 000000000000..5f723d79a61d --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/models_serde.go @@ -0,0 +1,2097 @@ +//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 armconnector + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "time" +) + +// MarshalJSON implements the json.Marshaller interface for type ACSSBackupConnection. +func (a ACSSBackupConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSSBackupConnection. +func (a *ACSSBackupConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ACSSBackupConnectionList. +func (a ACSSBackupConnectionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSSBackupConnectionList. +func (a *ACSSBackupConnectionList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ACSSBackupConnectionProperties. +func (a ACSSBackupConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupData", a.BackupData) + populate(objectMap, "errors", a.Errors) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSSBackupConnectionProperties. +func (a *ACSSBackupConnectionProperties) 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 "backupData": + a.BackupData, err = unmarshalBackupDataClassification(val) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &a.Errors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + 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 AzureIaaSVMProtectionPolicy. +func (a AzureIaaSVMProtectionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["backupManagementType"] = "AzureIaasVM" + populate(objectMap, "instantRPDetails", a.InstantRPDetails) + populate(objectMap, "instantRpRetentionRangeInDays", a.InstantRpRetentionRangeInDays) + populate(objectMap, "policyType", a.PolicyType) + populate(objectMap, "protectedItemsCount", a.ProtectedItemsCount) + populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) + populate(objectMap, "retentionPolicy", a.RetentionPolicy) + populate(objectMap, "schedulePolicy", a.SchedulePolicy) + populate(objectMap, "tieringPolicy", a.TieringPolicy) + populate(objectMap, "timeZone", a.TimeZone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureIaaSVMProtectionPolicy. +func (a *AzureIaaSVMProtectionPolicy) 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 "backupManagementType": + err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) + delete(rawMsg, key) + case "instantRPDetails": + err = unpopulate(val, "InstantRPDetails", &a.InstantRPDetails) + delete(rawMsg, key) + case "instantRpRetentionRangeInDays": + err = unpopulate(val, "InstantRpRetentionRangeInDays", &a.InstantRpRetentionRangeInDays) + delete(rawMsg, key) + case "policyType": + err = unpopulate(val, "PolicyType", &a.PolicyType) + delete(rawMsg, key) + case "protectedItemsCount": + err = unpopulate(val, "ProtectedItemsCount", &a.ProtectedItemsCount) + delete(rawMsg, key) + case "resourceGuardOperationRequests": + err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) + delete(rawMsg, key) + case "retentionPolicy": + a.RetentionPolicy, err = unmarshalRetentionPolicyClassification(val) + delete(rawMsg, key) + case "schedulePolicy": + a.SchedulePolicy, err = unmarshalSchedulePolicyClassification(val) + delete(rawMsg, key) + case "tieringPolicy": + err = unpopulate(val, "TieringPolicy", &a.TieringPolicy) + delete(rawMsg, key) + case "timeZone": + err = unpopulate(val, "TimeZone", &a.TimeZone) + 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 AzureVMWorkloadProtectionPolicy. +func (a AzureVMWorkloadProtectionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["backupManagementType"] = "AzureWorkload" + populate(objectMap, "makePolicyConsistent", a.MakePolicyConsistent) + populate(objectMap, "protectedItemsCount", a.ProtectedItemsCount) + populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) + populate(objectMap, "settings", a.Settings) + populate(objectMap, "subProtectionPolicy", a.SubProtectionPolicy) + populate(objectMap, "workLoadType", a.WorkLoadType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadProtectionPolicy. +func (a *AzureVMWorkloadProtectionPolicy) 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 "backupManagementType": + err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) + delete(rawMsg, key) + case "makePolicyConsistent": + err = unpopulate(val, "MakePolicyConsistent", &a.MakePolicyConsistent) + delete(rawMsg, key) + case "protectedItemsCount": + err = unpopulate(val, "ProtectedItemsCount", &a.ProtectedItemsCount) + delete(rawMsg, key) + case "resourceGuardOperationRequests": + err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &a.Settings) + delete(rawMsg, key) + case "subProtectionPolicy": + err = unpopulate(val, "SubProtectionPolicy", &a.SubProtectionPolicy) + delete(rawMsg, key) + case "workLoadType": + err = unpopulate(val, "WorkLoadType", &a.WorkLoadType) + 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 BackupData. +func (b BackupData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["backupType"] = b.BackupType + populate(objectMap, "recoveryServicesVault", b.RecoveryServicesVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupData. +func (b *BackupData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupType": + err = unpopulate(val, "BackupType", &b.BackupType) + delete(rawMsg, key) + case "recoveryServicesVault": + b.RecoveryServicesVault, err = unmarshalRecoveryServicesVaultPropertiesClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Connector. +func (c Connector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + 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 Connector. +func (c *Connector) 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 "identity": + err = unpopulate(val, "Identity", &c.Identity) + 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 DBBackupPolicyProperties. +func (d DBBackupPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DBBackupPolicyProperties. +func (d *DBBackupPolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DailyRetentionFormat. +func (d DailyRetentionFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "daysOfTheMonth", d.DaysOfTheMonth) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DailyRetentionFormat. +func (d *DailyRetentionFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "daysOfTheMonth": + err = unpopulate(val, "DaysOfTheMonth", &d.DaysOfTheMonth) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DailyRetentionSchedule. +func (d DailyRetentionSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "retentionDuration", d.RetentionDuration) + aux := make([]*timeRFC3339, len(d.RetentionTimes), len(d.RetentionTimes)) + for i := 0; i < len(d.RetentionTimes); i++ { + aux[i] = (*timeRFC3339)(d.RetentionTimes[i]) + } + populate(objectMap, "retentionTimes", aux) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DailyRetentionSchedule. +func (d *DailyRetentionSchedule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "retentionDuration": + err = unpopulate(val, "RetentionDuration", &d.RetentionDuration) + delete(rawMsg, key) + case "retentionTimes": + var aux []*timeRFC3339 + err = unpopulate(val, "RetentionTimes", &aux) + for _, au := range aux { + d.RetentionTimes = append(d.RetentionTimes, (*time.Time)(au)) + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DailySchedule. +func (d DailySchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + aux := make([]*timeRFC3339, len(d.ScheduleRunTimes), len(d.ScheduleRunTimes)) + for i := 0; i < len(d.ScheduleRunTimes); i++ { + aux[i] = (*timeRFC3339)(d.ScheduleRunTimes[i]) + } + populate(objectMap, "scheduleRunTimes", aux) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DailySchedule. +func (d *DailySchedule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "scheduleRunTimes": + var aux []*timeRFC3339 + err = unpopulate(val, "ScheduleRunTimes", &aux) + for _, au := range aux { + d.ScheduleRunTimes = append(d.ScheduleRunTimes, (*time.Time)(au)) + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Day. +func (d Day) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "date", d.Date) + populate(objectMap, "isLast", d.IsLast) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Day. +func (d *Day) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "date": + err = unpopulate(val, "Date", &d.Date) + delete(rawMsg, key) + case "isLast": + err = unpopulate(val, "IsLast", &d.IsLast) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskExclusionProperties. +func (d DiskExclusionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diskLunList", d.DiskLunList) + populate(objectMap, "isInclusionList", d.IsInclusionList) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskExclusionProperties. +func (d *DiskExclusionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskLunList": + err = unpopulate(val, "DiskLunList", &d.DiskLunList) + delete(rawMsg, key) + case "isInclusionList": + err = unpopulate(val, "IsInclusionList", &d.IsInclusionList) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. +func (e ErrorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDefinition. +func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExistingRecoveryServicesVault. +func (e ExistingRecoveryServicesVault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + objectMap["vaultType"] = VaultTypeExisting + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExistingRecoveryServicesVault. +func (e *ExistingRecoveryServicesVault) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "vaultType": + err = unpopulate(val, "VaultType", &e.VaultType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HanaBackupData. +func (h HanaBackupData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupPolicy", h.BackupPolicy) + objectMap["backupType"] = BackupTypeHANA + populate(objectMap, "dbInstanceSnapshotBackupPolicy", h.DbInstanceSnapshotBackupPolicy) + populate(objectMap, "hdbuserstoreKeyName", h.HdbuserstoreKeyName) + populate(objectMap, "instanceNumber", h.InstanceNumber) + populate(objectMap, "recoveryServicesVault", h.RecoveryServicesVault) + populate(objectMap, "sslConfiguration", h.SSLConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HanaBackupData. +func (h *HanaBackupData) 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 "backupPolicy": + err = unpopulate(val, "BackupPolicy", &h.BackupPolicy) + delete(rawMsg, key) + case "backupType": + err = unpopulate(val, "BackupType", &h.BackupType) + delete(rawMsg, key) + case "dbInstanceSnapshotBackupPolicy": + err = unpopulate(val, "DbInstanceSnapshotBackupPolicy", &h.DbInstanceSnapshotBackupPolicy) + delete(rawMsg, key) + case "hdbuserstoreKeyName": + err = unpopulate(val, "HdbuserstoreKeyName", &h.HdbuserstoreKeyName) + delete(rawMsg, key) + case "instanceNumber": + err = unpopulate(val, "InstanceNumber", &h.InstanceNumber) + delete(rawMsg, key) + case "recoveryServicesVault": + h.RecoveryServicesVault, err = unmarshalRecoveryServicesVaultPropertiesClassification(val) + delete(rawMsg, key) + case "sslConfiguration": + err = unpopulate(val, "SSLConfiguration", &h.SSLConfiguration) + 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 HourlySchedule. +func (h HourlySchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "interval", h.Interval) + populate(objectMap, "scheduleWindowDuration", h.ScheduleWindowDuration) + populateTimeRFC3339(objectMap, "scheduleWindowStartTime", h.ScheduleWindowStartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HourlySchedule. +func (h *HourlySchedule) 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 "interval": + err = unpopulate(val, "Interval", &h.Interval) + delete(rawMsg, key) + case "scheduleWindowDuration": + err = unpopulate(val, "ScheduleWindowDuration", &h.ScheduleWindowDuration) + delete(rawMsg, key) + case "scheduleWindowStartTime": + err = unpopulateTimeRFC3339(val, "ScheduleWindowStartTime", &h.ScheduleWindowStartTime) + 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 InstantRPAdditionalDetails. +func (i InstantRPAdditionalDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureBackupRGNamePrefix", i.AzureBackupRGNamePrefix) + populate(objectMap, "azureBackupRGNameSuffix", i.AzureBackupRGNameSuffix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InstantRPAdditionalDetails. +func (i *InstantRPAdditionalDetails) 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 "azureBackupRGNamePrefix": + err = unpopulate(val, "AzureBackupRGNamePrefix", &i.AzureBackupRGNamePrefix) + delete(rawMsg, key) + case "azureBackupRGNameSuffix": + err = unpopulate(val, "AzureBackupRGNameSuffix", &i.AzureBackupRGNameSuffix) + 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 List. +func (l List) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type List. +func (l *List) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogSchedulePolicy. +func (l LogSchedulePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "scheduleFrequencyInMins", l.ScheduleFrequencyInMins) + objectMap["schedulePolicyType"] = "LogSchedulePolicy" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogSchedulePolicy. +func (l *LogSchedulePolicy) 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 "scheduleFrequencyInMins": + err = unpopulate(val, "ScheduleFrequencyInMins", &l.ScheduleFrequencyInMins) + delete(rawMsg, key) + case "schedulePolicyType": + err = unpopulate(val, "SchedulePolicyType", &l.SchedulePolicyType) + 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 LongTermRetentionPolicy. +func (l LongTermRetentionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dailySchedule", l.DailySchedule) + populate(objectMap, "monthlySchedule", l.MonthlySchedule) + objectMap["retentionPolicyType"] = "LongTermRetentionPolicy" + populate(objectMap, "weeklySchedule", l.WeeklySchedule) + populate(objectMap, "yearlySchedule", l.YearlySchedule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LongTermRetentionPolicy. +func (l *LongTermRetentionPolicy) 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 "dailySchedule": + err = unpopulate(val, "DailySchedule", &l.DailySchedule) + delete(rawMsg, key) + case "monthlySchedule": + err = unpopulate(val, "MonthlySchedule", &l.MonthlySchedule) + delete(rawMsg, key) + case "retentionPolicyType": + err = unpopulate(val, "RetentionPolicyType", &l.RetentionPolicyType) + delete(rawMsg, key) + case "weeklySchedule": + err = unpopulate(val, "WeeklySchedule", &l.WeeklySchedule) + delete(rawMsg, key) + case "yearlySchedule": + err = unpopulate(val, "YearlySchedule", &l.YearlySchedule) + 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 LongTermSchedulePolicy. +func (l LongTermSchedulePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["schedulePolicyType"] = "LongTermSchedulePolicy" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LongTermSchedulePolicy. +func (l *LongTermSchedulePolicy) 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 "schedulePolicyType": + err = unpopulate(val, "SchedulePolicyType", &l.SchedulePolicyType) + 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 ManagedRGConfiguration. +func (m ManagedRGConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", m.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRGConfiguration. +func (m *ManagedRGConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonthlyRetentionSchedule. +func (m MonthlyRetentionSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "retentionDuration", m.RetentionDuration) + populate(objectMap, "retentionScheduleDaily", m.RetentionScheduleDaily) + populate(objectMap, "retentionScheduleFormatType", m.RetentionScheduleFormatType) + populate(objectMap, "retentionScheduleWeekly", m.RetentionScheduleWeekly) + aux := make([]*timeRFC3339, len(m.RetentionTimes), len(m.RetentionTimes)) + for i := 0; i < len(m.RetentionTimes); i++ { + aux[i] = (*timeRFC3339)(m.RetentionTimes[i]) + } + populate(objectMap, "retentionTimes", aux) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonthlyRetentionSchedule. +func (m *MonthlyRetentionSchedule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "retentionDuration": + err = unpopulate(val, "RetentionDuration", &m.RetentionDuration) + delete(rawMsg, key) + case "retentionScheduleDaily": + err = unpopulate(val, "RetentionScheduleDaily", &m.RetentionScheduleDaily) + delete(rawMsg, key) + case "retentionScheduleFormatType": + err = unpopulate(val, "RetentionScheduleFormatType", &m.RetentionScheduleFormatType) + delete(rawMsg, key) + case "retentionScheduleWeekly": + err = unpopulate(val, "RetentionScheduleWeekly", &m.RetentionScheduleWeekly) + delete(rawMsg, key) + case "retentionTimes": + var aux []*timeRFC3339 + err = unpopulate(val, "RetentionTimes", &aux) + for _, au := range aux { + m.RetentionTimes = append(m.RetentionTimes, (*time.Time)(au)) + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NewRecoveryServicesVault. +func (n NewRecoveryServicesVault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", n.Name) + populate(objectMap, "resourceGroup", n.ResourceGroup) + objectMap["vaultType"] = VaultTypeNew + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NewRecoveryServicesVault. +func (n *NewRecoveryServicesVault) 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 "resourceGroup": + err = unpopulate(val, "ResourceGroup", &n.ResourceGroup) + delete(rawMsg, key) + case "vaultType": + err = unpopulate(val, "VaultType", &n.VaultType) + 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 Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errors", p.Errors) + populate(objectMap, "managedResourceGroupConfiguration", p.ManagedResourceGroupConfiguration) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "sourceResourceId", p.SourceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. +func (p *Properties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errors": + err = unpopulate(val, "Errors", &p.Errors) + delete(rawMsg, key) + case "managedResourceGroupConfiguration": + err = unpopulate(val, "ManagedResourceGroupConfiguration", &p.ManagedResourceGroupConfiguration) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &p.SourceResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProtectionPolicy. +func (p ProtectionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["backupManagementType"] = p.BackupManagementType + populate(objectMap, "protectedItemsCount", p.ProtectedItemsCount) + populate(objectMap, "resourceGuardOperationRequests", p.ResourceGuardOperationRequests) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionPolicy. +func (p *ProtectionPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupManagementType": + err = unpopulate(val, "BackupManagementType", &p.BackupManagementType) + delete(rawMsg, key) + case "protectedItemsCount": + err = unpopulate(val, "ProtectedItemsCount", &p.ProtectedItemsCount) + delete(rawMsg, key) + case "resourceGuardOperationRequests": + err = unpopulate(val, "ResourceGuardOperationRequests", &p.ResourceGuardOperationRequests) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecoveryServicesVaultProperties. +func (r RecoveryServicesVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["vaultType"] = r.VaultType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryServicesVaultProperties. +func (r *RecoveryServicesVaultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vaultType": + err = unpopulate(val, "VaultType", &r.VaultType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RetentionDuration. +func (r RetentionDuration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", r.Count) + populate(objectMap, "durationType", r.DurationType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionDuration. +func (r *RetentionDuration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &r.Count) + delete(rawMsg, key) + case "durationType": + err = unpopulate(val, "DurationType", &r.DurationType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RetentionPolicy. +func (r RetentionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["retentionPolicyType"] = r.RetentionPolicyType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionPolicy. +func (r *RetentionPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "retentionPolicyType": + err = unpopulate(val, "RetentionPolicyType", &r.RetentionPolicyType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLBackupData. +func (s SQLBackupData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupPolicy", s.BackupPolicy) + objectMap["backupType"] = BackupTypeSQL + populate(objectMap, "recoveryServicesVault", s.RecoveryServicesVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLBackupData. +func (s *SQLBackupData) 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 "backupPolicy": + err = unpopulate(val, "BackupPolicy", &s.BackupPolicy) + delete(rawMsg, key) + case "backupType": + err = unpopulate(val, "BackupType", &s.BackupType) + delete(rawMsg, key) + case "recoveryServicesVault": + s.RecoveryServicesVault, err = unmarshalRecoveryServicesVaultPropertiesClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSLConfiguration. +func (s SSLConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sslCryptoProvider", s.SSLCryptoProvider) + populate(objectMap, "sslHostNameInCertificate", s.SSLHostNameInCertificate) + populate(objectMap, "sslKeyStore", s.SSLKeyStore) + populate(objectMap, "sslTrustStore", s.SSLTrustStore) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSLConfiguration. +func (s *SSLConfiguration) 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 "sslCryptoProvider": + err = unpopulate(val, "SSLCryptoProvider", &s.SSLCryptoProvider) + delete(rawMsg, key) + case "sslHostNameInCertificate": + err = unpopulate(val, "SSLHostNameInCertificate", &s.SSLHostNameInCertificate) + delete(rawMsg, key) + case "sslKeyStore": + err = unpopulate(val, "SSLKeyStore", &s.SSLKeyStore) + delete(rawMsg, key) + case "sslTrustStore": + err = unpopulate(val, "SSLTrustStore", &s.SSLTrustStore) + 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 SchedulePolicy. +func (s SchedulePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["schedulePolicyType"] = s.SchedulePolicyType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SchedulePolicy. +func (s *SchedulePolicy) 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 "schedulePolicyType": + err = unpopulate(val, "SchedulePolicyType", &s.SchedulePolicyType) + 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 Settings. +func (s Settings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isCompression", s.IsCompression) + populate(objectMap, "issqlcompression", s.Issqlcompression) + populate(objectMap, "timeZone", s.TimeZone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Settings. +func (s *Settings) 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 "isCompression": + err = unpopulate(val, "IsCompression", &s.IsCompression) + delete(rawMsg, key) + case "issqlcompression": + err = unpopulate(val, "Issqlcompression", &s.Issqlcompression) + 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 SimpleRetentionPolicy. +func (s SimpleRetentionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "retentionDuration", s.RetentionDuration) + objectMap["retentionPolicyType"] = "SimpleRetentionPolicy" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SimpleRetentionPolicy. +func (s *SimpleRetentionPolicy) 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 "retentionDuration": + err = unpopulate(val, "RetentionDuration", &s.RetentionDuration) + delete(rawMsg, key) + case "retentionPolicyType": + err = unpopulate(val, "RetentionPolicyType", &s.RetentionPolicyType) + 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 SimpleSchedulePolicy. +func (s SimpleSchedulePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hourlySchedule", s.HourlySchedule) + objectMap["schedulePolicyType"] = "SimpleSchedulePolicy" + populate(objectMap, "scheduleRunDays", s.ScheduleRunDays) + populate(objectMap, "scheduleRunFrequency", s.ScheduleRunFrequency) + aux := make([]*timeRFC3339, len(s.ScheduleRunTimes), len(s.ScheduleRunTimes)) + for i := 0; i < len(s.ScheduleRunTimes); i++ { + aux[i] = (*timeRFC3339)(s.ScheduleRunTimes[i]) + } + populate(objectMap, "scheduleRunTimes", aux) + populate(objectMap, "scheduleWeeklyFrequency", s.ScheduleWeeklyFrequency) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SimpleSchedulePolicy. +func (s *SimpleSchedulePolicy) 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 "hourlySchedule": + err = unpopulate(val, "HourlySchedule", &s.HourlySchedule) + delete(rawMsg, key) + case "schedulePolicyType": + err = unpopulate(val, "SchedulePolicyType", &s.SchedulePolicyType) + delete(rawMsg, key) + case "scheduleRunDays": + err = unpopulate(val, "ScheduleRunDays", &s.ScheduleRunDays) + delete(rawMsg, key) + case "scheduleRunFrequency": + err = unpopulate(val, "ScheduleRunFrequency", &s.ScheduleRunFrequency) + delete(rawMsg, key) + case "scheduleRunTimes": + var aux []*timeRFC3339 + err = unpopulate(val, "ScheduleRunTimes", &aux) + for _, au := range aux { + s.ScheduleRunTimes = append(s.ScheduleRunTimes, (*time.Time)(au)) + } + delete(rawMsg, key) + case "scheduleWeeklyFrequency": + err = unpopulate(val, "ScheduleWeeklyFrequency", &s.ScheduleWeeklyFrequency) + 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 SimpleSchedulePolicyV2. +func (s SimpleSchedulePolicyV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dailySchedule", s.DailySchedule) + populate(objectMap, "hourlySchedule", s.HourlySchedule) + objectMap["schedulePolicyType"] = "SimpleSchedulePolicyV2" + populate(objectMap, "scheduleRunFrequency", s.ScheduleRunFrequency) + populate(objectMap, "weeklySchedule", s.WeeklySchedule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SimpleSchedulePolicyV2. +func (s *SimpleSchedulePolicyV2) 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 "dailySchedule": + err = unpopulate(val, "DailySchedule", &s.DailySchedule) + delete(rawMsg, key) + case "hourlySchedule": + err = unpopulate(val, "HourlySchedule", &s.HourlySchedule) + delete(rawMsg, key) + case "schedulePolicyType": + err = unpopulate(val, "SchedulePolicyType", &s.SchedulePolicyType) + delete(rawMsg, key) + case "scheduleRunFrequency": + err = unpopulate(val, "ScheduleRunFrequency", &s.ScheduleRunFrequency) + delete(rawMsg, key) + case "weeklySchedule": + err = unpopulate(val, "WeeklySchedule", &s.WeeklySchedule) + 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 SnapshotBackupAdditionalDetails. +func (s SnapshotBackupAdditionalDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "instantRPDetails", s.InstantRPDetails) + populate(objectMap, "instantRpRetentionRangeInDays", s.InstantRpRetentionRangeInDays) + populate(objectMap, "userAssignedManagedIdentityDetails", s.UserAssignedManagedIdentityDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotBackupAdditionalDetails. +func (s *SnapshotBackupAdditionalDetails) 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 "instantRPDetails": + err = unpopulate(val, "InstantRPDetails", &s.InstantRPDetails) + delete(rawMsg, key) + case "instantRpRetentionRangeInDays": + err = unpopulate(val, "InstantRpRetentionRangeInDays", &s.InstantRpRetentionRangeInDays) + delete(rawMsg, key) + case "userAssignedManagedIdentityDetails": + err = unpopulate(val, "UserAssignedManagedIdentityDetails", &s.UserAssignedManagedIdentityDetails) + 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 SubProtectionPolicy. +func (s SubProtectionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "policyType", s.PolicyType) + populate(objectMap, "retentionPolicy", s.RetentionPolicy) + populate(objectMap, "schedulePolicy", s.SchedulePolicy) + populate(objectMap, "snapshotBackupAdditionalDetails", s.SnapshotBackupAdditionalDetails) + populate(objectMap, "tieringPolicy", s.TieringPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubProtectionPolicy. +func (s *SubProtectionPolicy) 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 "policyType": + err = unpopulate(val, "PolicyType", &s.PolicyType) + delete(rawMsg, key) + case "retentionPolicy": + s.RetentionPolicy, err = unmarshalRetentionPolicyClassification(val) + delete(rawMsg, key) + case "schedulePolicy": + s.SchedulePolicy, err = unmarshalSchedulePolicyClassification(val) + delete(rawMsg, key) + case "snapshotBackupAdditionalDetails": + err = unpopulate(val, "SnapshotBackupAdditionalDetails", &s.SnapshotBackupAdditionalDetails) + delete(rawMsg, key) + case "tieringPolicy": + err = unpopulate(val, "TieringPolicy", &s.TieringPolicy) + 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 TieringPolicy. +func (t TieringPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "duration", t.Duration) + populate(objectMap, "durationType", t.DurationType) + populate(objectMap, "tieringMode", t.TieringMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TieringPolicy. +func (t *TieringPolicy) 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 "duration": + err = unpopulate(val, "Duration", &t.Duration) + delete(rawMsg, key) + case "durationType": + err = unpopulate(val, "DurationType", &t.DurationType) + delete(rawMsg, key) + case "tieringMode": + err = unpopulate(val, "TieringMode", &t.TieringMode) + 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 UpdateACSSBackupConnectionRequest. +func (u UpdateACSSBackupConnectionRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", u.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateACSSBackupConnectionRequest. +func (u *UpdateACSSBackupConnectionRequest) 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 "tags": + err = unpopulate(val, "Tags", &u.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateConnectorRequest. +func (u UpdateConnectorRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", u.Identity) + populate(objectMap, "tags", u.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateConnectorRequest. +func (u *UpdateConnectorRequest) 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 "identity": + err = unpopulate(val, "Identity", &u.Identity) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &u.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) 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 "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentityProperties. +func (u UserAssignedIdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentityProperties. +func (u *UserAssignedIdentityProperties) 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 "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedManagedIdentityDetails. +func (u UserAssignedManagedIdentityDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identityArmId", u.IdentityArmID) + populate(objectMap, "identityName", u.IdentityName) + populate(objectMap, "userAssignedIdentityProperties", u.UserAssignedIdentityProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedManagedIdentityDetails. +func (u *UserAssignedManagedIdentityDetails) 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 "identityArmId": + err = unpopulate(val, "IdentityArmID", &u.IdentityArmID) + delete(rawMsg, key) + case "identityName": + err = unpopulate(val, "IdentityName", &u.IdentityName) + delete(rawMsg, key) + case "userAssignedIdentityProperties": + err = unpopulate(val, "UserAssignedIdentityProperties", &u.UserAssignedIdentityProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedServiceIdentity. +func (u UserAssignedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", u.Type) + populate(objectMap, "userAssignedIdentities", u.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedServiceIdentity. +func (u *UserAssignedServiceIdentity) 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 "type": + err = unpopulate(val, "Type", &u.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &u.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMBackupData. +func (v VMBackupData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupPolicy", v.BackupPolicy) + objectMap["backupType"] = BackupTypeVM + populate(objectMap, "diskExclusionProperties", v.DiskExclusionProperties) + populate(objectMap, "recoveryServicesVault", v.RecoveryServicesVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMBackupData. +func (v *VMBackupData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupPolicy": + err = unpopulate(val, "BackupPolicy", &v.BackupPolicy) + delete(rawMsg, key) + case "backupType": + err = unpopulate(val, "BackupType", &v.BackupType) + delete(rawMsg, key) + case "diskExclusionProperties": + err = unpopulate(val, "DiskExclusionProperties", &v.DiskExclusionProperties) + delete(rawMsg, key) + case "recoveryServicesVault": + v.RecoveryServicesVault, err = unmarshalRecoveryServicesVaultPropertiesClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMBackupPolicyProperties. +func (v VMBackupPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMBackupPolicyProperties. +func (v *VMBackupPolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WeeklyRetentionFormat. +func (w WeeklyRetentionFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "daysOfTheWeek", w.DaysOfTheWeek) + populate(objectMap, "weeksOfTheMonth", w.WeeksOfTheMonth) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WeeklyRetentionFormat. +func (w *WeeklyRetentionFormat) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "daysOfTheWeek": + err = unpopulate(val, "DaysOfTheWeek", &w.DaysOfTheWeek) + delete(rawMsg, key) + case "weeksOfTheMonth": + err = unpopulate(val, "WeeksOfTheMonth", &w.WeeksOfTheMonth) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WeeklyRetentionSchedule. +func (w WeeklyRetentionSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "daysOfTheWeek", w.DaysOfTheWeek) + populate(objectMap, "retentionDuration", w.RetentionDuration) + aux := make([]*timeRFC3339, len(w.RetentionTimes), len(w.RetentionTimes)) + for i := 0; i < len(w.RetentionTimes); i++ { + aux[i] = (*timeRFC3339)(w.RetentionTimes[i]) + } + populate(objectMap, "retentionTimes", aux) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WeeklyRetentionSchedule. +func (w *WeeklyRetentionSchedule) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "daysOfTheWeek": + err = unpopulate(val, "DaysOfTheWeek", &w.DaysOfTheWeek) + delete(rawMsg, key) + case "retentionDuration": + err = unpopulate(val, "RetentionDuration", &w.RetentionDuration) + delete(rawMsg, key) + case "retentionTimes": + var aux []*timeRFC3339 + err = unpopulate(val, "RetentionTimes", &aux) + for _, au := range aux { + w.RetentionTimes = append(w.RetentionTimes, (*time.Time)(au)) + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WeeklySchedule. +func (w WeeklySchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "scheduleRunDays", w.ScheduleRunDays) + aux := make([]*timeRFC3339, len(w.ScheduleRunTimes), len(w.ScheduleRunTimes)) + for i := 0; i < len(w.ScheduleRunTimes); i++ { + aux[i] = (*timeRFC3339)(w.ScheduleRunTimes[i]) + } + populate(objectMap, "scheduleRunTimes", aux) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WeeklySchedule. +func (w *WeeklySchedule) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "scheduleRunDays": + err = unpopulate(val, "ScheduleRunDays", &w.ScheduleRunDays) + delete(rawMsg, key) + case "scheduleRunTimes": + var aux []*timeRFC3339 + err = unpopulate(val, "ScheduleRunTimes", &aux) + for _, au := range aux { + w.ScheduleRunTimes = append(w.ScheduleRunTimes, (*time.Time)(au)) + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type YearlyRetentionSchedule. +func (y YearlyRetentionSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "monthsOfYear", y.MonthsOfYear) + populate(objectMap, "retentionDuration", y.RetentionDuration) + populate(objectMap, "retentionScheduleDaily", y.RetentionScheduleDaily) + populate(objectMap, "retentionScheduleFormatType", y.RetentionScheduleFormatType) + populate(objectMap, "retentionScheduleWeekly", y.RetentionScheduleWeekly) + aux := make([]*timeRFC3339, len(y.RetentionTimes), len(y.RetentionTimes)) + for i := 0; i < len(y.RetentionTimes); i++ { + aux[i] = (*timeRFC3339)(y.RetentionTimes[i]) + } + populate(objectMap, "retentionTimes", aux) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type YearlyRetentionSchedule. +func (y *YearlyRetentionSchedule) 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", y, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "monthsOfYear": + err = unpopulate(val, "MonthsOfYear", &y.MonthsOfYear) + delete(rawMsg, key) + case "retentionDuration": + err = unpopulate(val, "RetentionDuration", &y.RetentionDuration) + delete(rawMsg, key) + case "retentionScheduleDaily": + err = unpopulate(val, "RetentionScheduleDaily", &y.RetentionScheduleDaily) + delete(rawMsg, key) + case "retentionScheduleFormatType": + err = unpopulate(val, "RetentionScheduleFormatType", &y.RetentionScheduleFormatType) + delete(rawMsg, key) + case "retentionScheduleWeekly": + err = unpopulate(val, "RetentionScheduleWeekly", &y.RetentionScheduleWeekly) + delete(rawMsg, key) + case "retentionTimes": + var aux []*timeRFC3339 + err = unpopulate(val, "RetentionTimes", &aux) + for _, au := range aux { + y.RetentionTimes = append(y.RetentionTimes, (*time.Time)(au)) + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", y, 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/workloads/armconnector/operations_client.go b/sdk/resourcemanager/workloads/armconnector/operations_client.go new file mode 100644 index 000000000000..4e3be19ae493 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/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 armconnector + +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 - Lists all the available API operations under this PR +// +// Generated from API version 2023-10-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.Workloads/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-10-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/workloads/armconnector/options.go b/sdk/resourcemanager/workloads/armconnector/options.go new file mode 100644 index 000000000000..10d72e01ca2c --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/options.go @@ -0,0 +1,80 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armconnector + +// ACSSBackupConnectionsClientBeginCreateOptions contains the optional parameters for the ACSSBackupConnectionsClient.BeginCreate +// method. +type ACSSBackupConnectionsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ACSSBackupConnectionsClientBeginDeleteOptions contains the optional parameters for the ACSSBackupConnectionsClient.BeginDelete +// method. +type ACSSBackupConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ACSSBackupConnectionsClientBeginUpdateOptions contains the optional parameters for the ACSSBackupConnectionsClient.BeginUpdate +// method. +type ACSSBackupConnectionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ACSSBackupConnectionsClientGetOptions contains the optional parameters for the ACSSBackupConnectionsClient.Get method. +type ACSSBackupConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ACSSBackupConnectionsClientListOptions contains the optional parameters for the ACSSBackupConnectionsClient.NewListPager +// method. +type ACSSBackupConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// ConnectorsClientBeginCreateOptions contains the optional parameters for the ConnectorsClient.BeginCreate method. +type ConnectorsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectorsClientBeginDeleteOptions contains the optional parameters for the ConnectorsClient.BeginDelete method. +type ConnectorsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectorsClientGetOptions contains the optional parameters for the ConnectorsClient.Get method. +type ConnectorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectorsClientListByResourceGroupOptions contains the optional parameters for the ConnectorsClient.NewListByResourceGroupPager +// method. +type ConnectorsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ConnectorsClientListBySubscriptionOptions contains the optional parameters for the ConnectorsClient.NewListBySubscriptionPager +// method. +type ConnectorsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ConnectorsClientUpdateOptions contains the optional parameters for the ConnectorsClient.Update method. +type ConnectorsClientUpdateOptions 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/workloads/armconnector/polymorphic_helpers.go b/sdk/resourcemanager/workloads/armconnector/polymorphic_helpers.go new file mode 100644 index 000000000000..8e33d4114639 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/polymorphic_helpers.go @@ -0,0 +1,109 @@ +//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 armconnector + +import "encoding/json" + +func unmarshalBackupDataClassification(rawMsg json.RawMessage) (BackupDataClassification, 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 BackupDataClassification + switch m["backupType"] { + case string(BackupTypeHANA): + b = &HanaBackupData{} + case string(BackupTypeSQL): + b = &SQLBackupData{} + case string(BackupTypeVM): + b = &VMBackupData{} + default: + b = &BackupData{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalRecoveryServicesVaultPropertiesClassification(rawMsg json.RawMessage) (RecoveryServicesVaultPropertiesClassification, 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 RecoveryServicesVaultPropertiesClassification + switch m["vaultType"] { + case string(VaultTypeExisting): + b = &ExistingRecoveryServicesVault{} + case string(VaultTypeNew): + b = &NewRecoveryServicesVault{} + default: + b = &RecoveryServicesVaultProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalRetentionPolicyClassification(rawMsg json.RawMessage) (RetentionPolicyClassification, 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 RetentionPolicyClassification + switch m["retentionPolicyType"] { + case "LongTermRetentionPolicy": + b = &LongTermRetentionPolicy{} + case "SimpleRetentionPolicy": + b = &SimpleRetentionPolicy{} + default: + b = &RetentionPolicy{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalSchedulePolicyClassification(rawMsg json.RawMessage) (SchedulePolicyClassification, 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 SchedulePolicyClassification + switch m["schedulePolicyType"] { + case "LogSchedulePolicy": + b = &LogSchedulePolicy{} + case "LongTermSchedulePolicy": + b = &LongTermSchedulePolicy{} + case "SimpleSchedulePolicy": + b = &SimpleSchedulePolicy{} + case "SimpleSchedulePolicyV2": + b = &SimpleSchedulePolicyV2{} + default: + b = &SchedulePolicy{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/resourcemanager/workloads/armconnector/response_types.go b/sdk/resourcemanager/workloads/armconnector/response_types.go new file mode 100644 index 000000000000..1979456c0880 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/response_types.go @@ -0,0 +1,79 @@ +//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 armconnector + +// ACSSBackupConnectionsClientCreateResponse contains the response from method ACSSBackupConnectionsClient.BeginCreate. +type ACSSBackupConnectionsClientCreateResponse struct { + // Define the backup connection resource of virtual instance for SAP.. + ACSSBackupConnection +} + +// ACSSBackupConnectionsClientDeleteResponse contains the response from method ACSSBackupConnectionsClient.BeginDelete. +type ACSSBackupConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ACSSBackupConnectionsClientGetResponse contains the response from method ACSSBackupConnectionsClient.Get. +type ACSSBackupConnectionsClientGetResponse struct { + // Define the backup connection resource of virtual instance for SAP.. + ACSSBackupConnection +} + +// ACSSBackupConnectionsClientListResponse contains the response from method ACSSBackupConnectionsClient.NewListPager. +type ACSSBackupConnectionsClientListResponse struct { + // Defines the collection of backup connection resources of virtual instances for SAP. + ACSSBackupConnectionList +} + +// ACSSBackupConnectionsClientUpdateResponse contains the response from method ACSSBackupConnectionsClient.BeginUpdate. +type ACSSBackupConnectionsClientUpdateResponse struct { + // Define the backup connection resource of virtual instance for SAP.. + ACSSBackupConnection +} + +// ConnectorsClientCreateResponse contains the response from method ConnectorsClient.BeginCreate. +type ConnectorsClientCreateResponse struct { + // Define the connector resource. + Connector +} + +// ConnectorsClientDeleteResponse contains the response from method ConnectorsClient.BeginDelete. +type ConnectorsClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectorsClientGetResponse contains the response from method ConnectorsClient.Get. +type ConnectorsClientGetResponse struct { + // Define the connector resource. + Connector +} + +// ConnectorsClientListByResourceGroupResponse contains the response from method ConnectorsClient.NewListByResourceGroupPager. +type ConnectorsClientListByResourceGroupResponse struct { + // Defines the collection of connector resources. + List +} + +// ConnectorsClientListBySubscriptionResponse contains the response from method ConnectorsClient.NewListBySubscriptionPager. +type ConnectorsClientListBySubscriptionResponse struct { + // Defines the collection of connector resources. + List +} + +// ConnectorsClientUpdateResponse contains the response from method ConnectorsClient.Update. +type ConnectorsClientUpdateResponse struct { + // Define the connector resource. + Connector +} + +// 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/workloads/armconnector/time_rfc3339.go b/sdk/resourcemanager/workloads/armconnector/time_rfc3339.go new file mode 100644 index 000000000000..dfb5aa0de253 --- /dev/null +++ b/sdk/resourcemanager/workloads/armconnector/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 armconnector + +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 +}