From 234a09ec2faec9b788e46f0e1ef1789c476cab64 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sun, 15 May 2022 10:50:39 +0000 Subject: [PATCH] CodeGen from PR 18820 in Azure/azure-rest-api-specs AMS v2 public preview (#18820) * Adding monitors spec and examples Adding monitors spec and examples * All Monitors spec and examples All Monitors spec and examples * Delete commonTypes.json * Added new providers Added new providers * Updating with recent monitors spec changes in private repo Updating with recent monitors spec changes in private repo * Changes for Go sdk Changes for Go sdk * Update readme.md --- .../workloads/armworkloads/CHANGELOG.md | 5 + .../workloads/armworkloads/LICENSE.txt | 21 + .../workloads/armworkloads/README.md | 77 ++ .../workloads/armworkloads/autorest.md | 13 + .../workloads/armworkloads/build.go | 7 + .../workloads/armworkloads/ci.yml | 28 + .../workloads/armworkloads/go.mod | 11 + .../workloads/armworkloads/go.sum | 32 + .../armworkloads/zz_generated_constants.go | 144 ++++ .../armworkloads/zz_generated_models.go | 668 ++++++++++++++++++ .../armworkloads/zz_generated_models_serde.go | 634 +++++++++++++++++ .../zz_generated_monitors_client.go | 412 +++++++++++ .../zz_generated_operations_client.go | 103 +++ .../zz_generated_polymorphic_helpers.go | 39 + .../zz_generated_providerinstances_client.go | 320 +++++++++ .../zz_generated_response_types.go | 64 ++ .../armworkloads/zz_generated_time_rfc3339.go | 85 +++ 17 files changed, 2663 insertions(+) create mode 100644 sdk/resourcemanager/workloads/armworkloads/CHANGELOG.md create mode 100644 sdk/resourcemanager/workloads/armworkloads/LICENSE.txt create mode 100644 sdk/resourcemanager/workloads/armworkloads/README.md create mode 100644 sdk/resourcemanager/workloads/armworkloads/autorest.md create mode 100644 sdk/resourcemanager/workloads/armworkloads/build.go create mode 100644 sdk/resourcemanager/workloads/armworkloads/ci.yml create mode 100644 sdk/resourcemanager/workloads/armworkloads/go.mod create mode 100644 sdk/resourcemanager/workloads/armworkloads/go.sum create mode 100644 sdk/resourcemanager/workloads/armworkloads/zz_generated_constants.go create mode 100644 sdk/resourcemanager/workloads/armworkloads/zz_generated_models.go create mode 100644 sdk/resourcemanager/workloads/armworkloads/zz_generated_models_serde.go create mode 100644 sdk/resourcemanager/workloads/armworkloads/zz_generated_monitors_client.go create mode 100644 sdk/resourcemanager/workloads/armworkloads/zz_generated_operations_client.go create mode 100644 sdk/resourcemanager/workloads/armworkloads/zz_generated_polymorphic_helpers.go create mode 100644 sdk/resourcemanager/workloads/armworkloads/zz_generated_providerinstances_client.go create mode 100644 sdk/resourcemanager/workloads/armworkloads/zz_generated_response_types.go create mode 100644 sdk/resourcemanager/workloads/armworkloads/zz_generated_time_rfc3339.go diff --git a/sdk/resourcemanager/workloads/armworkloads/CHANGELOG.md b/sdk/resourcemanager/workloads/armworkloads/CHANGELOG.md new file mode 100644 index 000000000000..31a0699405fa --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (2022-05-15) + +- Init release. \ No newline at end of file diff --git a/sdk/resourcemanager/workloads/armworkloads/LICENSE.txt b/sdk/resourcemanager/workloads/armworkloads/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/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/armworkloads/README.md b/sdk/resourcemanager/workloads/armworkloads/README.md new file mode 100644 index 000000000000..c73285ec4b92 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/README.md @@ -0,0 +1,77 @@ +# Azure Workloads Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads) + +The `armworkloads` module provides operations for working with Azure Workloads. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/workloads/armworkloads) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above + +## 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/armworkloads +``` + +## 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). + +## Clients + +Azure Workloads modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. + +```go +client, err := armworkloads.NewMonitorsClient(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions{ + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +client, err := armworkloads.NewMonitorsClient(, cred, &options) +``` + +## 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/armworkloads/autorest.md b/sdk/resourcemanager/workloads/armworkloads/autorest.md new file mode 100644 index 000000000000..42ee166c517c --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/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/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/workloads/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/workloads/armworkloads/build.go b/sdk/resourcemanager/workloads/armworkloads/build.go new file mode 100644 index 000000000000..dc2754a84953 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/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.exe ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/workloads/armworkloads + +package armworkloads diff --git a/sdk/resourcemanager/workloads/armworkloads/ci.yml b/sdk/resourcemanager/workloads/armworkloads/ci.yml new file mode 100644 index 000000000000..630f244bad95 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/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/armworkloads/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/workloads/armworkloads/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/workloads/armworkloads' diff --git a/sdk/resourcemanager/workloads/armworkloads/go.mod b/sdk/resourcemanager/workloads/armworkloads/go.mod new file mode 100644 index 000000000000..7e35806be8e7 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + golang.org/x/net v0.0.0-20210610132358-84b48f89b13b // indirect + golang.org/x/text v0.3.6 // indirect +) diff --git a/sdk/resourcemanager/workloads/armworkloads/go.sum b/sdk/resourcemanager/workloads/armworkloads/go.sum new file mode 100644 index 000000000000..a7eaa30576c1 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/go.sum @@ -0,0 +1,32 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/workloads/armworkloads/zz_generated_constants.go b/sdk/resourcemanager/workloads/armworkloads/zz_generated_constants.go new file mode 100644 index 000000000000..6c615eebe398 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/zz_generated_constants.go @@ -0,0 +1,144 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armworkloads + +const ( + moduleName = "armworkloads" + 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, + } +} + +// 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, + } +} + +// OperationProperties - Defines the workload operation origin. +type OperationProperties string + +const ( + OperationPropertiesNotSpecified OperationProperties = "NotSpecified" + OperationPropertiesSystem OperationProperties = "System" + OperationPropertiesUser OperationProperties = "User" +) + +// PossibleOperationPropertiesValues returns the possible values for the OperationProperties const type. +func PossibleOperationPropertiesValues() []OperationProperties { + return []OperationProperties{ + OperationPropertiesNotSpecified, + OperationPropertiesSystem, + OperationPropertiesUser, + } +} + +// 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, + } +} + +// RoutingPreference - Sets the routing preference of the monitor. By default only RFC1918 traffic is routed to the customer +// VNET. +type RoutingPreference string + +const ( + RoutingPreferenceDefault RoutingPreference = "Default" + RoutingPreferenceRouteAll RoutingPreference = "RouteAll" +) + +// PossibleRoutingPreferenceValues returns the possible values for the RoutingPreference const type. +func PossibleRoutingPreferenceValues() []RoutingPreference { + return []RoutingPreference{ + RoutingPreferenceDefault, + RoutingPreferenceRouteAll, + } +} + +// WorkloadMonitorActionType - Defines the action type of workload operation. +type WorkloadMonitorActionType string + +const ( + WorkloadMonitorActionTypeInternal WorkloadMonitorActionType = "Internal" + WorkloadMonitorActionTypeNotSpecified WorkloadMonitorActionType = "NotSpecified" +) + +// PossibleWorkloadMonitorActionTypeValues returns the possible values for the WorkloadMonitorActionType const type. +func PossibleWorkloadMonitorActionTypeValues() []WorkloadMonitorActionType { + return []WorkloadMonitorActionType{ + WorkloadMonitorActionTypeInternal, + WorkloadMonitorActionTypeNotSpecified, + } +} + +// WorkloadMonitorProvisioningState - State of provisioning of the monitor. +type WorkloadMonitorProvisioningState string + +const ( + WorkloadMonitorProvisioningStateAccepted WorkloadMonitorProvisioningState = "Accepted" + WorkloadMonitorProvisioningStateCreating WorkloadMonitorProvisioningState = "Creating" + WorkloadMonitorProvisioningStateDeleting WorkloadMonitorProvisioningState = "Deleting" + WorkloadMonitorProvisioningStateFailed WorkloadMonitorProvisioningState = "Failed" + WorkloadMonitorProvisioningStateMigrating WorkloadMonitorProvisioningState = "Migrating" + WorkloadMonitorProvisioningStateSucceeded WorkloadMonitorProvisioningState = "Succeeded" + WorkloadMonitorProvisioningStateUpdating WorkloadMonitorProvisioningState = "Updating" +) + +// PossibleWorkloadMonitorProvisioningStateValues returns the possible values for the WorkloadMonitorProvisioningState const type. +func PossibleWorkloadMonitorProvisioningStateValues() []WorkloadMonitorProvisioningState { + return []WorkloadMonitorProvisioningState{ + WorkloadMonitorProvisioningStateAccepted, + WorkloadMonitorProvisioningStateCreating, + WorkloadMonitorProvisioningStateDeleting, + WorkloadMonitorProvisioningStateFailed, + WorkloadMonitorProvisioningStateMigrating, + WorkloadMonitorProvisioningStateSucceeded, + WorkloadMonitorProvisioningStateUpdating, + } +} diff --git a/sdk/resourcemanager/workloads/armworkloads/zz_generated_models.go b/sdk/resourcemanager/workloads/armworkloads/zz_generated_models.go new file mode 100644 index 000000000000..7920d6e9920c --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/zz_generated_models.go @@ -0,0 +1,668 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armworkloads + +import "time" + +// DB2ProviderInstanceProperties - Gets or sets the DB2 provider properties. +type DB2ProviderInstanceProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string `json:"providerType,omitempty"` + + // Gets or sets the db2 database name. + DbName *string `json:"dbName,omitempty"` + + // Gets or sets the db2 database password. + DbPassword *string `json:"dbPassword,omitempty"` + + // Gets or sets the key vault URI to secret with the database password. + DbPasswordURI *string `json:"dbPasswordUri,omitempty"` + + // Gets or sets the db2 database sql port. + DbPort *string `json:"dbPort,omitempty"` + + // Gets or sets the db2 database user name. + DbUsername *string `json:"dbUsername,omitempty"` + + // Gets or sets the target virtual machine name. + Hostname *string `json:"hostname,omitempty"` + + // Gets or sets the SAP System Identifier + SapSid *string `json:"sapSid,omitempty"` +} + +// Error - Standard error object. +type Error struct { + // READ-ONLY; Server-defined set of error codes. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; Array of details about specific errors that led to this reported error. + Details []*Error `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; Object containing more specific information than the current object about the error. + InnerError *ErrorInnerError `json:"innerError,omitempty" azure:"ro"` + + // READ-ONLY; Human-readable representation of the error. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; Target of the error. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty" azure:"ro"` + + // READ-ONLY; The additional info type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The error target. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// ErrorInnerError - Object containing more specific information than the current object about the error. +type ErrorInnerError struct { + // Standard error object. + InnerError *Error `json:"innerError,omitempty"` +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// HanaDbProviderInstanceProperties - Gets or sets the provider properties. +type HanaDbProviderInstanceProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string `json:"providerType,omitempty"` + + // Gets or sets the hana database name. + DbName *string `json:"dbName,omitempty"` + + // Gets or sets the database password. + DbPassword *string `json:"dbPassword,omitempty"` + + // Gets or sets the key vault URI to secret with the database password. + DbPasswordURI *string `json:"dbPasswordUri,omitempty"` + + // Gets or sets the blob URI to SSL certificate for the DB. + DbSSLCertificateURI *string `json:"dbSslCertificateUri,omitempty"` + + // Gets or sets the database user name. + DbUsername *string `json:"dbUsername,omitempty"` + + // Gets or sets the target virtual machine size. + Hostname *string `json:"hostname,omitempty"` + + // Gets or sets the database instance number. + InstanceNumber *string `json:"instanceNumber,omitempty"` + + // Gets or sets the database sql port. + SQLPort *string `json:"sqlPort,omitempty"` + + // Gets or sets the hostname(s) in the SSL certificate. + SSLHostNameInCertificate *string `json:"sslHostNameInCertificate,omitempty"` +} + +// ManagedRGConfiguration - Managed resource group configuration +type ManagedRGConfiguration struct { + // Managed resource group name + Name *string `json:"name,omitempty"` +} + +// Monitor - SAP monitor info on Azure (ARM properties and SAP monitor properties) +type Monitor struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // SAP monitor properties + Properties *MonitorProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MonitorListResult - The response from the List SAP monitors operation. +type MonitorListResult struct { + // The URL to get the next set of SAP monitors. + NextLink *string `json:"nextLink,omitempty"` + + // The list of SAP monitors. + Value []*Monitor `json:"value,omitempty"` +} + +// MonitorProperties - Describes the properties of a SAP monitor. +type MonitorProperties struct { + // The monitor resources will be deployed in the monitoring region. The subnet region should be same as the monitoring region. + AppLocation *string `json:"appLocation,omitempty"` + + // The ARM ID of the Log Analytics Workspace that is used for monitoring. + LogAnalyticsWorkspaceArmID *string `json:"logAnalyticsWorkspaceArmId,omitempty"` + + // Managed resource group configuration + ManagedResourceGroupConfiguration *ManagedRGConfiguration `json:"managedResourceGroupConfiguration,omitempty"` + + // The subnet which the SAP monitor will be deployed in + MonitorSubnet *string `json:"monitorSubnet,omitempty"` + + // Sets the routing preference of the monitor. By default only RFC1918 traffic is routed to the customer VNET. + RoutingPreference *RoutingPreference `json:"routingPreference,omitempty"` + + // READ-ONLY; Defines the SAP monitor errors. + Errors *MonitorPropertiesErrors `json:"errors,omitempty" azure:"ro"` + + // READ-ONLY; The ARM ID of the MSI used for monitoring. + MsiArmID *string `json:"msiArmId,omitempty" azure:"ro"` + + // READ-ONLY; State of provisioning of the monitor. + ProvisioningState *WorkloadMonitorProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// MonitorPropertiesErrors - Defines the SAP monitor errors. +type MonitorPropertiesErrors struct { + // READ-ONLY; Server-defined set of error codes. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; Array of details about specific errors that led to this reported error. + Details []*Error `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; Object containing more specific information than the current object about the error. + InnerError *ErrorInnerError `json:"innerError,omitempty" azure:"ro"` + + // READ-ONLY; Human-readable representation of the error. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; Target of the error. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// MonitorsClientBeginCreateOptions contains the optional parameters for the MonitorsClient.BeginCreate method. +type MonitorsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MonitorsClientBeginDeleteOptions contains the optional parameters for the MonitorsClient.BeginDelete method. +type MonitorsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MonitorsClientGetOptions contains the optional parameters for the MonitorsClient.Get method. +type MonitorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// MonitorsClientListByResourceGroupOptions contains the optional parameters for the MonitorsClient.ListByResourceGroup method. +type MonitorsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// MonitorsClientListOptions contains the optional parameters for the MonitorsClient.List method. +type MonitorsClientListOptions struct { + // placeholder for future optional parameters +} + +// MonitorsClientUpdateOptions contains the optional parameters for the MonitorsClient.Update method. +type MonitorsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// MsSQLServerProviderInstanceProperties - Gets or sets the SQL server provider properties. +type MsSQLServerProviderInstanceProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string `json:"providerType,omitempty"` + + // Gets or sets the database password. + DbPassword *string `json:"dbPassword,omitempty"` + + // Gets or sets the key vault URI to secret with the database password. + DbPasswordURI *string `json:"dbPasswordUri,omitempty"` + + // Gets or sets the database sql port. + DbPort *string `json:"dbPort,omitempty"` + + // Gets or sets the database user name. + DbUsername *string `json:"dbUsername,omitempty"` + + // Gets or sets the SQL server host name. + Hostname *string `json:"hostname,omitempty"` + + // Gets or sets the SAP System Identifier + SapSid *string `json:"sapSid,omitempty"` +} + +// 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 `json:"display,omitempty"` + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType `json:"actionType,omitempty" azure:"ro"` + + // 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 `json:"isDataAction,omitempty" azure:"ro"` + + // 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 `json:"name,omitempty" azure:"ro"` + + // 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 `json:"origin,omitempty" azure:"ro"` +} + +// 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 `json:"description,omitempty" azure:"ro"` + + // 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 `json:"operation,omitempty" azure:"ro"` + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string `json:"provider,omitempty" azure:"ro"` + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string `json:"resource,omitempty" azure:"ro"` +} + +// 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 `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation `json:"value,omitempty" azure:"ro"` +} + +// OperationStatusResult - The current status of an async operation. +type OperationStatusResult struct { + // REQUIRED; Operation status. + Status *string `json:"status,omitempty"` + + // The end time of the operation. + EndTime *time.Time `json:"endTime,omitempty"` + + // If present, details of the operation error. + Error *ErrorDetail `json:"error,omitempty"` + + // Fully qualified ID for the async operation. + ID *string `json:"id,omitempty"` + + // Name of the async operation. + Name *string `json:"name,omitempty"` + + // The operations list. + Operations []*OperationStatusResult `json:"operations,omitempty"` + + // Percent of the operation that is complete. + PercentComplete *float32 `json:"percentComplete,omitempty"` + + // The start time of the operation. + StartTime *time.Time `json:"startTime,omitempty"` +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsContent - Defines the workload operation content. +type OperationsContent struct { + // Operations content. + Properties *OperationsDefinition `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// OperationsDefinition - Properties of an Operation. +type OperationsDefinition struct { + // REQUIRED; Display information of the operation. + Display *OperationsDefinitionDisplay `json:"display,omitempty"` + + // REQUIRED; Name of the operation. + Name *string `json:"name,omitempty"` + + // Defines the action type of workload operation. + ActionType *WorkloadMonitorActionType `json:"actionType,omitempty"` + + // Indicates whether the operation applies to data-plane. + IsDataAction *bool `json:"isDataAction,omitempty"` + + // Defines the workload operation origin. + Origin *OperationProperties `json:"origin,omitempty"` + + // Defines the workload operation properties. + Properties interface{} `json:"properties,omitempty"` +} + +// OperationsDefinitionArrayResponseWithContinuation - Defines the workload operation definition response. +type OperationsDefinitionArrayResponseWithContinuation struct { + // The URL to get to the next set of results, if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // Defines the workload operation definition response properties. + Value []*OperationsDefinition `json:"value,omitempty"` +} + +// OperationsDefinitionDisplay - Display information of the operation. +type OperationsDefinitionDisplay struct { + // REQUIRED; Describes the workload operation. + Description *string `json:"description,omitempty"` + + // REQUIRED; Defines the workload operation. + Operation *string `json:"operation,omitempty"` + + // REQUIRED; Defines the workload provider. + Provider *string `json:"provider,omitempty"` + + // REQUIRED; Defines the workload resource. + Resource *string `json:"resource,omitempty"` +} + +// OperationsDisplayDefinition - Defines the workload operation. +type OperationsDisplayDefinition struct { + // REQUIRED; Describes the workload operation. + Description *string `json:"description,omitempty"` + + // REQUIRED; Defines the workload operation. + Operation *string `json:"operation,omitempty"` + + // REQUIRED; Defines the workload provider. + Provider *string `json:"provider,omitempty"` + + // REQUIRED; Defines the workload resource. + Resource *string `json:"resource,omitempty"` +} + +// PrometheusHaClusterProviderInstanceProperties - Gets or sets the PrometheusHaCluster provider properties. +type PrometheusHaClusterProviderInstanceProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string `json:"providerType,omitempty"` + + // Gets or sets the clusterName. + ClusterName *string `json:"clusterName,omitempty"` + + // Gets or sets the target machine name. + Hostname *string `json:"hostname,omitempty"` + + // URL of the Node Exporter endpoint. + PrometheusURL *string `json:"prometheusUrl,omitempty"` + + // Gets or sets the cluster sid. + Sid *string `json:"sid,omitempty"` +} + +// PrometheusOSProviderInstanceProperties - Gets or sets the PrometheusOS provider properties. +type PrometheusOSProviderInstanceProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string `json:"providerType,omitempty"` + + // URL of the Node Exporter endpoint + PrometheusURL *string `json:"prometheusUrl,omitempty"` +} + +// ProviderInstance - A provider instance associated with monitor. +type ProviderInstance struct { + // Provider Instance properties + Properties *ProviderInstanceProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ProviderInstanceListResult - The response from the List provider instances operation. +type ProviderInstanceListResult struct { + // The URL to get the next set of provider instances. + NextLink *string `json:"nextLink,omitempty"` + + // The list of provider instances. + Value []*ProviderInstance `json:"value,omitempty"` +} + +// ProviderInstanceProperties - Describes the properties of a provider instance. +type ProviderInstanceProperties struct { + // Defines the provider instance errors. + ProviderSettings ProviderSpecificPropertiesClassification `json:"providerSettings,omitempty"` + + // READ-ONLY; Defines the provider instance errors. + Errors *ProviderInstancePropertiesErrors `json:"errors,omitempty" azure:"ro"` + + // READ-ONLY; State of provisioning of the provider instance + ProvisioningState *WorkloadMonitorProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ProviderInstancePropertiesErrors - Defines the provider instance errors. +type ProviderInstancePropertiesErrors struct { + // READ-ONLY; Server-defined set of error codes. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; Array of details about specific errors that led to this reported error. + Details []*Error `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; Object containing more specific information than the current object about the error. + InnerError *ErrorInnerError `json:"innerError,omitempty" azure:"ro"` + + // READ-ONLY; Human-readable representation of the error. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; Target of the error. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// ProviderInstancesClientBeginCreateOptions contains the optional parameters for the ProviderInstancesClient.BeginCreate +// method. +type ProviderInstancesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProviderInstancesClientBeginDeleteOptions contains the optional parameters for the ProviderInstancesClient.BeginDelete +// method. +type ProviderInstancesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProviderInstancesClientGetOptions contains the optional parameters for the ProviderInstancesClient.Get method. +type ProviderInstancesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProviderInstancesClientListOptions contains the optional parameters for the ProviderInstancesClient.List method. +type ProviderInstancesClientListOptions struct { + // placeholder for future optional parameters +} + +// ProviderSpecificPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetProviderSpecificProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *DB2ProviderInstanceProperties, *HanaDbProviderInstanceProperties, *MsSQLServerProviderInstanceProperties, *PrometheusHaClusterProviderInstanceProperties, +// - *PrometheusOSProviderInstanceProperties, *ProviderSpecificProperties, *SapNetWeaverProviderInstanceProperties +type ProviderSpecificPropertiesClassification interface { + // GetProviderSpecificProperties returns the ProviderSpecificProperties content of the underlying type. + GetProviderSpecificProperties() *ProviderSpecificProperties +} + +// ProviderSpecificProperties - Gets or sets the provider specific properties. +type ProviderSpecificProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string `json:"providerType,omitempty"` +} + +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location +type ProxyResource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// SapNetWeaverProviderInstanceProperties - Gets or sets the provider properties. +type SapNetWeaverProviderInstanceProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string `json:"providerType,omitempty"` + + // Gets or sets the SAP Client ID. + SapClientID *string `json:"sapClientId,omitempty"` + + // Gets or sets the list of HostFile Entries + SapHostFileEntries []*string `json:"sapHostFileEntries,omitempty"` + + // Gets or sets the target virtual machine IP Address/FQDN. + SapHostname *string `json:"sapHostname,omitempty"` + + // Gets or sets the instance number of SAP NetWeaver. + SapInstanceNr *string `json:"sapInstanceNr,omitempty"` + + // Sets the SAP password. + SapPassword *string `json:"sapPassword,omitempty"` + + // Gets or sets the key vault URI to secret with the SAP password. + SapPasswordURI *string `json:"sapPasswordUri,omitempty"` + + // Gets or sets the SAP HTTP port number. + SapPortNumber *string `json:"sapPortNumber,omitempty"` + + // Gets or sets the blob URI to SSL certificate for the SAP system. + SapSSLCertificateURI *string `json:"sapSslCertificateUri,omitempty"` + + // Gets or sets the SAP System Identifier + SapSid *string `json:"sapSid,omitempty"` + + // Gets or sets the SAP user name. + SapUsername *string `json:"sapUsername,omitempty"` +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + +// Tags field of the resource. +type Tags struct { + // Tags field of the resource. + Tags map[string]*string `json:"tags,omitempty"` +} + +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' +// and a 'location' +type TrackedResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} diff --git a/sdk/resourcemanager/workloads/armworkloads/zz_generated_models_serde.go b/sdk/resourcemanager/workloads/armworkloads/zz_generated_models_serde.go new file mode 100644 index 000000000000..bb15e98af2c7 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/zz_generated_models_serde.go @@ -0,0 +1,634 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armworkloads + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type DB2ProviderInstanceProperties. +func (d *DB2ProviderInstanceProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return &ProviderSpecificProperties{ + ProviderType: d.ProviderType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type DB2ProviderInstanceProperties. +func (d DB2ProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dbName", d.DbName) + populate(objectMap, "dbPassword", d.DbPassword) + populate(objectMap, "dbPasswordUri", d.DbPasswordURI) + populate(objectMap, "dbPort", d.DbPort) + populate(objectMap, "dbUsername", d.DbUsername) + populate(objectMap, "hostname", d.Hostname) + objectMap["providerType"] = "Db2" + populate(objectMap, "sapSid", d.SapSid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DB2ProviderInstanceProperties. +func (d *DB2ProviderInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "dbName": + err = unpopulate(val, &d.DbName) + delete(rawMsg, key) + case "dbPassword": + err = unpopulate(val, &d.DbPassword) + delete(rawMsg, key) + case "dbPasswordUri": + err = unpopulate(val, &d.DbPasswordURI) + delete(rawMsg, key) + case "dbPort": + err = unpopulate(val, &d.DbPort) + delete(rawMsg, key) + case "dbUsername": + err = unpopulate(val, &d.DbUsername) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, &d.Hostname) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, &d.ProviderType) + delete(rawMsg, key) + case "sapSid": + err = unpopulate(val, &d.SapSid) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Error. +func (e Error) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "innerError", e.InnerError) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type HanaDbProviderInstanceProperties. +func (h *HanaDbProviderInstanceProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return &ProviderSpecificProperties{ + ProviderType: h.ProviderType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type HanaDbProviderInstanceProperties. +func (h HanaDbProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dbName", h.DbName) + populate(objectMap, "dbPassword", h.DbPassword) + populate(objectMap, "dbPasswordUri", h.DbPasswordURI) + populate(objectMap, "dbSslCertificateUri", h.DbSSLCertificateURI) + populate(objectMap, "dbUsername", h.DbUsername) + populate(objectMap, "hostname", h.Hostname) + populate(objectMap, "instanceNumber", h.InstanceNumber) + objectMap["providerType"] = "SapHana" + populate(objectMap, "sqlPort", h.SQLPort) + populate(objectMap, "sslHostNameInCertificate", h.SSLHostNameInCertificate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HanaDbProviderInstanceProperties. +func (h *HanaDbProviderInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "dbName": + err = unpopulate(val, &h.DbName) + delete(rawMsg, key) + case "dbPassword": + err = unpopulate(val, &h.DbPassword) + delete(rawMsg, key) + case "dbPasswordUri": + err = unpopulate(val, &h.DbPasswordURI) + delete(rawMsg, key) + case "dbSslCertificateUri": + err = unpopulate(val, &h.DbSSLCertificateURI) + delete(rawMsg, key) + case "dbUsername": + err = unpopulate(val, &h.DbUsername) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, &h.Hostname) + delete(rawMsg, key) + case "instanceNumber": + err = unpopulate(val, &h.InstanceNumber) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, &h.ProviderType) + delete(rawMsg, key) + case "sqlPort": + err = unpopulate(val, &h.SQLPort) + delete(rawMsg, key) + case "sslHostNameInCertificate": + err = unpopulate(val, &h.SSLHostNameInCertificate) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Monitor. +func (m Monitor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorListResult. +func (m MonitorListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorPropertiesErrors. +func (m MonitorPropertiesErrors) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", m.Code) + populate(objectMap, "details", m.Details) + populate(objectMap, "innerError", m.InnerError) + populate(objectMap, "message", m.Message) + populate(objectMap, "target", m.Target) + return json.Marshal(objectMap) +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type MsSQLServerProviderInstanceProperties. +func (m *MsSQLServerProviderInstanceProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return &ProviderSpecificProperties{ + ProviderType: m.ProviderType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type MsSQLServerProviderInstanceProperties. +func (m MsSQLServerProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dbPassword", m.DbPassword) + populate(objectMap, "dbPasswordUri", m.DbPasswordURI) + populate(objectMap, "dbPort", m.DbPort) + populate(objectMap, "dbUsername", m.DbUsername) + populate(objectMap, "hostname", m.Hostname) + objectMap["providerType"] = "MsSqlServer" + populate(objectMap, "sapSid", m.SapSid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MsSQLServerProviderInstanceProperties. +func (m *MsSQLServerProviderInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "dbPassword": + err = unpopulate(val, &m.DbPassword) + delete(rawMsg, key) + case "dbPasswordUri": + err = unpopulate(val, &m.DbPasswordURI) + delete(rawMsg, key) + case "dbPort": + err = unpopulate(val, &m.DbPort) + delete(rawMsg, key) + case "dbUsername": + err = unpopulate(val, &m.DbUsername) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, &m.Hostname) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, &m.ProviderType) + delete(rawMsg, key) + case "sapSid": + err = unpopulate(val, &m.SapSid) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type OperationStatusResult. +func (o OperationStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "operations", o.Operations) + populate(objectMap, "percentComplete", o.PercentComplete) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusResult. +func (o *OperationStatusResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &o.Name) + delete(rawMsg, key) + case "operations": + err = unpopulate(val, &o.Operations) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, &o.PercentComplete) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, &o.Status) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationsDefinitionArrayResponseWithContinuation. +func (o OperationsDefinitionArrayResponseWithContinuation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type PrometheusHaClusterProviderInstanceProperties. +func (p *PrometheusHaClusterProviderInstanceProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return &ProviderSpecificProperties{ + ProviderType: p.ProviderType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type PrometheusHaClusterProviderInstanceProperties. +func (p PrometheusHaClusterProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clusterName", p.ClusterName) + populate(objectMap, "hostname", p.Hostname) + populate(objectMap, "prometheusUrl", p.PrometheusURL) + objectMap["providerType"] = "PrometheusHaCluster" + populate(objectMap, "sid", p.Sid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusHaClusterProviderInstanceProperties. +func (p *PrometheusHaClusterProviderInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterName": + err = unpopulate(val, &p.ClusterName) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, &p.Hostname) + delete(rawMsg, key) + case "prometheusUrl": + err = unpopulate(val, &p.PrometheusURL) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, &p.ProviderType) + delete(rawMsg, key) + case "sid": + err = unpopulate(val, &p.Sid) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type PrometheusOSProviderInstanceProperties. +func (p *PrometheusOSProviderInstanceProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return &ProviderSpecificProperties{ + ProviderType: p.ProviderType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type PrometheusOSProviderInstanceProperties. +func (p PrometheusOSProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "prometheusUrl", p.PrometheusURL) + objectMap["providerType"] = "PrometheusOS" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusOSProviderInstanceProperties. +func (p *PrometheusOSProviderInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "prometheusUrl": + err = unpopulate(val, &p.PrometheusURL) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, &p.ProviderType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProviderInstanceListResult. +func (p ProviderInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ProviderInstanceProperties. +func (p ProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errors", p.Errors) + populate(objectMap, "providerSettings", p.ProviderSettings) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderInstanceProperties. +func (p *ProviderInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "errors": + err = unpopulate(val, &p.Errors) + delete(rawMsg, key) + case "providerSettings": + p.ProviderSettings, err = unmarshalProviderSpecificPropertiesClassification(val) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProviderInstancePropertiesErrors. +func (p ProviderInstancePropertiesErrors) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", p.Code) + populate(objectMap, "details", p.Details) + populate(objectMap, "innerError", p.InnerError) + populate(objectMap, "message", p.Message) + populate(objectMap, "target", p.Target) + return json.Marshal(objectMap) +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type ProviderSpecificProperties. +func (p *ProviderSpecificProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return p +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type SapNetWeaverProviderInstanceProperties. +func (s *SapNetWeaverProviderInstanceProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return &ProviderSpecificProperties{ + ProviderType: s.ProviderType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type SapNetWeaverProviderInstanceProperties. +func (s SapNetWeaverProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["providerType"] = "SapNetWeaver" + populate(objectMap, "sapClientId", s.SapClientID) + populate(objectMap, "sapHostFileEntries", s.SapHostFileEntries) + populate(objectMap, "sapHostname", s.SapHostname) + populate(objectMap, "sapInstanceNr", s.SapInstanceNr) + populate(objectMap, "sapPassword", s.SapPassword) + populate(objectMap, "sapPasswordUri", s.SapPasswordURI) + populate(objectMap, "sapPortNumber", s.SapPortNumber) + populate(objectMap, "sapSslCertificateUri", s.SapSSLCertificateURI) + populate(objectMap, "sapSid", s.SapSid) + populate(objectMap, "sapUsername", s.SapUsername) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SapNetWeaverProviderInstanceProperties. +func (s *SapNetWeaverProviderInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "providerType": + err = unpopulate(val, &s.ProviderType) + delete(rawMsg, key) + case "sapClientId": + err = unpopulate(val, &s.SapClientID) + delete(rawMsg, key) + case "sapHostFileEntries": + err = unpopulate(val, &s.SapHostFileEntries) + delete(rawMsg, key) + case "sapHostname": + err = unpopulate(val, &s.SapHostname) + delete(rawMsg, key) + case "sapInstanceNr": + err = unpopulate(val, &s.SapInstanceNr) + delete(rawMsg, key) + case "sapPassword": + err = unpopulate(val, &s.SapPassword) + delete(rawMsg, key) + case "sapPasswordUri": + err = unpopulate(val, &s.SapPasswordURI) + delete(rawMsg, key) + case "sapPortNumber": + err = unpopulate(val, &s.SapPortNumber) + delete(rawMsg, key) + case "sapSslCertificateUri": + err = unpopulate(val, &s.SapSSLCertificateURI) + delete(rawMsg, key) + case "sapSid": + err = unpopulate(val, &s.SapSid) + delete(rawMsg, key) + case "sapUsername": + err = unpopulate(val, &s.SapUsername) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Tags. +func (t Tags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + 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, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/workloads/armworkloads/zz_generated_monitors_client.go b/sdk/resourcemanager/workloads/armworkloads/zz_generated_monitors_client.go new file mode 100644 index 000000000000..1ce7be341c94 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/zz_generated_monitors_client.go @@ -0,0 +1,412 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armworkloads + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// MonitorsClient contains the methods for the Monitors group. +// Don't use this type directly, use NewMonitorsClient() instead. +type MonitorsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewMonitorsClient creates a new instance of MonitorsClient 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 NewMonitorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MonitorsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &MonitorsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreate - Creates a SAP monitor for the specified subscription, resource group, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// monitorName - Name of the SAP monitor resource. +// monitorParameter - Request body representing a SAP Monitor +// options - MonitorsClientBeginCreateOptions contains the optional parameters for the MonitorsClient.BeginCreate method. +func (client *MonitorsClient) BeginCreate(ctx context.Context, resourceGroupName string, monitorName string, monitorParameter Monitor, options *MonitorsClientBeginCreateOptions) (*armruntime.Poller[MonitorsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, monitorName, monitorParameter, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[MonitorsClientCreateResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[MonitorsClientCreateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Create - Creates a SAP monitor for the specified subscription, resource group, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *MonitorsClient) create(ctx context.Context, resourceGroupName string, monitorName string, monitorParameter Monitor, options *MonitorsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, monitorName, monitorParameter, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *MonitorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, monitorParameter Monitor, options *MonitorsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}" + 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 monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, monitorParameter) +} + +// BeginDelete - Deletes a SAP monitor with the specified subscription, resource group, and monitor name. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// monitorName - Name of the SAP monitor resource. +// options - MonitorsClientBeginDeleteOptions contains the optional parameters for the MonitorsClient.BeginDelete method. +func (client *MonitorsClient) BeginDelete(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientBeginDeleteOptions) (*armruntime.Poller[MonitorsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[MonitorsClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[MonitorsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a SAP monitor with the specified subscription, resource group, and monitor name. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *MonitorsClient) deleteOperation(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *MonitorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}" + 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 monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// Get - Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// monitorName - Name of the SAP monitor resource. +// options - MonitorsClientGetOptions contains the optional parameters for the MonitorsClient.Get method. +func (client *MonitorsClient) Get(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientGetOptions) (MonitorsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return MonitorsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MonitorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MonitorsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *MonitorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}" + 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 monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MonitorsClient) getHandleResponse(resp *http.Response) (MonitorsClientGetResponse, error) { + result := MonitorsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Monitor); err != nil { + return MonitorsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of SAP monitors in the specified subscription. The operations returns various properties of +// each SAP monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// options - MonitorsClientListOptions contains the optional parameters for the MonitorsClient.List method. +func (client *MonitorsClient) NewListPager(options *MonitorsClientListOptions) *runtime.Pager[MonitorsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[MonitorsClientListResponse]{ + More: func(page MonitorsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MonitorsClientListResponse) (MonitorsClientListResponse, 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 MonitorsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MonitorsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MonitorsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *MonitorsClient) listCreateRequest(ctx context.Context, options *MonitorsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/monitors" + 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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *MonitorsClient) listHandleResponse(resp *http.Response) (MonitorsClientListResponse, error) { + result := MonitorsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MonitorListResult); err != nil { + return MonitorsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets a list of SAP monitors in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// options - MonitorsClientListByResourceGroupOptions contains the optional parameters for the MonitorsClient.ListByResourceGroup +// method. +func (client *MonitorsClient) NewListByResourceGroupPager(resourceGroupName string, options *MonitorsClientListByResourceGroupOptions) *runtime.Pager[MonitorsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[MonitorsClientListByResourceGroupResponse]{ + More: func(page MonitorsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MonitorsClientListByResourceGroupResponse) (MonitorsClientListByResourceGroupResponse, 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 MonitorsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MonitorsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MonitorsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *MonitorsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *MonitorsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors" + 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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *MonitorsClient) listByResourceGroupHandleResponse(resp *http.Response) (MonitorsClientListByResourceGroupResponse, error) { + result := MonitorsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MonitorListResult); err != nil { + return MonitorsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// Update - Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// monitorName - Name of the SAP monitor resource. +// tagsParameter - Request body that only contains the new Tags field +// options - MonitorsClientUpdateOptions contains the optional parameters for the MonitorsClient.Update method. +func (client *MonitorsClient) Update(ctx context.Context, resourceGroupName string, monitorName string, tagsParameter Tags, options *MonitorsClientUpdateOptions) (MonitorsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, monitorName, tagsParameter, options) + if err != nil { + return MonitorsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MonitorsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MonitorsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *MonitorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, tagsParameter Tags, options *MonitorsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}" + 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 monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, tagsParameter) +} + +// updateHandleResponse handles the Update response. +func (client *MonitorsClient) updateHandleResponse(resp *http.Response) (MonitorsClientUpdateResponse, error) { + result := MonitorsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Monitor); err != nil { + return MonitorsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/workloads/armworkloads/zz_generated_operations_client.go b/sdk/resourcemanager/workloads/armworkloads/zz_generated_operations_client.go new file mode 100644 index 000000000000..6e7f84371642 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/zz_generated_operations_client.go @@ -0,0 +1,103 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armworkloads + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Lists all the available API operations under this PR +// If the operation fails it returns an *azcore.ResponseError type. +// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[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.pl.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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "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/armworkloads/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/workloads/armworkloads/zz_generated_polymorphic_helpers.go new file mode 100644 index 000000000000..bfaba1b63840 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/zz_generated_polymorphic_helpers.go @@ -0,0 +1,39 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armworkloads + +import "encoding/json" + +func unmarshalProviderSpecificPropertiesClassification(rawMsg json.RawMessage) (ProviderSpecificPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ProviderSpecificPropertiesClassification + switch m["providerType"] { + case "Db2": + b = &DB2ProviderInstanceProperties{} + case "MsSqlServer": + b = &MsSQLServerProviderInstanceProperties{} + case "PrometheusHaCluster": + b = &PrometheusHaClusterProviderInstanceProperties{} + case "PrometheusOS": + b = &PrometheusOSProviderInstanceProperties{} + case "SapHana": + b = &HanaDbProviderInstanceProperties{} + case "SapNetWeaver": + b = &SapNetWeaverProviderInstanceProperties{} + default: + b = &ProviderSpecificProperties{} + } + return b, json.Unmarshal(rawMsg, b) +} diff --git a/sdk/resourcemanager/workloads/armworkloads/zz_generated_providerinstances_client.go b/sdk/resourcemanager/workloads/armworkloads/zz_generated_providerinstances_client.go new file mode 100644 index 000000000000..23f9b08bf0b2 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/zz_generated_providerinstances_client.go @@ -0,0 +1,320 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armworkloads + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ProviderInstancesClient contains the methods for the ProviderInstances group. +// Don't use this type directly, use NewProviderInstancesClient() instead. +type ProviderInstancesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewProviderInstancesClient creates a new instance of ProviderInstancesClient 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 NewProviderInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProviderInstancesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ProviderInstancesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreate - Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// monitorName - Name of the SAP monitor resource. +// providerInstanceName - Name of the provider instance. +// providerInstanceParameter - Request body representing a provider instance +// options - ProviderInstancesClientBeginCreateOptions contains the optional parameters for the ProviderInstancesClient.BeginCreate +// method. +func (client *ProviderInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, providerInstanceParameter ProviderInstance, options *ProviderInstancesClientBeginCreateOptions) (*armruntime.Poller[ProviderInstancesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[ProviderInstancesClientCreateResponse]{ + FinalStateVia: armruntime.FinalStateViaAzureAsyncOp, + }) + } else { + return armruntime.NewPollerFromResumeToken[ProviderInstancesClientCreateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Create - Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ProviderInstancesClient) create(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, providerInstanceParameter ProviderInstance, options *ProviderInstancesClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *ProviderInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, providerInstanceParameter ProviderInstance, options *ProviderInstancesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}" + 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 monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + if providerInstanceName == "" { + return nil, errors.New("parameter providerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{providerInstanceName}", url.PathEscape(providerInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, providerInstanceParameter) +} + +// BeginDelete - Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// monitorName - Name of the SAP monitor resource. +// providerInstanceName - Name of the provider instance. +// options - ProviderInstancesClientBeginDeleteOptions contains the optional parameters for the ProviderInstancesClient.BeginDelete +// method. +func (client *ProviderInstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, options *ProviderInstancesClientBeginDeleteOptions) (*armruntime.Poller[ProviderInstancesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, monitorName, providerInstanceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ProviderInstancesClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ProviderInstancesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ProviderInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, options *ProviderInstancesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, monitorName, providerInstanceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ProviderInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, options *ProviderInstancesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}" + 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 monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + if providerInstanceName == "" { + return nil, errors.New("parameter providerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{providerInstanceName}", url.PathEscape(providerInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// Get - Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource +// name. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// monitorName - Name of the SAP monitor resource. +// providerInstanceName - Name of the provider instance. +// options - ProviderInstancesClientGetOptions contains the optional parameters for the ProviderInstancesClient.Get method. +func (client *ProviderInstancesClient) Get(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, options *ProviderInstancesClientGetOptions) (ProviderInstancesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, monitorName, providerInstanceName, options) + if err != nil { + return ProviderInstancesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProviderInstancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProviderInstancesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ProviderInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, options *ProviderInstancesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}" + 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 monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + if providerInstanceName == "" { + return nil, errors.New("parameter providerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{providerInstanceName}", url.PathEscape(providerInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProviderInstancesClient) getHandleResponse(resp *http.Response) (ProviderInstancesClientGetResponse, error) { + result := ProviderInstancesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProviderInstance); err != nil { + return ProviderInstancesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of provider instances in the specified SAP monitor. The operations returns various properties +// of each provider instances. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. The name is case insensitive. +// monitorName - Name of the SAP monitor resource. +// options - ProviderInstancesClientListOptions contains the optional parameters for the ProviderInstancesClient.List method. +func (client *ProviderInstancesClient) NewListPager(resourceGroupName string, monitorName string, options *ProviderInstancesClientListOptions) *runtime.Pager[ProviderInstancesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ProviderInstancesClientListResponse]{ + More: func(page ProviderInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProviderInstancesClientListResponse) (ProviderInstancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, monitorName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProviderInstancesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProviderInstancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProviderInstancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ProviderInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *ProviderInstancesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances" + 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 monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ProviderInstancesClient) listHandleResponse(resp *http.Response) (ProviderInstancesClientListResponse, error) { + result := ProviderInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProviderInstanceListResult); err != nil { + return ProviderInstancesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/workloads/armworkloads/zz_generated_response_types.go b/sdk/resourcemanager/workloads/armworkloads/zz_generated_response_types.go new file mode 100644 index 000000000000..a0a6b864c2e3 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/zz_generated_response_types.go @@ -0,0 +1,64 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armworkloads + +// MonitorsClientCreateResponse contains the response from method MonitorsClient.Create. +type MonitorsClientCreateResponse struct { + Monitor +} + +// MonitorsClientDeleteResponse contains the response from method MonitorsClient.Delete. +type MonitorsClientDeleteResponse struct { + OperationStatusResult +} + +// MonitorsClientGetResponse contains the response from method MonitorsClient.Get. +type MonitorsClientGetResponse struct { + Monitor +} + +// MonitorsClientListByResourceGroupResponse contains the response from method MonitorsClient.ListByResourceGroup. +type MonitorsClientListByResourceGroupResponse struct { + MonitorListResult +} + +// MonitorsClientListResponse contains the response from method MonitorsClient.List. +type MonitorsClientListResponse struct { + MonitorListResult +} + +// MonitorsClientUpdateResponse contains the response from method MonitorsClient.Update. +type MonitorsClientUpdateResponse struct { + Monitor +} + +// OperationsClientListResponse contains the response from method OperationsClient.List. +type OperationsClientListResponse struct { + OperationListResult +} + +// ProviderInstancesClientCreateResponse contains the response from method ProviderInstancesClient.Create. +type ProviderInstancesClientCreateResponse struct { + ProviderInstance +} + +// ProviderInstancesClientDeleteResponse contains the response from method ProviderInstancesClient.Delete. +type ProviderInstancesClientDeleteResponse struct { + OperationStatusResult +} + +// ProviderInstancesClientGetResponse contains the response from method ProviderInstancesClient.Get. +type ProviderInstancesClientGetResponse struct { + ProviderInstance +} + +// ProviderInstancesClientListResponse contains the response from method ProviderInstancesClient.List. +type ProviderInstancesClientListResponse struct { + ProviderInstanceListResult +} diff --git a/sdk/resourcemanager/workloads/armworkloads/zz_generated_time_rfc3339.go b/sdk/resourcemanager/workloads/armworkloads/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..ab0b1ec61a87 --- /dev/null +++ b/sdk/resourcemanager/workloads/armworkloads/zz_generated_time_rfc3339.go @@ -0,0 +1,85 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armworkloads + +import ( + "encoding/json" + "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]interface{}, 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, 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 err + } + *t = (*time.Time)(&aux) + return nil +}