From 84ce4474d2a8e473e2398551083338b586d4b92d Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 14 May 2024 08:41:26 +0000 Subject: [PATCH] CodeGen from PR 28980 in Azure/azure-rest-api-specs Merge e23546dc961836d2a87a6cb014aadcaa8648ed9b into e07876f350e66c07b7d914e432c8e7ac6e435222 --- .../armdevopsinfrastructure/CHANGELOG.md | 7 + .../armdevopsinfrastructure/LICENSE.txt | 21 + .../armdevopsinfrastructure/README.md | 92 + .../armdevopsinfrastructure/autorest.md | 13 + .../armdevopsinfrastructure/build.go | 7 + .../armdevopsinfrastructure/ci.yml | 28 + .../armdevopsinfrastructure/client_factory.go | 84 + .../armdevopsinfrastructure/constants.go | 354 ++ .../fake/imageversions_server.go | 112 + .../armdevopsinfrastructure/fake/internal.go | 64 + .../fake/operations_server.go | 96 + .../fake/pools_server.go | 353 ++ .../fake/resourcedetails_server.go | 112 + .../fake/server_factory.go | 106 + .../fake/sku_server.go | 108 + .../fake/subscriptionusages_server.go | 108 + .../fake/time_rfc3339.go | 110 + .../armdevopsinfrastructure/go.mod | 11 + .../armdevopsinfrastructure/go.sum | 12 + .../imageversions_client.go | 109 + .../armdevopsinfrastructure/interfaces.go | 63 + .../armdevopsinfrastructure/models.go | 828 +++ .../armdevopsinfrastructure/models_serde.go | 2034 +++++++ .../operations_client.go | 88 + .../armdevopsinfrastructure/options.go | 71 + .../polymorphic_helpers.go | 147 + .../armdevopsinfrastructure/pools_client.go | 460 ++ .../resourcedetails_client.go | 109 + .../armdevopsinfrastructure/responses.go | 74 + .../armdevopsinfrastructure/sku_client.go | 103 + .../subscriptionusages_client.go | 104 + .../armdevopsinfrastructure/time_rfc3339.go | 110 + .../armoracledatabase/CHANGELOG.md | 7 + .../armoracledatabase/LICENSE.txt | 21 + .../armoracledatabase/README.md | 92 + .../autonomousdatabasebackups_client.go | 433 ++ .../autonomousdatabasecharactersets_client.go | 169 + ...ousdatabasenationalcharactersets_client.go | 169 + .../autonomousdatabases_client.go | 693 +++ .../autonomousdatabaseversions_client.go | 169 + .../armoracledatabase/autorest.md | 13 + .../oracledatabase/armoracledatabase/build.go | 7 + .../oracledatabase/armoracledatabase/ci.yml | 28 + .../armoracledatabase/client_factory.go | 164 + .../cloudexadatainfrastructures_client.go | 540 ++ .../cloudvmclusters_client.go | 693 +++ .../armoracledatabase/constants.go | 1247 ++++ .../armoracledatabase/dbnodes_client.go | 263 + .../armoracledatabase/dbservers_client.go | 178 + .../dbsystemshapes_client.go | 168 + .../dnsprivateviews_client.go | 168 + .../dnsprivatezones_client.go | 168 + .../fake/autonomousdatabasebackups_server.go | 332 ++ .../autonomousdatabasecharactersets_server.go | 148 + ...ousdatabasenationalcharactersets_server.go | 148 + .../fake/autonomousdatabases_server.go | 508 ++ .../fake/autonomousdatabaseversions_server.go | 148 + .../cloudexadatainfrastructures_server.go | 405 ++ .../fake/cloudvmclusters_server.go | 508 ++ .../armoracledatabase/fake/dbnodes_server.go | 216 + .../fake/dbservers_server.go | 156 + .../fake/dbsystemshapes_server.go | 148 + .../fake/dnsprivateviews_server.go | 148 + .../fake/dnsprivatezones_server.go | 148 + .../fake/giversions_server.go | 148 + .../armoracledatabase/fake/internal.go | 64 + .../fake/operations_server.go | 96 + .../fake/oraclesubscriptions_server.go | 407 ++ .../armoracledatabase/fake/server_factory.go | 174 + .../armoracledatabase/fake/time_rfc3339.go | 110 + .../fake/virtualnetworkaddresses_server.go | 272 + .../armoracledatabase/giversions_client.go | 168 + .../oracledatabase/armoracledatabase/go.mod | 11 + .../oracledatabase/armoracledatabase/go.sum | 12 + .../armoracledatabase/interfaces.go | 18 + .../armoracledatabase/models.go | 2718 +++++++++ .../armoracledatabase/models_serde.go | 5059 +++++++++++++++++ .../armoracledatabase/operations_client.go | 88 + .../armoracledatabase/options.go | 392 ++ .../oraclesubscriptions_client.go | 563 ++ .../armoracledatabase/polymorphic_helpers.go | 34 + .../armoracledatabase/responses.go | 375 ++ .../armoracledatabase/time_rfc3339.go | 110 + .../virtualnetworkaddresses_client.go | 347 ++ 84 files changed, 25667 insertions(+) create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/LICENSE.txt create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/README.md create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/build.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/ci.yml create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/client_factory.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/internal.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/server_factory.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/time_rfc3339.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/CHANGELOG.md create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/LICENSE.txt create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/README.md create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/autorest.md create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/build.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/ci.yml create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/client_factory.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/constants.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasebackups_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasecharactersets_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasenationalcharactersets_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabases_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabaseversions_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudexadatainfrastructures_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudvmclusters_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbnodes_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbservers_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbsystemshapes_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivateviews_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivatezones_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/giversions_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/internal.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/operations_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/oraclesubscriptions_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/server_factory.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/virtualnetworkaddresses_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/go.mod create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/go.sum create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/interfaces.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/models.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/models_serde.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/options.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/polymorphic_helpers.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/responses.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/time_rfc3339.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client.go diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md new file mode 100644 index 000000000000..c8099604ad5f --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 0.1.0 (2024-05-14) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/LICENSE.txt b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/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/devopsinfrastructure/armdevopsinfrastructure/README.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/README.md new file mode 100644 index 000000000000..a03cf9dd7465 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/README.md @@ -0,0 +1,92 @@ +# Azure Devopsinfrastructure Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure) + +The `armdevopsinfrastructure` module provides operations for working with Azure Devopsinfrastructure. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Devopsinfrastructure module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Devopsinfrastructure. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Devopsinfrastructure module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armdevopsinfrastructure.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armdevopsinfrastructure.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewImageVersionsClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Devopsinfrastructure` 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/devopsinfrastructure/armdevopsinfrastructure/autorest.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md new file mode 100644 index 000000000000..bc03560f8749 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/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/devopsinfrastructure/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/devopsinfrastructure/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/devopsinfrastructure/armdevopsinfrastructure/build.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/build.go new file mode 100644 index 000000000000..22c30d6f8220 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/devopsinfrastructure/armdevopsinfrastructure + +package armdevopsinfrastructure diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/ci.yml b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/ci.yml new file mode 100644 index 000000000000..610051ccd9f4 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/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/devopsinfrastructure/armdevopsinfrastructure/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/devopsinfrastructure/armdevopsinfrastructure' diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/client_factory.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/client_factory.go new file mode 100644 index 000000000000..09bab6db20b0 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/client_factory.go @@ -0,0 +1,84 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewImageVersionsClient creates a new instance of ImageVersionsClient. +func (c *ClientFactory) NewImageVersionsClient() *ImageVersionsClient { + return &ImageVersionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewPoolsClient creates a new instance of PoolsClient. +func (c *ClientFactory) NewPoolsClient() *PoolsClient { + return &PoolsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewResourceDetailsClient creates a new instance of ResourceDetailsClient. +func (c *ClientFactory) NewResourceDetailsClient() *ResourceDetailsClient { + return &ResourceDetailsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewSKUClient creates a new instance of SKUClient. +func (c *ClientFactory) NewSKUClient() *SKUClient { + return &SKUClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewSubscriptionUsagesClient creates a new instance of SubscriptionUsagesClient. +func (c *ClientFactory) NewSubscriptionUsagesClient() *SubscriptionUsagesClient { + return &SubscriptionUsagesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go new file mode 100644 index 000000000000..b1d46e06ae30 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go @@ -0,0 +1,354 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + 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, + } +} + +// AzureDevOpsPermissionType - Determines who has admin permissions to the Azure DevOps pool. +type AzureDevOpsPermissionType string + +const ( + // AzureDevOpsPermissionTypeCreatorOnly - Only the pool creator will be an admin of the pool. + AzureDevOpsPermissionTypeCreatorOnly AzureDevOpsPermissionType = "CreatorOnly" + // AzureDevOpsPermissionTypeInherit - Pool will inherit permissions from the project or organization. + AzureDevOpsPermissionTypeInherit AzureDevOpsPermissionType = "Inherit" + // AzureDevOpsPermissionTypeSpecificAccounts - Only the specified accounts will be admins of the pool. + AzureDevOpsPermissionTypeSpecificAccounts AzureDevOpsPermissionType = "SpecificAccounts" +) + +// PossibleAzureDevOpsPermissionTypeValues returns the possible values for the AzureDevOpsPermissionType const type. +func PossibleAzureDevOpsPermissionTypeValues() []AzureDevOpsPermissionType { + return []AzureDevOpsPermissionType{ + AzureDevOpsPermissionTypeCreatorOnly, + AzureDevOpsPermissionTypeInherit, + AzureDevOpsPermissionTypeSpecificAccounts, + } +} + +// CachingType - The type of caching in a data disk. +type CachingType string + +const ( + // CachingTypeNone - Don't use host caching. + CachingTypeNone CachingType = "None" + // CachingTypeReadOnly - For workloads that only do read operations. + CachingTypeReadOnly CachingType = "ReadOnly" + // CachingTypeReadWrite - For workloads that do a balance of read and write operations. + CachingTypeReadWrite CachingType = "ReadWrite" +) + +// PossibleCachingTypeValues returns the possible values for the CachingType const type. +func PossibleCachingTypeValues() []CachingType { + return []CachingType{ + CachingTypeNone, + CachingTypeReadOnly, + CachingTypeReadWrite, + } +} + +// 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, + } +} + +// LogonType - Determines how the service should be run. +type LogonType string + +const ( + // LogonTypeInteractive - Run in interactive mode. + LogonTypeInteractive LogonType = "Interactive" + // LogonTypeService - Run as a service. + LogonTypeService LogonType = "Service" +) + +// PossibleLogonTypeValues returns the possible values for the LogonType const type. +func PossibleLogonTypeValues() []LogonType { + return []LogonType{ + LogonTypeInteractive, + LogonTypeService, + } +} + +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + +// 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, + } +} + +// OsDiskStorageAccountType - The storage account type of the OS disk. +type OsDiskStorageAccountType string + +const ( + // OsDiskStorageAccountTypePremium - Premium OS disk type. + OsDiskStorageAccountTypePremium OsDiskStorageAccountType = "Premium" + // OsDiskStorageAccountTypeStandard - Standard OS disk type. + OsDiskStorageAccountTypeStandard OsDiskStorageAccountType = "Standard" + // OsDiskStorageAccountTypeStandardSSD - Standard SSD OS disk type. + OsDiskStorageAccountTypeStandardSSD OsDiskStorageAccountType = "StandardSSD" +) + +// PossibleOsDiskStorageAccountTypeValues returns the possible values for the OsDiskStorageAccountType const type. +func PossibleOsDiskStorageAccountTypeValues() []OsDiskStorageAccountType { + return []OsDiskStorageAccountType{ + OsDiskStorageAccountTypePremium, + OsDiskStorageAccountTypeStandard, + OsDiskStorageAccountTypeStandardSSD, + } +} + +// PredictionPreference - Determines the balance between cost and performance. +type PredictionPreference string + +const ( + // PredictionPreferenceBalanced - Balance between cost and performance. + PredictionPreferenceBalanced PredictionPreference = "Balanced" + // PredictionPreferenceBestPerformance - Optimizes for performance over cost. + PredictionPreferenceBestPerformance PredictionPreference = "BestPerformance" + // PredictionPreferenceMoreCostEffective - Halfway through cost and balanced. + PredictionPreferenceMoreCostEffective PredictionPreference = "MoreCostEffective" + // PredictionPreferenceMorePerformance - Halfway through balanced and performance. + PredictionPreferenceMorePerformance PredictionPreference = "MorePerformance" + // PredictionPreferenceMostCostEffective - Optimizes for cost over performance. + PredictionPreferenceMostCostEffective PredictionPreference = "MostCostEffective" +) + +// PossiblePredictionPreferenceValues returns the possible values for the PredictionPreference const type. +func PossiblePredictionPreferenceValues() []PredictionPreference { + return []PredictionPreference{ + PredictionPreferenceBalanced, + PredictionPreferenceBestPerformance, + PredictionPreferenceMoreCostEffective, + PredictionPreferenceMorePerformance, + PredictionPreferenceMostCostEffective, + } +} + +// ProvisioningState - The status of the current operation. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - Represents an accepted operation. + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Represents a canceled operation. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - Represents an operation under deletion. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Represents a failed operation. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - Represents a pending operation. + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Represents a succeeded operation. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - Represents a pending operation. + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// ResourcePredictionsProfileType - Determines how the stand-by scheme should be provided. +type ResourcePredictionsProfileType string + +const ( + // ResourcePredictionsProfileTypeAutomatic - The stand-by agent scheme is determined based on historical demand. + ResourcePredictionsProfileTypeAutomatic ResourcePredictionsProfileType = "Automatic" + // ResourcePredictionsProfileTypeManual - Customer provides the stand-by agent scheme. + ResourcePredictionsProfileTypeManual ResourcePredictionsProfileType = "Manual" +) + +// PossibleResourcePredictionsProfileTypeValues returns the possible values for the ResourcePredictionsProfileType const type. +func PossibleResourcePredictionsProfileTypeValues() []ResourcePredictionsProfileType { + return []ResourcePredictionsProfileType{ + ResourcePredictionsProfileTypeAutomatic, + ResourcePredictionsProfileTypeManual, + } +} + +// ResourceSKURestrictionsReasonCode - Describes the reason for SKU restriction. +type ResourceSKURestrictionsReasonCode string + +const ( + // ResourceSKURestrictionsReasonCodeNotAvailableForSubscription - The restriction is not available for this subscription. + ResourceSKURestrictionsReasonCodeNotAvailableForSubscription ResourceSKURestrictionsReasonCode = "NotAvailableForSubscription" + // ResourceSKURestrictionsReasonCodeQuotaID - The restriction is due to exceeding a quota limitation. + ResourceSKURestrictionsReasonCodeQuotaID ResourceSKURestrictionsReasonCode = "QuotaId" +) + +// PossibleResourceSKURestrictionsReasonCodeValues returns the possible values for the ResourceSKURestrictionsReasonCode const type. +func PossibleResourceSKURestrictionsReasonCodeValues() []ResourceSKURestrictionsReasonCode { + return []ResourceSKURestrictionsReasonCode{ + ResourceSKURestrictionsReasonCodeNotAvailableForSubscription, + ResourceSKURestrictionsReasonCodeQuotaID, + } +} + +// ResourceSKURestrictionsType - Describes the kind of SKU restrictions that can exist +type ResourceSKURestrictionsType string + +const ( + // ResourceSKURestrictionsTypeLocation - SKU restricted by location. + ResourceSKURestrictionsTypeLocation ResourceSKURestrictionsType = "Location" + // ResourceSKURestrictionsTypeZone - SKU restricted by availability zone. + ResourceSKURestrictionsTypeZone ResourceSKURestrictionsType = "Zone" +) + +// PossibleResourceSKURestrictionsTypeValues returns the possible values for the ResourceSKURestrictionsType const type. +func PossibleResourceSKURestrictionsTypeValues() []ResourceSKURestrictionsType { + return []ResourceSKURestrictionsType{ + ResourceSKURestrictionsTypeLocation, + ResourceSKURestrictionsTypeZone, + } +} + +// ResourceStatus - The status of the machine resource. +type ResourceStatus string + +const ( + // ResourceStatusAllocated - Represents a machine resource that is allocated. + ResourceStatusAllocated ResourceStatus = "Allocated" + // ResourceStatusLeased - Represents a machine resource that is leased. + ResourceStatusLeased ResourceStatus = "Leased" + // ResourceStatusNotReady - Represents a machine resource that is not ready. + ResourceStatusNotReady ResourceStatus = "NotReady" + // ResourceStatusPendingReimage - Represents a machine resource that is pending reimage. + ResourceStatusPendingReimage ResourceStatus = "PendingReimage" + // ResourceStatusPendingReturn - Represents a machine resource that is pending return. + ResourceStatusPendingReturn ResourceStatus = "PendingReturn" + // ResourceStatusProvisioning - Represents a machine resource that is provisioning. + ResourceStatusProvisioning ResourceStatus = "Provisioning" + // ResourceStatusReady - Represents a machine resource that is ready. + ResourceStatusReady ResourceStatus = "Ready" + // ResourceStatusReimaging - Represents a machine resource that is reimaging. + ResourceStatusReimaging ResourceStatus = "Reimaging" + // ResourceStatusReturned - Represents a machine resource that is returned. + ResourceStatusReturned ResourceStatus = "Returned" + // ResourceStatusStarting - Represents a machine resource that is starting. + ResourceStatusStarting ResourceStatus = "Starting" + // ResourceStatusUpdating - Represents a machine resource that is updating. + ResourceStatusUpdating ResourceStatus = "Updating" +) + +// PossibleResourceStatusValues returns the possible values for the ResourceStatus const type. +func PossibleResourceStatusValues() []ResourceStatus { + return []ResourceStatus{ + ResourceStatusAllocated, + ResourceStatusLeased, + ResourceStatusNotReady, + ResourceStatusPendingReimage, + ResourceStatusPendingReturn, + ResourceStatusProvisioning, + ResourceStatusReady, + ResourceStatusReimaging, + ResourceStatusReturned, + ResourceStatusStarting, + ResourceStatusUpdating, + } +} + +// StorageAccountType - StorageAccountType enums +type StorageAccountType string + +const ( + // StorageAccountTypePremiumLRS - The data disk should use premium locally redundant storage. + StorageAccountTypePremiumLRS StorageAccountType = "Premium_LRS" + // StorageAccountTypePremiumZRS - The data disk should use premium SSD zonal redundant storage. + StorageAccountTypePremiumZRS StorageAccountType = "Premium_ZRS" + // StorageAccountTypeStandardLRS - The data disk should use standard locally redundant storage. + StorageAccountTypeStandardLRS StorageAccountType = "Standard_LRS" + // StorageAccountTypeStandardSSDLRS - The data disk should use standard SSD locally redundant storage. + StorageAccountTypeStandardSSDLRS StorageAccountType = "StandardSSD_LRS" + // StorageAccountTypeStandardSSDZRS - The data disk should use standard SSD zonal redundant storage. + StorageAccountTypeStandardSSDZRS StorageAccountType = "StandardSSD_ZRS" +) + +// PossibleStorageAccountTypeValues returns the possible values for the StorageAccountType const type. +func PossibleStorageAccountTypeValues() []StorageAccountType { + return []StorageAccountType{ + StorageAccountTypePremiumLRS, + StorageAccountTypePremiumZRS, + StorageAccountTypeStandardLRS, + StorageAccountTypeStandardSSDLRS, + StorageAccountTypeStandardSSDZRS, + } +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go new file mode 100644 index 000000000000..d9ec0b40e596 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go @@ -0,0 +1,112 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "net/http" + "net/url" + "regexp" +) + +// ImageVersionsServer is a fake server for instances of the armdevopsinfrastructure.ImageVersionsClient type. +type ImageVersionsServer struct { + // NewListByImagePager is the fake for method ImageVersionsClient.NewListByImagePager + // HTTP status codes to indicate success: http.StatusOK + NewListByImagePager func(resourceGroupName string, imageName string, options *armdevopsinfrastructure.ImageVersionsClientListByImageOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.ImageVersionsClientListByImageResponse]) +} + +// NewImageVersionsServerTransport creates a new instance of ImageVersionsServerTransport with the provided implementation. +// The returned ImageVersionsServerTransport instance is connected to an instance of armdevopsinfrastructure.ImageVersionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewImageVersionsServerTransport(srv *ImageVersionsServer) *ImageVersionsServerTransport { + return &ImageVersionsServerTransport{ + srv: srv, + newListByImagePager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.ImageVersionsClientListByImageResponse]](), + } +} + +// ImageVersionsServerTransport connects instances of armdevopsinfrastructure.ImageVersionsClient to instances of ImageVersionsServer. +// Don't use this type directly, use NewImageVersionsServerTransport instead. +type ImageVersionsServerTransport struct { + srv *ImageVersionsServer + newListByImagePager *tracker[azfake.PagerResponder[armdevopsinfrastructure.ImageVersionsClientListByImageResponse]] +} + +// Do implements the policy.Transporter interface for ImageVersionsServerTransport. +func (i *ImageVersionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ImageVersionsClient.NewListByImagePager": + resp, err = i.dispatchNewListByImagePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (i *ImageVersionsServerTransport) dispatchNewListByImagePager(req *http.Request) (*http.Response, error) { + if i.srv.NewListByImagePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByImagePager not implemented")} + } + newListByImagePager := i.newListByImagePager.get(req) + if newListByImagePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/images/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/versions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + imageNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("imageName")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListByImagePager(resourceGroupNameParam, imageNameParam, nil) + newListByImagePager = &resp + i.newListByImagePager.add(req, newListByImagePager) + server.PagerResponderInjectNextLinks(newListByImagePager, req, func(page *armdevopsinfrastructure.ImageVersionsClientListByImageResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByImagePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListByImagePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByImagePager) { + i.newListByImagePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/internal.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/internal.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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go new file mode 100644 index 000000000000..15823a3f8cc4 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "net/http" +) + +// OperationsServer is a fake server for instances of the armdevopsinfrastructure.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armdevopsinfrastructure.OperationsClientListOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armdevopsinfrastructure.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armdevopsinfrastructure.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.NewListPager": + resp, err = o.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdevopsinfrastructure.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go new file mode 100644 index 000000000000..9df8c0a1cbea --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go @@ -0,0 +1,353 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "net/http" + "net/url" + "regexp" +) + +// PoolsServer is a fake server for instances of the armdevopsinfrastructure.PoolsClient type. +type PoolsServer struct { + // BeginCreateOrUpdate is the fake for method PoolsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, poolName string, resource armdevopsinfrastructure.Pool, options *armdevopsinfrastructure.PoolsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdevopsinfrastructure.PoolsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PoolsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, poolName string, options *armdevopsinfrastructure.PoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdevopsinfrastructure.PoolsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PoolsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, poolName string, options *armdevopsinfrastructure.PoolsClientGetOptions) (resp azfake.Responder[armdevopsinfrastructure.PoolsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method PoolsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armdevopsinfrastructure.PoolsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.PoolsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method PoolsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armdevopsinfrastructure.PoolsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.PoolsClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method PoolsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, poolName string, properties armdevopsinfrastructure.PoolUpdate, options *armdevopsinfrastructure.PoolsClientBeginUpdateOptions) (resp azfake.PollerResponder[armdevopsinfrastructure.PoolsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPoolsServerTransport creates a new instance of PoolsServerTransport with the provided implementation. +// The returned PoolsServerTransport instance is connected to an instance of armdevopsinfrastructure.PoolsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPoolsServerTransport(srv *PoolsServer) *PoolsServerTransport { + return &PoolsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdevopsinfrastructure.PoolsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdevopsinfrastructure.PoolsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.PoolsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.PoolsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdevopsinfrastructure.PoolsClientUpdateResponse]](), + } +} + +// PoolsServerTransport connects instances of armdevopsinfrastructure.PoolsClient to instances of PoolsServer. +// Don't use this type directly, use NewPoolsServerTransport instead. +type PoolsServerTransport struct { + srv *PoolsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdevopsinfrastructure.PoolsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdevopsinfrastructure.PoolsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.PoolsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.PoolsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdevopsinfrastructure.PoolsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for PoolsServerTransport. +func (p *PoolsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PoolsClient.BeginCreateOrUpdate": + resp, err = p.dispatchBeginCreateOrUpdate(req) + case "PoolsClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "PoolsClient.Get": + resp, err = p.dispatchGet(req) + case "PoolsClient.NewListByResourceGroupPager": + resp, err = p.dispatchNewListByResourceGroupPager(req) + case "PoolsClient.NewListBySubscriptionPager": + resp, err = p.dispatchNewListBySubscriptionPager(req) + case "PoolsClient.BeginUpdate": + resp, err = p.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PoolsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdevopsinfrastructure.Pool](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, poolNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *PoolsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, poolNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PoolsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, poolNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Pool, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PoolsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := p.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + p.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armdevopsinfrastructure.PoolsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + p.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (p *PoolsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := p.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := p.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + p.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armdevopsinfrastructure.PoolsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + p.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (p *PoolsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdevopsinfrastructure.PoolUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, poolNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + p.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + p.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go new file mode 100644 index 000000000000..644027e03be0 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go @@ -0,0 +1,112 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "net/http" + "net/url" + "regexp" +) + +// ResourceDetailsServer is a fake server for instances of the armdevopsinfrastructure.ResourceDetailsClient type. +type ResourceDetailsServer struct { + // NewListByPoolPager is the fake for method ResourceDetailsClient.NewListByPoolPager + // HTTP status codes to indicate success: http.StatusOK + NewListByPoolPager func(resourceGroupName string, poolName string, options *armdevopsinfrastructure.ResourceDetailsClientListByPoolOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.ResourceDetailsClientListByPoolResponse]) +} + +// NewResourceDetailsServerTransport creates a new instance of ResourceDetailsServerTransport with the provided implementation. +// The returned ResourceDetailsServerTransport instance is connected to an instance of armdevopsinfrastructure.ResourceDetailsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewResourceDetailsServerTransport(srv *ResourceDetailsServer) *ResourceDetailsServerTransport { + return &ResourceDetailsServerTransport{ + srv: srv, + newListByPoolPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.ResourceDetailsClientListByPoolResponse]](), + } +} + +// ResourceDetailsServerTransport connects instances of armdevopsinfrastructure.ResourceDetailsClient to instances of ResourceDetailsServer. +// Don't use this type directly, use NewResourceDetailsServerTransport instead. +type ResourceDetailsServerTransport struct { + srv *ResourceDetailsServer + newListByPoolPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.ResourceDetailsClientListByPoolResponse]] +} + +// Do implements the policy.Transporter interface for ResourceDetailsServerTransport. +func (r *ResourceDetailsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ResourceDetailsClient.NewListByPoolPager": + resp, err = r.dispatchNewListByPoolPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (r *ResourceDetailsServerTransport) dispatchNewListByPoolPager(req *http.Request) (*http.Response, error) { + if r.srv.NewListByPoolPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByPoolPager not implemented")} + } + newListByPoolPager := r.newListByPoolPager.get(req) + if newListByPoolPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resources` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + resp := r.srv.NewListByPoolPager(resourceGroupNameParam, poolNameParam, nil) + newListByPoolPager = &resp + r.newListByPoolPager.add(req, newListByPoolPager) + server.PagerResponderInjectNextLinks(newListByPoolPager, req, func(page *armdevopsinfrastructure.ResourceDetailsClientListByPoolResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByPoolPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListByPoolPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByPoolPager) { + r.newListByPoolPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/server_factory.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/server_factory.go new file mode 100644 index 000000000000..e8dc200ba92c --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/server_factory.go @@ -0,0 +1,106 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armdevopsinfrastructure.ClientFactory type. +type ServerFactory struct { + ImageVersionsServer ImageVersionsServer + OperationsServer OperationsServer + PoolsServer PoolsServer + ResourceDetailsServer ResourceDetailsServer + SKUServer SKUServer + SubscriptionUsagesServer SubscriptionUsagesServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armdevopsinfrastructure.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armdevopsinfrastructure.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trImageVersionsServer *ImageVersionsServerTransport + trOperationsServer *OperationsServerTransport + trPoolsServer *PoolsServerTransport + trResourceDetailsServer *ResourceDetailsServerTransport + trSKUServer *SKUServerTransport + trSubscriptionUsagesServer *SubscriptionUsagesServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "ImageVersionsClient": + initServer(s, &s.trImageVersionsServer, func() *ImageVersionsServerTransport { + return NewImageVersionsServerTransport(&s.srv.ImageVersionsServer) + }) + resp, err = s.trImageVersionsServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "PoolsClient": + initServer(s, &s.trPoolsServer, func() *PoolsServerTransport { return NewPoolsServerTransport(&s.srv.PoolsServer) }) + resp, err = s.trPoolsServer.Do(req) + case "ResourceDetailsClient": + initServer(s, &s.trResourceDetailsServer, func() *ResourceDetailsServerTransport { + return NewResourceDetailsServerTransport(&s.srv.ResourceDetailsServer) + }) + resp, err = s.trResourceDetailsServer.Do(req) + case "SKUClient": + initServer(s, &s.trSKUServer, func() *SKUServerTransport { return NewSKUServerTransport(&s.srv.SKUServer) }) + resp, err = s.trSKUServer.Do(req) + case "SubscriptionUsagesClient": + initServer(s, &s.trSubscriptionUsagesServer, func() *SubscriptionUsagesServerTransport { + return NewSubscriptionUsagesServerTransport(&s.srv.SubscriptionUsagesServer) + }) + resp, err = s.trSubscriptionUsagesServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go new file mode 100644 index 000000000000..7bc441779a45 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go @@ -0,0 +1,108 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "net/http" + "net/url" + "regexp" +) + +// SKUServer is a fake server for instances of the armdevopsinfrastructure.SKUClient type. +type SKUServer struct { + // NewListByLocationPager is the fake for method SKUClient.NewListByLocationPager + // HTTP status codes to indicate success: http.StatusOK + NewListByLocationPager func(locationName string, options *armdevopsinfrastructure.SKUClientListByLocationOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.SKUClientListByLocationResponse]) +} + +// NewSKUServerTransport creates a new instance of SKUServerTransport with the provided implementation. +// The returned SKUServerTransport instance is connected to an instance of armdevopsinfrastructure.SKUClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSKUServerTransport(srv *SKUServer) *SKUServerTransport { + return &SKUServerTransport{ + srv: srv, + newListByLocationPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.SKUClientListByLocationResponse]](), + } +} + +// SKUServerTransport connects instances of armdevopsinfrastructure.SKUClient to instances of SKUServer. +// Don't use this type directly, use NewSKUServerTransport instead. +type SKUServerTransport struct { + srv *SKUServer + newListByLocationPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.SKUClientListByLocationResponse]] +} + +// Do implements the policy.Transporter interface for SKUServerTransport. +func (s *SKUServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SKUClient.NewListByLocationPager": + resp, err = s.dispatchNewListByLocationPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SKUServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByLocationPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByLocationPager not implemented")} + } + newListByLocationPager := s.newListByLocationPager.get(req) + if newListByLocationPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByLocationPager(locationNameParam, nil) + newListByLocationPager = &resp + s.newListByLocationPager.add(req, newListByLocationPager) + server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armdevopsinfrastructure.SKUClientListByLocationResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByLocationPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByLocationPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByLocationPager) { + s.newListByLocationPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go new file mode 100644 index 000000000000..814de64be755 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go @@ -0,0 +1,108 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "net/http" + "net/url" + "regexp" +) + +// SubscriptionUsagesServer is a fake server for instances of the armdevopsinfrastructure.SubscriptionUsagesClient type. +type SubscriptionUsagesServer struct { + // NewListByLocationPager is the fake for method SubscriptionUsagesClient.NewListByLocationPager + // HTTP status codes to indicate success: http.StatusOK + NewListByLocationPager func(locationName string, options *armdevopsinfrastructure.SubscriptionUsagesClientListByLocationOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse]) +} + +// NewSubscriptionUsagesServerTransport creates a new instance of SubscriptionUsagesServerTransport with the provided implementation. +// The returned SubscriptionUsagesServerTransport instance is connected to an instance of armdevopsinfrastructure.SubscriptionUsagesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSubscriptionUsagesServerTransport(srv *SubscriptionUsagesServer) *SubscriptionUsagesServerTransport { + return &SubscriptionUsagesServerTransport{ + srv: srv, + newListByLocationPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse]](), + } +} + +// SubscriptionUsagesServerTransport connects instances of armdevopsinfrastructure.SubscriptionUsagesClient to instances of SubscriptionUsagesServer. +// Don't use this type directly, use NewSubscriptionUsagesServerTransport instead. +type SubscriptionUsagesServerTransport struct { + srv *SubscriptionUsagesServer + newListByLocationPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse]] +} + +// Do implements the policy.Transporter interface for SubscriptionUsagesServerTransport. +func (s *SubscriptionUsagesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SubscriptionUsagesClient.NewListByLocationPager": + resp, err = s.dispatchNewListByLocationPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SubscriptionUsagesServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByLocationPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByLocationPager not implemented")} + } + newListByLocationPager := s.newListByLocationPager.get(req) + if newListByLocationPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/usages` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByLocationPager(locationNameParam, nil) + newListByLocationPager = &resp + s.newListByLocationPager.add(req, newListByLocationPager) + server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByLocationPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByLocationPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByLocationPager) { + s.newListByLocationPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod new file mode 100644 index 000000000000..e2cbd512fb41 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go new file mode 100644 index 000000000000..1285cf8f02d4 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go @@ -0,0 +1,109 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ImageVersionsClient contains the methods for the ImageVersions group. +// Don't use this type directly, use NewImageVersionsClient() instead. +type ImageVersionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewImageVersionsClient creates a new instance of ImageVersionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewImageVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImageVersionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ImageVersionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByImagePager - List ImageVersion resources by Image +// +// Generated from API version 2024-04-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - imageName - Name of the image. +// - options - ImageVersionsClientListByImageOptions contains the optional parameters for the ImageVersionsClient.NewListByImagePager +// method. +func (client *ImageVersionsClient) NewListByImagePager(resourceGroupName string, imageName string, options *ImageVersionsClientListByImageOptions) *runtime.Pager[ImageVersionsClientListByImageResponse] { + return runtime.NewPager(runtime.PagingHandler[ImageVersionsClientListByImageResponse]{ + More: func(page ImageVersionsClientListByImageResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImageVersionsClientListByImageResponse) (ImageVersionsClientListByImageResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImageVersionsClient.NewListByImagePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByImageCreateRequest(ctx, resourceGroupName, imageName, options) + }, nil) + if err != nil { + return ImageVersionsClientListByImageResponse{}, err + } + return client.listByImageHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByImageCreateRequest creates the ListByImage request. +func (client *ImageVersionsClient) listByImageCreateRequest(ctx context.Context, resourceGroupName string, imageName string, options *ImageVersionsClientListByImageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/images/{imageName}/versions" + 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 imageName == "" { + return nil, errors.New("parameter imageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageName}", url.PathEscape(imageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByImageHandleResponse handles the ListByImage response. +func (client *ImageVersionsClient) listByImageHandleResponse(resp *http.Response) (ImageVersionsClientListByImageResponse, error) { + result := ImageVersionsClientListByImageResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageVersionListResult); err != nil { + return ImageVersionsClientListByImageResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go new file mode 100644 index 000000000000..85e5dd582fa8 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go @@ -0,0 +1,63 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +// AgentProfileClassification provides polymorphic access to related types. +// Call the interface's GetAgentProfile() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AgentProfile, *Stateful, *StatelessAgentProfile +type AgentProfileClassification interface { + // GetAgentProfile returns the AgentProfile content of the underlying type. + GetAgentProfile() *AgentProfile +} + +// AgentProfileUpdateClassification provides polymorphic access to related types. +// Call the interface's GetAgentProfileUpdate() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AgentProfileUpdate, *StatefulUpdate, *StatelessAgentProfileUpdate +type AgentProfileUpdateClassification interface { + // GetAgentProfileUpdate returns the AgentProfileUpdate content of the underlying type. + GetAgentProfileUpdate() *AgentProfileUpdate +} + +// FabricProfileClassification provides polymorphic access to related types. +// Call the interface's GetFabricProfile() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *FabricProfile, *VmssFabricProfile +type FabricProfileClassification interface { + // GetFabricProfile returns the FabricProfile content of the underlying type. + GetFabricProfile() *FabricProfile +} + +// OrganizationProfileClassification provides polymorphic access to related types. +// Call the interface's GetOrganizationProfile() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureDevOpsOrganizationProfile, *GitHubOrganizationProfile, *OrganizationProfile +type OrganizationProfileClassification interface { + // GetOrganizationProfile returns the OrganizationProfile content of the underlying type. + GetOrganizationProfile() *OrganizationProfile +} + +// ResourcePredictionsProfileClassification provides polymorphic access to related types. +// Call the interface's GetResourcePredictionsProfile() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AutomaticResourcePredictionsProfile, *ManualResourcePredictionsProfile, *ResourcePredictionsProfile +type ResourcePredictionsProfileClassification interface { + // GetResourcePredictionsProfile returns the ResourcePredictionsProfile content of the underlying type. + GetResourcePredictionsProfile() *ResourcePredictionsProfile +} + +// ResourcePredictionsProfileUpdateClassification provides polymorphic access to related types. +// Call the interface's GetResourcePredictionsProfileUpdate() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AutomaticResourcePredictionsProfileUpdate, *ManualResourcePredictionsProfileUpdate, *ResourcePredictionsProfileUpdate +type ResourcePredictionsProfileUpdateClassification interface { + // GetResourcePredictionsProfileUpdate returns the ResourcePredictionsProfileUpdate content of the underlying type. + GetResourcePredictionsProfileUpdate() *ResourcePredictionsProfileUpdate +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go new file mode 100644 index 000000000000..90f682a878c5 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go @@ -0,0 +1,828 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +import "time" + +// AgentProfile - The agent profile of the machines in the pool. +type AgentProfile struct { + // REQUIRED; Discriminator property for AgentProfile. + Kind *string + + // Defines pool buffer/stand-by agents. + ResourcePredictions any + + // Defines how the pool buffer/stand-by agents is provided. + ResourcePredictionsProfile ResourcePredictionsProfileClassification +} + +// GetAgentProfile implements the AgentProfileClassification interface for type AgentProfile. +func (a *AgentProfile) GetAgentProfile() *AgentProfile { return a } + +// AgentProfileUpdate - The agent profile of the machines in the pool. +type AgentProfileUpdate struct { + // REQUIRED; Discriminator property for AgentProfile. + Kind *string + + // Defines pool buffer/stand-by agents. + ResourcePredictions any + + // Defines how the pool buffer/stand-by agents is provided. + ResourcePredictionsProfile ResourcePredictionsProfileUpdateClassification +} + +// GetAgentProfileUpdate implements the AgentProfileUpdateClassification interface for type AgentProfileUpdate. +func (a *AgentProfileUpdate) GetAgentProfileUpdate() *AgentProfileUpdate { return a } + +// AutomaticResourcePredictionsProfile - The stand-by agent scheme is determined based on historical demand. +type AutomaticResourcePredictionsProfile struct { + // REQUIRED; Determines how the stand-by scheme should be provided. + Kind *ResourcePredictionsProfileType + + // Determines the balance between cost and performance. + PredictionPreference *PredictionPreference +} + +// GetResourcePredictionsProfile implements the ResourcePredictionsProfileClassification interface for type AutomaticResourcePredictionsProfile. +func (a *AutomaticResourcePredictionsProfile) GetResourcePredictionsProfile() *ResourcePredictionsProfile { + return &ResourcePredictionsProfile{ + Kind: a.Kind, + } +} + +// AutomaticResourcePredictionsProfileUpdate - The stand-by agent scheme is determined based on historical demand. +type AutomaticResourcePredictionsProfileUpdate struct { + // REQUIRED; Determines how the stand-by scheme should be provided. + Kind *ResourcePredictionsProfileType + + // Determines the balance between cost and performance. + PredictionPreference *PredictionPreference +} + +// GetResourcePredictionsProfileUpdate implements the ResourcePredictionsProfileUpdateClassification interface for type AutomaticResourcePredictionsProfileUpdate. +func (a *AutomaticResourcePredictionsProfileUpdate) GetResourcePredictionsProfileUpdate() *ResourcePredictionsProfileUpdate { + return &ResourcePredictionsProfileUpdate{ + Kind: a.Kind, + } +} + +// AzureDevOpsOrganizationProfile - Azure DevOps organization profile +type AzureDevOpsOrganizationProfile struct { + // REQUIRED; Discriminator property for OrganizationProfile. + Kind *string + + // REQUIRED; The list of Azure DevOps organizations the pool should be present in. + Organizations []*Organization + + // The type of permission which determines which accounts are admins on the Azure DevOps pool. + PermissionProfile *AzureDevOpsPermissionProfile +} + +// GetOrganizationProfile implements the OrganizationProfileClassification interface for type AzureDevOpsOrganizationProfile. +func (a *AzureDevOpsOrganizationProfile) GetOrganizationProfile() *OrganizationProfile { + return &OrganizationProfile{ + Kind: a.Kind, + } +} + +// AzureDevOpsPermissionProfile - Defines the type of Azure DevOps pool permission. +type AzureDevOpsPermissionProfile struct { + // REQUIRED; Determines who has admin permissions to the Azure DevOps pool. + Kind *AzureDevOpsPermissionType + + // Group email addresses + Groups []*string + + // User email addresses + Users []*string +} + +// DataDisk - The data disk of the VMSS. +type DataDisk struct { + // The type of caching to be enabled for the data disks. The default value for caching is readwrite. For information about + // the caching options see: + // https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. + Caching *CachingType + + // The initial disk size in gigabytes. + DiskSizeGiB *int32 + + // The drive letter for the empty data disk. If not specified, it will be the first available letter. + DriveLetter *string + + // The storage Account type to be used for the data disk. If omitted, the default is "standard_lrs". + StorageAccountType *StorageAccountType +} + +// DevOpsAzureSKU - The Azure SKU of the machines in the pool. +type DevOpsAzureSKU struct { + // REQUIRED; The Azure SKU name of the machines in the pool. + Name *string +} + +// FabricProfile - Defines the type of fabric the agent will run on. +type FabricProfile struct { + // REQUIRED; Discriminator property for FabricProfile. + Kind *string +} + +// GetFabricProfile implements the FabricProfileClassification interface for type FabricProfile. +func (f *FabricProfile) GetFabricProfile() *FabricProfile { return f } + +// GitHubOrganization - Defines a GitHub organization +type GitHubOrganization struct { + // REQUIRED; The GitHub organization URL in which the pool should be created. + URL *string + + // Optional list of repositories in which the pool should be created. + Repositories []*string +} + +// GitHubOrganizationProfile - GitHub organization profile +type GitHubOrganizationProfile struct { + // REQUIRED; Discriminator property for OrganizationProfile. + Kind *string + + // REQUIRED; The list of GitHub organizations/repositories the pool should be present in. + Organizations []*GitHubOrganization +} + +// GetOrganizationProfile implements the OrganizationProfileClassification interface for type GitHubOrganizationProfile. +func (g *GitHubOrganizationProfile) GetOrganizationProfile() *OrganizationProfile { + return &OrganizationProfile{ + Kind: g.Kind, + } +} + +// ImageVersion - An image version object +type ImageVersion struct { + // The resource-specific properties for this resource. + Properties *ImageVersionProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ImageVersionListResult - The response of a ImageVersion list operation. +type ImageVersionListResult struct { + // REQUIRED; The ImageVersion items on this page + Value []*ImageVersion + + // The link to the next page of items + NextLink *string +} + +// ImageVersionProperties - Details of the ImageVersionProperties. +type ImageVersionProperties struct { + // REQUIRED; Version of the image. + Version *string +} + +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + Type *ManagedServiceIdentityType + + // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM + // resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + // The dictionary values can be empty objects ({}) in + // requests. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + +// ManualResourcePredictionsProfile - Customer provides the stand-by agent scheme. +type ManualResourcePredictionsProfile struct { + // REQUIRED; Determines how the stand-by scheme should be provided. + Kind *ResourcePredictionsProfileType +} + +// GetResourcePredictionsProfile implements the ResourcePredictionsProfileClassification interface for type ManualResourcePredictionsProfile. +func (m *ManualResourcePredictionsProfile) GetResourcePredictionsProfile() *ResourcePredictionsProfile { + return &ResourcePredictionsProfile{ + Kind: m.Kind, + } +} + +// ManualResourcePredictionsProfileUpdate - Customer provides the stand-by agent scheme. +type ManualResourcePredictionsProfileUpdate struct { + // REQUIRED; Determines how the stand-by scheme should be provided. + Kind *ResourcePredictionsProfileType +} + +// GetResourcePredictionsProfileUpdate implements the ResourcePredictionsProfileUpdateClassification interface for type ManualResourcePredictionsProfileUpdate. +func (m *ManualResourcePredictionsProfileUpdate) GetResourcePredictionsProfileUpdate() *ResourcePredictionsProfileUpdate { + return &ResourcePredictionsProfileUpdate{ + Kind: m.Kind, + } +} + +// NetworkProfile - The network profile of the machines in the pool. +type NetworkProfile struct { + // REQUIRED; The subnet id on which to put all machines created in the pool. + SubnetID *string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// Organization - Defines an Azure DevOps organization. +type Organization struct { + // REQUIRED; The Azure DevOps organization URL in which the pool should be created. + URL *string + + // How many machines can be created at maximum in this organization out of the maximumConcurrency of the pool. + Parallelism *int32 + + // Optional list of projects in which the pool should be created. + Projects []*string +} + +// OrganizationProfile - Defines the organization in which the pool will be used. +type OrganizationProfile struct { + // REQUIRED; Discriminator property for OrganizationProfile. + Kind *string +} + +// GetOrganizationProfile implements the OrganizationProfileClassification interface for type OrganizationProfile. +func (o *OrganizationProfile) GetOrganizationProfile() *OrganizationProfile { return o } + +// OsProfile - The OS profile of the machines in the pool. +type OsProfile struct { + // Determines how the service should be run. By default, this will be set to Service. + LogonType *LogonType + + // The secret management settings of the machines in the pool. + SecretsManagementSettings *SecretsManagementSettings +} + +// Pool - Concrete tracked resource types can be created by aliasing this type using a specific property type. +type Pool struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + + // The resource-specific properties for this resource. + Properties *PoolProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PoolImage - The VM image of the machines in the pool. +type PoolImage struct { + // List of aliases to reference the image by. + Aliases []*string + + // The percentage of the buffer to be allocated to this image. + Buffer *string + + // The resource id of the image. + ResourceID *string + + // The image to use from a well-known set of images made available to customers. + WellKnownImageName *string +} + +// PoolListResult - The response of a Pool list operation. +type PoolListResult struct { + // REQUIRED; The Pool items on this page + Value []*Pool + + // The link to the next page of items + NextLink *string +} + +// PoolProperties - Pool properties +type PoolProperties struct { + // REQUIRED; Defines how the machine will be handled once it executed a job. + AgentProfile AgentProfileClassification + + // REQUIRED; The resource id of the DevCenter Project the pool belongs to. + DevCenterProjectResourceID *string + + // REQUIRED; Defines the type of fabric the agent will run on. + FabricProfile FabricProfileClassification + + // REQUIRED; Defines how many resources can there be created at any given time. + MaximumConcurrency *int32 + + // REQUIRED; Defines the organization in which the pool will be used. + OrganizationProfile OrganizationProfileClassification + + // The status of the current operation. + ProvisioningState *ProvisioningState +} + +// PoolUpdate - The type used for update operations of the Pool. +type PoolUpdate struct { + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + + // The updatable properties of the Pool. + Properties *PoolUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// PoolUpdateProperties - The updatable properties of the Pool. +type PoolUpdateProperties struct { + // Defines how the machine will be handled once it executed a job. + AgentProfile AgentProfileUpdateClassification + + // The resource id of the DevCenter Project the pool belongs to. + DevCenterProjectResourceID *string + + // Defines the type of fabric the agent will run on. + FabricProfile FabricProfileClassification + + // Defines how many resources can there be created at any given time. + MaximumConcurrency *int32 + + // Defines the organization in which the pool will be used. + OrganizationProfile OrganizationProfileClassification + + // The status of the current operation. + ProvisioningState *ProvisioningState +} + +// Quota - Describes Resource Quota +type Quota struct { + // The resource-specific properties for this resource. + Properties *QuotaProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// QuotaListResult - The response of a Quota list operation. +type QuotaListResult struct { + // REQUIRED; The Quota items on this page + Value []*Quota + + // The link to the next page of items + NextLink *string +} + +// QuotaName - The Quota Names +type QuotaName struct { + // The localized name of the resource. + LocalizedValue *string + + // The name of the resource. + Value *string +} + +// QuotaProperties - Describes Resource Quota properties +type QuotaProperties struct { + // REQUIRED; The current usage of the resource. + CurrentValue *int64 + + // REQUIRED; The maximum permitted usage of the resource. + Limit *int64 + + // REQUIRED; The details of the quota. + Name *QuotaName + + // REQUIRED; The unit of usage measurement. + Unit *string +} + +// ResourceDetailsObject - A ResourceDetailsObject +type ResourceDetailsObject struct { + // The resource-specific properties for this resource. + Properties *ResourceDetailsObjectProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ResourceDetailsObjectListResult - The response of a ResourceDetailsObject list operation. +type ResourceDetailsObjectListResult struct { + // REQUIRED; The ResourceDetailsObject items on this page + Value []*ResourceDetailsObject + + // The link to the next page of items + NextLink *string +} + +// ResourceDetailsObjectProperties - Details of the ResourceDetailsObject. +type ResourceDetailsObjectProperties struct { + // REQUIRED; The image name of the resource. + Image *string + + // REQUIRED; The version of the image running on the resource. + ImageVersion *string + + // REQUIRED; The status of the resource. + Status *ResourceStatus +} + +// ResourcePredictionsProfile - Determines how the stand-by scheme should be provided. +type ResourcePredictionsProfile struct { + // REQUIRED; Determines how the stand-by scheme should be provided. + Kind *ResourcePredictionsProfileType +} + +// GetResourcePredictionsProfile implements the ResourcePredictionsProfileClassification interface for type ResourcePredictionsProfile. +func (r *ResourcePredictionsProfile) GetResourcePredictionsProfile() *ResourcePredictionsProfile { + return r +} + +// ResourcePredictionsProfileUpdate - Determines how the stand-by scheme should be provided. +type ResourcePredictionsProfileUpdate struct { + // REQUIRED; Determines how the stand-by scheme should be provided. + Kind *ResourcePredictionsProfileType +} + +// GetResourcePredictionsProfileUpdate implements the ResourcePredictionsProfileUpdateClassification interface for type ResourcePredictionsProfileUpdate. +func (r *ResourcePredictionsProfileUpdate) GetResourcePredictionsProfileUpdate() *ResourcePredictionsProfileUpdate { + return r +} + +// ResourceSKU - A ResourceSku +type ResourceSKU struct { + // The resource-specific properties for this resource. + Properties *ResourceSKUProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ResourceSKUCapabilities - Describes The SKU capabilities object. +type ResourceSKUCapabilities struct { + // REQUIRED; The name of the SKU capability. + Name *string + + // REQUIRED; The value of the SKU capability. + Value *string +} + +// ResourceSKUListResult - The response of a ResourceSku list operation. +type ResourceSKUListResult struct { + // REQUIRED; The ResourceSku items on this page + Value []*ResourceSKU + + // The link to the next page of items + NextLink *string +} + +// ResourceSKULocationInfo - Describes an available Compute SKU Location Information. +type ResourceSKULocationInfo struct { + // REQUIRED; Location of the SKU + Location *string + + // REQUIRED; Gets details of capabilities available to a SKU in specific zones. + ZoneDetails []*ResourceSKUZoneDetails + + // REQUIRED; List of availability zones where the SKU is supported. + Zones []*string +} + +// ResourceSKUProperties - Properties of a ResourceSku +type ResourceSKUProperties struct { + // REQUIRED; Name value pairs to describe the capability. + Capabilities []*ResourceSKUCapabilities + + // REQUIRED; The family of the SKU. + Family *string + + // REQUIRED; A list of locations and availability zones in those locations where the SKU is available + LocationInfo []*ResourceSKULocationInfo + + // REQUIRED; The set of locations that the SKU is available. + Locations []*string + + // REQUIRED; The type of resource the SKU applies to. + ResourceType *string + + // REQUIRED; The restrictions of the SKU. + Restrictions []*ResourceSKURestrictions + + // REQUIRED; The size of the SKU. + Size *string + + // REQUIRED; The tier of virtual machines in a scale set + Tier *string +} + +// ResourceSKURestrictionInfo - Describes an available Compute SKU Restriction Information. +type ResourceSKURestrictionInfo struct { + // Locations where the SKU is restricted + Locations []*string + + // List of availability zones where the SKU is restricted. + Zones []*string +} + +// ResourceSKURestrictions - The restrictions of the SKU. +type ResourceSKURestrictions struct { + // REQUIRED; The information about the restriction where the SKU cannot be used. + RestrictionInfo *ResourceSKURestrictionInfo + + // REQUIRED; The value of restrictions. If the restriction type is set to location. This would be different locations where + // the SKU is restricted. + Values []*string + + // the reason for restriction. + ReasonCode *ResourceSKURestrictionsReasonCode + + // the type of restrictions. + Type *ResourceSKURestrictionsType +} + +// ResourceSKUZoneDetails - Describes The zonal capabilities of a SKU. +type ResourceSKUZoneDetails struct { + // REQUIRED; A list of capabilities that are available for the SKU in the specified list of zones. + Capabilities []*ResourceSKUCapabilities + + // REQUIRED; Gets the set of zones that the SKU is available in with the specified capabilities. + Name []*string +} + +// SecretsManagementSettings - The secret management settings of the machines in the pool. +type SecretsManagementSettings struct { + // REQUIRED; Defines if the key of the certificates should be exportable. + KeyExportable *bool + + // REQUIRED; The list of certificates to install on all machines in the pool. + ObservedCertificates []*string + + // Where to store certificates on the machine. + CertificateStoreLocation *string +} + +// Stateful profile meaning that the machines will be returned to the pool after running a job. +type Stateful struct { + // REQUIRED; Discriminator property for AgentProfile. + Kind *string + + // How long should the machine be kept around after it ran a workload when there are no stand-by agents. The maximum is one + // week. + GracePeriodTimeSpan *string + + // How long should stateful machines be kept around. The maximum is one week. + MaxAgentLifetime *string + + // Defines pool buffer/stand-by agents. + ResourcePredictions any + + // Defines how the pool buffer/stand-by agents is provided. + ResourcePredictionsProfile ResourcePredictionsProfileClassification +} + +// GetAgentProfile implements the AgentProfileClassification interface for type Stateful. +func (s *Stateful) GetAgentProfile() *AgentProfile { + return &AgentProfile{ + Kind: s.Kind, + ResourcePredictions: s.ResourcePredictions, + ResourcePredictionsProfile: s.ResourcePredictionsProfile, + } +} + +// StatefulUpdate - Stateful profile meaning that the machines will be returned to the pool after running a job. +type StatefulUpdate struct { + // REQUIRED; Discriminator property for AgentProfile. + Kind *string + + // How long should the machine be kept around after it ran a workload when there are no stand-by agents. The maximum is one + // week. + GracePeriodTimeSpan *string + + // How long should stateful machines be kept around. The maximum is one week. + MaxAgentLifetime *string + + // Defines pool buffer/stand-by agents. + ResourcePredictions any + + // Defines how the pool buffer/stand-by agents is provided. + ResourcePredictionsProfile ResourcePredictionsProfileUpdateClassification +} + +// GetAgentProfileUpdate implements the AgentProfileUpdateClassification interface for type StatefulUpdate. +func (s *StatefulUpdate) GetAgentProfileUpdate() *AgentProfileUpdate { + return &AgentProfileUpdate{ + Kind: s.Kind, + ResourcePredictions: s.ResourcePredictions, + ResourcePredictionsProfile: s.ResourcePredictionsProfile, + } +} + +// StatelessAgentProfile - Stateless profile meaning that the machines will be cleaned up after running a job. +type StatelessAgentProfile struct { + // REQUIRED; Discriminator property for AgentProfile. + Kind *string + + // Defines pool buffer/stand-by agents. + ResourcePredictions any + + // Defines how the pool buffer/stand-by agents is provided. + ResourcePredictionsProfile ResourcePredictionsProfileClassification +} + +// GetAgentProfile implements the AgentProfileClassification interface for type StatelessAgentProfile. +func (s *StatelessAgentProfile) GetAgentProfile() *AgentProfile { + return &AgentProfile{ + Kind: s.Kind, + ResourcePredictions: s.ResourcePredictions, + ResourcePredictionsProfile: s.ResourcePredictionsProfile, + } +} + +// StatelessAgentProfileUpdate - Stateless profile meaning that the machines will be cleaned up after running a job. +type StatelessAgentProfileUpdate struct { + // REQUIRED; Discriminator property for AgentProfile. + Kind *string + + // Defines pool buffer/stand-by agents. + ResourcePredictions any + + // Defines how the pool buffer/stand-by agents is provided. + ResourcePredictionsProfile ResourcePredictionsProfileUpdateClassification +} + +// GetAgentProfileUpdate implements the AgentProfileUpdateClassification interface for type StatelessAgentProfileUpdate. +func (s *StatelessAgentProfileUpdate) GetAgentProfileUpdate() *AgentProfileUpdate { + return &AgentProfileUpdate{ + Kind: s.Kind, + ResourcePredictions: s.ResourcePredictions, + ResourcePredictionsProfile: s.ResourcePredictionsProfile, + } +} + +// StorageProfile - The storage profile of the VMSS. +type StorageProfile struct { + // A list of empty data disks to attach. + DataDisks []*DataDisk + + // The Azure SKU name of the machines in the pool. + OSDiskStorageAccountType *OsDiskStorageAccountType +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} + +// VmssFabricProfile - The agents will run on Virtual Machine Scale Sets. +type VmssFabricProfile struct { + // REQUIRED; The VM images of the machines in the pool. + Images []*PoolImage + + // REQUIRED; Discriminator property for FabricProfile. + Kind *string + + // REQUIRED; The Azure SKU of the machines in the pool. + SKU *DevOpsAzureSKU + + // The network profile of the machines in the pool. + NetworkProfile *NetworkProfile + + // The OS profile of the machines in the pool. + OSProfile *OsProfile + + // The storage profile of the machines in the pool. + StorageProfile *StorageProfile +} + +// GetFabricProfile implements the FabricProfileClassification interface for type VmssFabricProfile. +func (v *VmssFabricProfile) GetFabricProfile() *FabricProfile { + return &FabricProfile{ + Kind: v.Kind, + } +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go new file mode 100644 index 000000000000..30ddb194628f --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go @@ -0,0 +1,2034 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AgentProfile. +func (a AgentProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = a.Kind + populateAny(objectMap, "resourcePredictions", a.ResourcePredictions) + populate(objectMap, "resourcePredictionsProfile", a.ResourcePredictionsProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentProfile. +func (a *AgentProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "resourcePredictions": + err = unpopulate(val, "ResourcePredictions", &a.ResourcePredictions) + delete(rawMsg, key) + case "resourcePredictionsProfile": + a.ResourcePredictionsProfile, err = unmarshalResourcePredictionsProfileClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AgentProfileUpdate. +func (a AgentProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = a.Kind + populateAny(objectMap, "resourcePredictions", a.ResourcePredictions) + populate(objectMap, "resourcePredictionsProfile", a.ResourcePredictionsProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentProfileUpdate. +func (a *AgentProfileUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "resourcePredictions": + err = unpopulate(val, "ResourcePredictions", &a.ResourcePredictions) + delete(rawMsg, key) + case "resourcePredictionsProfile": + a.ResourcePredictionsProfile, err = unmarshalResourcePredictionsProfileUpdateClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomaticResourcePredictionsProfile. +func (a AutomaticResourcePredictionsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = ResourcePredictionsProfileTypeAutomatic + populate(objectMap, "predictionPreference", a.PredictionPreference) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomaticResourcePredictionsProfile. +func (a *AutomaticResourcePredictionsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "predictionPreference": + err = unpopulate(val, "PredictionPreference", &a.PredictionPreference) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomaticResourcePredictionsProfileUpdate. +func (a AutomaticResourcePredictionsProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = ResourcePredictionsProfileTypeAutomatic + populate(objectMap, "predictionPreference", a.PredictionPreference) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomaticResourcePredictionsProfileUpdate. +func (a *AutomaticResourcePredictionsProfileUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "predictionPreference": + err = unpopulate(val, "PredictionPreference", &a.PredictionPreference) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureDevOpsOrganizationProfile. +func (a AzureDevOpsOrganizationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = "AzureDevOps" + populate(objectMap, "organizations", a.Organizations) + populate(objectMap, "permissionProfile", a.PermissionProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDevOpsOrganizationProfile. +func (a *AzureDevOpsOrganizationProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "organizations": + err = unpopulate(val, "Organizations", &a.Organizations) + delete(rawMsg, key) + case "permissionProfile": + err = unpopulate(val, "PermissionProfile", &a.PermissionProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureDevOpsPermissionProfile. +func (a AzureDevOpsPermissionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groups", a.Groups) + populate(objectMap, "kind", a.Kind) + populate(objectMap, "users", a.Users) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDevOpsPermissionProfile. +func (a *AzureDevOpsPermissionProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groups": + err = unpopulate(val, "Groups", &a.Groups) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "users": + err = unpopulate(val, "Users", &a.Users) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataDisk. +func (d DataDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "caching", d.Caching) + populate(objectMap, "diskSizeGiB", d.DiskSizeGiB) + populate(objectMap, "driveLetter", d.DriveLetter) + populate(objectMap, "storageAccountType", d.StorageAccountType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataDisk. +func (d *DataDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "caching": + err = unpopulate(val, "Caching", &d.Caching) + delete(rawMsg, key) + case "diskSizeGiB": + err = unpopulate(val, "DiskSizeGiB", &d.DiskSizeGiB) + delete(rawMsg, key) + case "driveLetter": + err = unpopulate(val, "DriveLetter", &d.DriveLetter) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &d.StorageAccountType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DevOpsAzureSKU. +func (d DevOpsAzureSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", d.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DevOpsAzureSKU. +func (d *DevOpsAzureSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FabricProfile. +func (f FabricProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = f.Kind + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricProfile. +func (f *FabricProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &f.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GitHubOrganization. +func (g GitHubOrganization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "repositories", g.Repositories) + populate(objectMap, "url", g.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GitHubOrganization. +func (g *GitHubOrganization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "repositories": + err = unpopulate(val, "Repositories", &g.Repositories) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &g.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GitHubOrganizationProfile. +func (g GitHubOrganizationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = "GitHub" + populate(objectMap, "organizations", g.Organizations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GitHubOrganizationProfile. +func (g *GitHubOrganizationProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &g.Kind) + delete(rawMsg, key) + case "organizations": + err = unpopulate(val, "Organizations", &g.Organizations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageVersion. +func (i ImageVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageVersion. +func (i *ImageVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageVersionListResult. +func (i ImageVersionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageVersionListResult. +func (i *ImageVersionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageVersionProperties. +func (i ImageVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "version", i.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageVersionProperties. +func (i *ImageVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "version": + err = unpopulate(val, "Version", &i.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManualResourcePredictionsProfile. +func (m ManualResourcePredictionsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = ResourcePredictionsProfileTypeManual + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManualResourcePredictionsProfile. +func (m *ManualResourcePredictionsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManualResourcePredictionsProfileUpdate. +func (m ManualResourcePredictionsProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = ResourcePredictionsProfileTypeManual + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManualResourcePredictionsProfileUpdate. +func (m *ManualResourcePredictionsProfileUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkProfile. +func (n NetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "subnetId", n.SubnetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfile. +func (n *NetworkProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "subnetId": + err = unpopulate(val, "SubnetID", &n.SubnetID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Organization. +func (o Organization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "parallelism", o.Parallelism) + populate(objectMap, "projects", o.Projects) + populate(objectMap, "url", o.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Organization. +func (o *Organization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "parallelism": + err = unpopulate(val, "Parallelism", &o.Parallelism) + delete(rawMsg, key) + case "projects": + err = unpopulate(val, "Projects", &o.Projects) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &o.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OrganizationProfile. +func (o OrganizationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = o.Kind + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrganizationProfile. +func (o *OrganizationProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &o.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OsProfile. +func (o OsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "logonType", o.LogonType) + populate(objectMap, "secretsManagementSettings", o.SecretsManagementSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfile. +func (o *OsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logonType": + err = unpopulate(val, "LogonType", &o.LogonType) + delete(rawMsg, key) + case "secretsManagementSettings": + err = unpopulate(val, "SecretsManagementSettings", &o.SecretsManagementSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Pool. +func (p Pool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "identity", p.Identity) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Pool. +func (p *Pool) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &p.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PoolImage. +func (p PoolImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aliases", p.Aliases) + populate(objectMap, "buffer", p.Buffer) + populate(objectMap, "resourceId", p.ResourceID) + populate(objectMap, "wellKnownImageName", p.WellKnownImageName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolImage. +func (p *PoolImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aliases": + err = unpopulate(val, "Aliases", &p.Aliases) + delete(rawMsg, key) + case "buffer": + err = unpopulate(val, "Buffer", &p.Buffer) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &p.ResourceID) + delete(rawMsg, key) + case "wellKnownImageName": + err = unpopulate(val, "WellKnownImageName", &p.WellKnownImageName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PoolListResult. +func (p PoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolListResult. +func (p *PoolListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PoolProperties. +func (p PoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentProfile", p.AgentProfile) + populate(objectMap, "devCenterProjectResourceId", p.DevCenterProjectResourceID) + populate(objectMap, "fabricProfile", p.FabricProfile) + populate(objectMap, "maximumConcurrency", p.MaximumConcurrency) + populate(objectMap, "organizationProfile", p.OrganizationProfile) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolProperties. +func (p *PoolProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentProfile": + p.AgentProfile, err = unmarshalAgentProfileClassification(val) + delete(rawMsg, key) + case "devCenterProjectResourceId": + err = unpopulate(val, "DevCenterProjectResourceID", &p.DevCenterProjectResourceID) + delete(rawMsg, key) + case "fabricProfile": + p.FabricProfile, err = unmarshalFabricProfileClassification(val) + delete(rawMsg, key) + case "maximumConcurrency": + err = unpopulate(val, "MaximumConcurrency", &p.MaximumConcurrency) + delete(rawMsg, key) + case "organizationProfile": + p.OrganizationProfile, err = unmarshalOrganizationProfileClassification(val) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PoolUpdate. +func (p PoolUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", p.Identity) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolUpdate. +func (p *PoolUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &p.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PoolUpdateProperties. +func (p PoolUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentProfile", p.AgentProfile) + populate(objectMap, "devCenterProjectResourceId", p.DevCenterProjectResourceID) + populate(objectMap, "fabricProfile", p.FabricProfile) + populate(objectMap, "maximumConcurrency", p.MaximumConcurrency) + populate(objectMap, "organizationProfile", p.OrganizationProfile) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolUpdateProperties. +func (p *PoolUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentProfile": + p.AgentProfile, err = unmarshalAgentProfileUpdateClassification(val) + delete(rawMsg, key) + case "devCenterProjectResourceId": + err = unpopulate(val, "DevCenterProjectResourceID", &p.DevCenterProjectResourceID) + delete(rawMsg, key) + case "fabricProfile": + p.FabricProfile, err = unmarshalFabricProfileClassification(val) + delete(rawMsg, key) + case "maximumConcurrency": + err = unpopulate(val, "MaximumConcurrency", &p.MaximumConcurrency) + delete(rawMsg, key) + case "organizationProfile": + p.OrganizationProfile, err = unmarshalOrganizationProfileClassification(val) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Quota. +func (q Quota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", q.ID) + populate(objectMap, "name", q.Name) + populate(objectMap, "properties", q.Properties) + populate(objectMap, "systemData", q.SystemData) + populate(objectMap, "type", q.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Quota. +func (q *Quota) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &q.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &q.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &q.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &q.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaListResult. +func (q QuotaListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", q.NextLink) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaListResult. +func (q *QuotaListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &q.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &q.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaName. +func (q QuotaName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "localizedValue", q.LocalizedValue) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaName. +func (q *QuotaName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &q.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &q.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaProperties. +func (q QuotaProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentValue", q.CurrentValue) + populate(objectMap, "limit", q.Limit) + populate(objectMap, "name", q.Name) + populate(objectMap, "unit", q.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaProperties. +func (q *QuotaProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &q.CurrentValue) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &q.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &q.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceDetailsObject. +func (r ResourceDetailsObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceDetailsObject. +func (r *ResourceDetailsObject) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceDetailsObjectListResult. +func (r ResourceDetailsObjectListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceDetailsObjectListResult. +func (r *ResourceDetailsObjectListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceDetailsObjectProperties. +func (r ResourceDetailsObjectProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "image", r.Image) + populate(objectMap, "imageVersion", r.ImageVersion) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceDetailsObjectProperties. +func (r *ResourceDetailsObjectProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "image": + err = unpopulate(val, "Image", &r.Image) + delete(rawMsg, key) + case "imageVersion": + err = unpopulate(val, "ImageVersion", &r.ImageVersion) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourcePredictionsProfile. +func (r ResourcePredictionsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = r.Kind + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourcePredictionsProfile. +func (r *ResourcePredictionsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &r.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourcePredictionsProfileUpdate. +func (r ResourcePredictionsProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = r.Kind + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourcePredictionsProfileUpdate. +func (r *ResourcePredictionsProfileUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &r.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKU. +func (r ResourceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKU. +func (r *ResourceSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKUCapabilities. +func (r ResourceSKUCapabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", r.Name) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKUCapabilities. +func (r *ResourceSKUCapabilities) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKUListResult. +func (r ResourceSKUListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKUListResult. +func (r *ResourceSKUListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKULocationInfo. +func (r ResourceSKULocationInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", r.Location) + populate(objectMap, "zoneDetails", r.ZoneDetails) + populate(objectMap, "zones", r.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKULocationInfo. +func (r *ResourceSKULocationInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "zoneDetails": + err = unpopulate(val, "ZoneDetails", &r.ZoneDetails) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &r.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKUProperties. +func (r ResourceSKUProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capabilities", r.Capabilities) + populate(objectMap, "family", r.Family) + populate(objectMap, "locationInfo", r.LocationInfo) + populate(objectMap, "locations", r.Locations) + populate(objectMap, "resourceType", r.ResourceType) + populate(objectMap, "restrictions", r.Restrictions) + populate(objectMap, "size", r.Size) + populate(objectMap, "tier", r.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKUProperties. +func (r *ResourceSKUProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capabilities": + err = unpopulate(val, "Capabilities", &r.Capabilities) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &r.Family) + delete(rawMsg, key) + case "locationInfo": + err = unpopulate(val, "LocationInfo", &r.LocationInfo) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &r.Locations) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &r.ResourceType) + delete(rawMsg, key) + case "restrictions": + err = unpopulate(val, "Restrictions", &r.Restrictions) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &r.Size) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &r.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKURestrictionInfo. +func (r ResourceSKURestrictionInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "locations", r.Locations) + populate(objectMap, "zones", r.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKURestrictionInfo. +func (r *ResourceSKURestrictionInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "locations": + err = unpopulate(val, "Locations", &r.Locations) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &r.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKURestrictions. +func (r ResourceSKURestrictions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "reasonCode", r.ReasonCode) + populate(objectMap, "restrictionInfo", r.RestrictionInfo) + populate(objectMap, "type", r.Type) + populate(objectMap, "values", r.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKURestrictions. +func (r *ResourceSKURestrictions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "reasonCode": + err = unpopulate(val, "ReasonCode", &r.ReasonCode) + delete(rawMsg, key) + case "restrictionInfo": + err = unpopulate(val, "RestrictionInfo", &r.RestrictionInfo) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &r.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKUZoneDetails. +func (r ResourceSKUZoneDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capabilities", r.Capabilities) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKUZoneDetails. +func (r *ResourceSKUZoneDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capabilities": + err = unpopulate(val, "Capabilities", &r.Capabilities) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecretsManagementSettings. +func (s SecretsManagementSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificateStoreLocation", s.CertificateStoreLocation) + populate(objectMap, "keyExportable", s.KeyExportable) + populate(objectMap, "observedCertificates", s.ObservedCertificates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretsManagementSettings. +func (s *SecretsManagementSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificateStoreLocation": + err = unpopulate(val, "CertificateStoreLocation", &s.CertificateStoreLocation) + delete(rawMsg, key) + case "keyExportable": + err = unpopulate(val, "KeyExportable", &s.KeyExportable) + delete(rawMsg, key) + case "observedCertificates": + err = unpopulate(val, "ObservedCertificates", &s.ObservedCertificates) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Stateful. +func (s Stateful) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "gracePeriodTimeSpan", s.GracePeriodTimeSpan) + objectMap["kind"] = "Stateful" + populate(objectMap, "maxAgentLifetime", s.MaxAgentLifetime) + populateAny(objectMap, "resourcePredictions", s.ResourcePredictions) + populate(objectMap, "resourcePredictionsProfile", s.ResourcePredictionsProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Stateful. +func (s *Stateful) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "gracePeriodTimeSpan": + err = unpopulate(val, "GracePeriodTimeSpan", &s.GracePeriodTimeSpan) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "maxAgentLifetime": + err = unpopulate(val, "MaxAgentLifetime", &s.MaxAgentLifetime) + delete(rawMsg, key) + case "resourcePredictions": + err = unpopulate(val, "ResourcePredictions", &s.ResourcePredictions) + delete(rawMsg, key) + case "resourcePredictionsProfile": + s.ResourcePredictionsProfile, err = unmarshalResourcePredictionsProfileClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StatefulUpdate. +func (s StatefulUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "gracePeriodTimeSpan", s.GracePeriodTimeSpan) + objectMap["kind"] = "Stateful" + populate(objectMap, "maxAgentLifetime", s.MaxAgentLifetime) + populateAny(objectMap, "resourcePredictions", s.ResourcePredictions) + populate(objectMap, "resourcePredictionsProfile", s.ResourcePredictionsProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StatefulUpdate. +func (s *StatefulUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "gracePeriodTimeSpan": + err = unpopulate(val, "GracePeriodTimeSpan", &s.GracePeriodTimeSpan) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "maxAgentLifetime": + err = unpopulate(val, "MaxAgentLifetime", &s.MaxAgentLifetime) + delete(rawMsg, key) + case "resourcePredictions": + err = unpopulate(val, "ResourcePredictions", &s.ResourcePredictions) + delete(rawMsg, key) + case "resourcePredictionsProfile": + s.ResourcePredictionsProfile, err = unmarshalResourcePredictionsProfileUpdateClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StatelessAgentProfile. +func (s StatelessAgentProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = "Stateless" + populateAny(objectMap, "resourcePredictions", s.ResourcePredictions) + populate(objectMap, "resourcePredictionsProfile", s.ResourcePredictionsProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StatelessAgentProfile. +func (s *StatelessAgentProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "resourcePredictions": + err = unpopulate(val, "ResourcePredictions", &s.ResourcePredictions) + delete(rawMsg, key) + case "resourcePredictionsProfile": + s.ResourcePredictionsProfile, err = unmarshalResourcePredictionsProfileClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StatelessAgentProfileUpdate. +func (s StatelessAgentProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["kind"] = "Stateless" + populateAny(objectMap, "resourcePredictions", s.ResourcePredictions) + populate(objectMap, "resourcePredictionsProfile", s.ResourcePredictionsProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StatelessAgentProfileUpdate. +func (s *StatelessAgentProfileUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "resourcePredictions": + err = unpopulate(val, "ResourcePredictions", &s.ResourcePredictions) + delete(rawMsg, key) + case "resourcePredictionsProfile": + s.ResourcePredictionsProfile, err = unmarshalResourcePredictionsProfileUpdateClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageProfile. +func (s StorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataDisks", s.DataDisks) + populate(objectMap, "osDiskStorageAccountType", s.OSDiskStorageAccountType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfile. +func (s *StorageProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataDisks": + err = unpopulate(val, "DataDisks", &s.DataDisks) + delete(rawMsg, key) + case "osDiskStorageAccountType": + err = unpopulate(val, "OSDiskStorageAccountType", &s.OSDiskStorageAccountType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmssFabricProfile. +func (v VmssFabricProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "images", v.Images) + objectMap["kind"] = "Vmss" + populate(objectMap, "networkProfile", v.NetworkProfile) + populate(objectMap, "osProfile", v.OSProfile) + populate(objectMap, "sku", v.SKU) + populate(objectMap, "storageProfile", v.StorageProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmssFabricProfile. +func (v *VmssFabricProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "images": + err = unpopulate(val, "Images", &v.Images) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &v.Kind) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &v.NetworkProfile) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &v.OSProfile) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &v.SKU) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &v.StorageProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go new file mode 100644 index 000000000000..a5d075124522 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2024-04-04-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.DevOpsInfrastructure/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go new file mode 100644 index 000000000000..f44bb303f492 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go @@ -0,0 +1,71 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +// ImageVersionsClientListByImageOptions contains the optional parameters for the ImageVersionsClient.NewListByImagePager +// method. +type ImageVersionsClientListByImageOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the PoolsClient.BeginCreateOrUpdate method. +type PoolsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PoolsClientBeginDeleteOptions contains the optional parameters for the PoolsClient.BeginDelete method. +type PoolsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PoolsClientBeginUpdateOptions contains the optional parameters for the PoolsClient.BeginUpdate method. +type PoolsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PoolsClientGetOptions contains the optional parameters for the PoolsClient.Get method. +type PoolsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PoolsClientListByResourceGroupOptions contains the optional parameters for the PoolsClient.NewListByResourceGroupPager +// method. +type PoolsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// PoolsClientListBySubscriptionOptions contains the optional parameters for the PoolsClient.NewListBySubscriptionPager method. +type PoolsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ResourceDetailsClientListByPoolOptions contains the optional parameters for the ResourceDetailsClient.NewListByPoolPager +// method. +type ResourceDetailsClientListByPoolOptions struct { + // placeholder for future optional parameters +} + +// SKUClientListByLocationOptions contains the optional parameters for the SKUClient.NewListByLocationPager method. +type SKUClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// SubscriptionUsagesClientListByLocationOptions contains the optional parameters for the SubscriptionUsagesClient.NewListByLocationPager +// method. +type SubscriptionUsagesClientListByLocationOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go new file mode 100644 index 000000000000..edcaa65c747c --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go @@ -0,0 +1,147 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +import "encoding/json" + +func unmarshalAgentProfileClassification(rawMsg json.RawMessage) (AgentProfileClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b AgentProfileClassification + switch m["kind"] { + case "Stateful": + b = &Stateful{} + case "Stateless": + b = &StatelessAgentProfile{} + default: + b = &AgentProfile{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalAgentProfileUpdateClassification(rawMsg json.RawMessage) (AgentProfileUpdateClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b AgentProfileUpdateClassification + switch m["kind"] { + case "Stateful": + b = &StatefulUpdate{} + case "Stateless": + b = &StatelessAgentProfileUpdate{} + default: + b = &AgentProfileUpdate{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalFabricProfileClassification(rawMsg json.RawMessage) (FabricProfileClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b FabricProfileClassification + switch m["kind"] { + case "Vmss": + b = &VmssFabricProfile{} + default: + b = &FabricProfile{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalOrganizationProfileClassification(rawMsg json.RawMessage) (OrganizationProfileClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b OrganizationProfileClassification + switch m["kind"] { + case "AzureDevOps": + b = &AzureDevOpsOrganizationProfile{} + case "GitHub": + b = &GitHubOrganizationProfile{} + default: + b = &OrganizationProfile{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalResourcePredictionsProfileClassification(rawMsg json.RawMessage) (ResourcePredictionsProfileClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ResourcePredictionsProfileClassification + switch m["kind"] { + case string(ResourcePredictionsProfileTypeAutomatic): + b = &AutomaticResourcePredictionsProfile{} + case string(ResourcePredictionsProfileTypeManual): + b = &ManualResourcePredictionsProfile{} + default: + b = &ResourcePredictionsProfile{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalResourcePredictionsProfileUpdateClassification(rawMsg json.RawMessage) (ResourcePredictionsProfileUpdateClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ResourcePredictionsProfileUpdateClassification + switch m["kind"] { + case string(ResourcePredictionsProfileTypeAutomatic): + b = &AutomaticResourcePredictionsProfileUpdate{} + case string(ResourcePredictionsProfileTypeManual): + b = &ManualResourcePredictionsProfileUpdate{} + default: + b = &ResourcePredictionsProfileUpdate{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go new file mode 100644 index 000000000000..6d6b234c092a --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go @@ -0,0 +1,460 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PoolsClient contains the methods for the Pools group. +// Don't use this type directly, use NewPoolsClient() instead. +type PoolsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPoolsClient creates a new instance of PoolsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PoolsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PoolsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Name of the pool. It needs to be globally unique. +// - resource - Resource create parameters. +// - options - PoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the PoolsClient.BeginCreateOrUpdate +// method. +func (client *PoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, poolName string, resource Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PoolsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, poolName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PoolsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-04-preview +func (client *PoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, poolName string, resource Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PoolsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, poolName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, resource Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Name of the pool. It needs to be globally unique. +// - options - PoolsClientBeginDeleteOptions contains the optional parameters for the PoolsClient.BeginDelete method. +func (client *PoolsClient) BeginDelete(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientBeginDeleteOptions) (*runtime.Poller[PoolsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, poolName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PoolsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-04-preview +func (client *PoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PoolsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, poolName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Name of the pool. It needs to be globally unique. +// - options - PoolsClientGetOptions contains the optional parameters for the PoolsClient.Get method. +func (client *PoolsClient) Get(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientGetOptions) (PoolsClientGetResponse, error) { + var err error + const operationName = "PoolsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, poolName, options) + if err != nil { + return PoolsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PoolsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PoolsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PoolsClient) getHandleResponse(resp *http.Response) (PoolsClientGetResponse, error) { + result := PoolsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Pool); err != nil { + return PoolsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Pool resources by resource group +// +// Generated from API version 2024-04-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - PoolsClientListByResourceGroupOptions contains the optional parameters for the PoolsClient.NewListByResourceGroupPager +// method. +func (client *PoolsClient) NewListByResourceGroupPager(resourceGroupName string, options *PoolsClientListByResourceGroupOptions) *runtime.Pager[PoolsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[PoolsClientListByResourceGroupResponse]{ + More: func(page PoolsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PoolsClientListByResourceGroupResponse) (PoolsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PoolsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return PoolsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *PoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PoolsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *PoolsClient) listByResourceGroupHandleResponse(resp *http.Response) (PoolsClientListByResourceGroupResponse, error) { + result := PoolsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PoolListResult); err != nil { + return PoolsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List Pool resources by subscription ID +// +// Generated from API version 2024-04-04-preview +// - options - PoolsClientListBySubscriptionOptions contains the optional parameters for the PoolsClient.NewListBySubscriptionPager +// method. +func (client *PoolsClient) NewListBySubscriptionPager(options *PoolsClientListBySubscriptionOptions) *runtime.Pager[PoolsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[PoolsClientListBySubscriptionResponse]{ + More: func(page PoolsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PoolsClientListBySubscriptionResponse) (PoolsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PoolsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return PoolsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *PoolsClient) listBySubscriptionCreateRequest(ctx context.Context, options *PoolsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/pools" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *PoolsClient) listBySubscriptionHandleResponse(resp *http.Response) (PoolsClientListBySubscriptionResponse, error) { + result := PoolsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PoolListResult); err != nil { + return PoolsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Name of the pool. It needs to be globally unique. +// - properties - The resource properties to be updated. +// - options - PoolsClientBeginUpdateOptions contains the optional parameters for the PoolsClient.BeginUpdate method. +func (client *PoolsClient) BeginUpdate(ctx context.Context, resourceGroupName string, poolName string, properties PoolUpdate, options *PoolsClientBeginUpdateOptions) (*runtime.Poller[PoolsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, poolName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PoolsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-04-preview +func (client *PoolsClient) update(ctx context.Context, resourceGroupName string, poolName string, properties PoolUpdate, options *PoolsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PoolsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, poolName, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *PoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, properties PoolUpdate, options *PoolsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go new file mode 100644 index 000000000000..4d6fa8f44d16 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go @@ -0,0 +1,109 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ResourceDetailsClient contains the methods for the ResourceDetails group. +// Don't use this type directly, use NewResourceDetailsClient() instead. +type ResourceDetailsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewResourceDetailsClient creates a new instance of ResourceDetailsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewResourceDetailsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceDetailsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ResourceDetailsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByPoolPager - List ResourceDetailsObject resources by Pool +// +// Generated from API version 2024-04-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Name of the pool. It needs to be globally unique. +// - options - ResourceDetailsClientListByPoolOptions contains the optional parameters for the ResourceDetailsClient.NewListByPoolPager +// method. +func (client *ResourceDetailsClient) NewListByPoolPager(resourceGroupName string, poolName string, options *ResourceDetailsClientListByPoolOptions) *runtime.Pager[ResourceDetailsClientListByPoolResponse] { + return runtime.NewPager(runtime.PagingHandler[ResourceDetailsClientListByPoolResponse]{ + More: func(page ResourceDetailsClientListByPoolResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ResourceDetailsClientListByPoolResponse) (ResourceDetailsClientListByPoolResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ResourceDetailsClient.NewListByPoolPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByPoolCreateRequest(ctx, resourceGroupName, poolName, options) + }, nil) + if err != nil { + return ResourceDetailsClientListByPoolResponse{}, err + } + return client.listByPoolHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByPoolCreateRequest creates the ListByPool request. +func (client *ResourceDetailsClient) listByPoolCreateRequest(ctx context.Context, resourceGroupName string, poolName string, options *ResourceDetailsClientListByPoolOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}/resources" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByPoolHandleResponse handles the ListByPool response. +func (client *ResourceDetailsClient) listByPoolHandleResponse(resp *http.Response) (ResourceDetailsClientListByPoolResponse, error) { + result := ResourceDetailsClientListByPoolResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceDetailsObjectListResult); err != nil { + return ResourceDetailsClientListByPoolResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go new file mode 100644 index 000000000000..a536b94a7c60 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go @@ -0,0 +1,74 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +// ImageVersionsClientListByImageResponse contains the response from method ImageVersionsClient.NewListByImagePager. +type ImageVersionsClientListByImageResponse struct { + // The response of a ImageVersion list operation. + ImageVersionListResult +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} + +// PoolsClientCreateOrUpdateResponse contains the response from method PoolsClient.BeginCreateOrUpdate. +type PoolsClientCreateOrUpdateResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. + Pool +} + +// PoolsClientDeleteResponse contains the response from method PoolsClient.BeginDelete. +type PoolsClientDeleteResponse struct { + // placeholder for future response values +} + +// PoolsClientGetResponse contains the response from method PoolsClient.Get. +type PoolsClientGetResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. + Pool +} + +// PoolsClientListByResourceGroupResponse contains the response from method PoolsClient.NewListByResourceGroupPager. +type PoolsClientListByResourceGroupResponse struct { + // The response of a Pool list operation. + PoolListResult +} + +// PoolsClientListBySubscriptionResponse contains the response from method PoolsClient.NewListBySubscriptionPager. +type PoolsClientListBySubscriptionResponse struct { + // The response of a Pool list operation. + PoolListResult +} + +// PoolsClientUpdateResponse contains the response from method PoolsClient.BeginUpdate. +type PoolsClientUpdateResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. + Pool +} + +// ResourceDetailsClientListByPoolResponse contains the response from method ResourceDetailsClient.NewListByPoolPager. +type ResourceDetailsClientListByPoolResponse struct { + // The response of a ResourceDetailsObject list operation. + ResourceDetailsObjectListResult +} + +// SKUClientListByLocationResponse contains the response from method SKUClient.NewListByLocationPager. +type SKUClientListByLocationResponse struct { + // The response of a ResourceSku list operation. + ResourceSKUListResult +} + +// SubscriptionUsagesClientListByLocationResponse contains the response from method SubscriptionUsagesClient.NewListByLocationPager. +type SubscriptionUsagesClientListByLocationResponse struct { + // The response of a Quota list operation. + QuotaListResult +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go new file mode 100644 index 000000000000..1f0bb1a197c0 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SKUClient contains the methods for the SKU group. +// Don't use this type directly, use NewSKUClient() instead. +type SKUClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSKUClient creates a new instance of SKUClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSKUClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SKUClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SKUClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByLocationPager - List ResourceSku resources by subscription ID +// +// Generated from API version 2024-04-04-preview +// - locationName - Name of the location. +// - options - SKUClientListByLocationOptions contains the optional parameters for the SKUClient.NewListByLocationPager method. +func (client *SKUClient) NewListByLocationPager(locationName string, options *SKUClientListByLocationOptions) *runtime.Pager[SKUClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[SKUClientListByLocationResponse]{ + More: func(page SKUClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SKUClientListByLocationResponse) (SKUClientListByLocationResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SKUClient.NewListByLocationPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByLocationCreateRequest(ctx, locationName, options) + }, nil) + if err != nil { + return SKUClientListByLocationResponse{}, err + } + return client.listByLocationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *SKUClient) listByLocationCreateRequest(ctx context.Context, locationName string, options *SKUClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/locations/{locationName}/skus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *SKUClient) listByLocationHandleResponse(resp *http.Response) (SKUClientListByLocationResponse, error) { + result := SKUClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceSKUListResult); err != nil { + return SKUClientListByLocationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go new file mode 100644 index 000000000000..52c4e21bf58b --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SubscriptionUsagesClient contains the methods for the SubscriptionUsages group. +// Don't use this type directly, use NewSubscriptionUsagesClient() instead. +type SubscriptionUsagesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSubscriptionUsagesClient creates a new instance of SubscriptionUsagesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSubscriptionUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SubscriptionUsagesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SubscriptionUsagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByLocationPager - List Quota resources by subscription ID +// +// Generated from API version 2024-04-04-preview +// - locationName - Name of the location. +// - options - SubscriptionUsagesClientListByLocationOptions contains the optional parameters for the SubscriptionUsagesClient.NewListByLocationPager +// method. +func (client *SubscriptionUsagesClient) NewListByLocationPager(locationName string, options *SubscriptionUsagesClientListByLocationOptions) *runtime.Pager[SubscriptionUsagesClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[SubscriptionUsagesClientListByLocationResponse]{ + More: func(page SubscriptionUsagesClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SubscriptionUsagesClientListByLocationResponse) (SubscriptionUsagesClientListByLocationResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SubscriptionUsagesClient.NewListByLocationPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByLocationCreateRequest(ctx, locationName, options) + }, nil) + if err != nil { + return SubscriptionUsagesClientListByLocationResponse{}, err + } + return client.listByLocationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *SubscriptionUsagesClient) listByLocationCreateRequest(ctx context.Context, locationName string, options *SubscriptionUsagesClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/locations/{locationName}/usages" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *SubscriptionUsagesClient) listByLocationHandleResponse(resp *http.Response) (SubscriptionUsagesClientListByLocationResponse, error) { + result := SubscriptionUsagesClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.QuotaListResult); err != nil { + return SubscriptionUsagesClientListByLocationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/time_rfc3339.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/time_rfc3339.go new file mode 100644 index 000000000000..4f8725b55a52 --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevopsinfrastructure + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/CHANGELOG.md b/sdk/resourcemanager/oracledatabase/armoracledatabase/CHANGELOG.md new file mode 100644 index 000000000000..c84744b7ec3e --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 0.1.0 (2024-05-14) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/LICENSE.txt b/sdk/resourcemanager/oracledatabase/armoracledatabase/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/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/oracledatabase/armoracledatabase/README.md b/sdk/resourcemanager/oracledatabase/armoracledatabase/README.md new file mode 100644 index 000000000000..73cd1943c7c0 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/README.md @@ -0,0 +1,92 @@ +# Azure Oracledatabase Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase) + +The `armoracledatabase` module provides operations for working with Azure Oracledatabase. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/oracledatabase/armoracledatabase) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Oracledatabase module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Oracledatabase. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Oracledatabase module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armoracledatabase.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armoracledatabase.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewAutonomousDatabaseBackupsClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Oracledatabase` 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/oracledatabase/armoracledatabase/autonomousdatabasebackups_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client.go new file mode 100644 index 000000000000..9f9983b4d5eb --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client.go @@ -0,0 +1,433 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AutonomousDatabaseBackupsClient contains the methods for the AutonomousDatabaseBackups group. +// Don't use this type directly, use NewAutonomousDatabaseBackupsClient() instead. +type AutonomousDatabaseBackupsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAutonomousDatabaseBackupsClient creates a new instance of AutonomousDatabaseBackupsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAutonomousDatabaseBackupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutonomousDatabaseBackupsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AutonomousDatabaseBackupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a AutonomousDatabaseBackup +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autonomousdatabasename - The database name. +// - adbbackupid - AutonomousDatabaseBackup id +// - resource - Resource create parameters. +// - options - AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.BeginCreateOrUpdate +// method. +func (client *AutonomousDatabaseBackupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, resource AutonomousDatabaseBackup, options *AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AutonomousDatabaseBackupsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, autonomousdatabasename, adbbackupid, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabaseBackupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AutonomousDatabaseBackupsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a AutonomousDatabaseBackup +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *AutonomousDatabaseBackupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, resource AutonomousDatabaseBackup, options *AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AutonomousDatabaseBackupsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, autonomousdatabasename, adbbackupid, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AutonomousDatabaseBackupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, resource AutonomousDatabaseBackup, options *AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}" + 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 autonomousdatabasename == "" { + return nil, errors.New("parameter autonomousdatabasename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdatabasename}", url.PathEscape(autonomousdatabasename)) + if adbbackupid == "" { + return nil, errors.New("parameter adbbackupid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{adbbackupid}", url.PathEscape(adbbackupid)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a AutonomousDatabaseBackup +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autonomousdatabasename - The database name. +// - adbbackupid - AutonomousDatabaseBackup id +// - options - AutonomousDatabaseBackupsClientBeginDeleteOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.BeginDelete +// method. +func (client *AutonomousDatabaseBackupsClient) BeginDelete(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, options *AutonomousDatabaseBackupsClientBeginDeleteOptions) (*runtime.Poller[AutonomousDatabaseBackupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, autonomousdatabasename, adbbackupid, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabaseBackupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AutonomousDatabaseBackupsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a AutonomousDatabaseBackup +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *AutonomousDatabaseBackupsClient) deleteOperation(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, options *AutonomousDatabaseBackupsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "AutonomousDatabaseBackupsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, autonomousdatabasename, adbbackupid, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AutonomousDatabaseBackupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, options *AutonomousDatabaseBackupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}" + 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 autonomousdatabasename == "" { + return nil, errors.New("parameter autonomousdatabasename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdatabasename}", url.PathEscape(autonomousdatabasename)) + if adbbackupid == "" { + return nil, errors.New("parameter adbbackupid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{adbbackupid}", url.PathEscape(adbbackupid)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a AutonomousDatabaseBackup +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autonomousdatabasename - The database name. +// - adbbackupid - AutonomousDatabaseBackup id +// - options - AutonomousDatabaseBackupsClientGetOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.Get +// method. +func (client *AutonomousDatabaseBackupsClient) Get(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, options *AutonomousDatabaseBackupsClientGetOptions) (AutonomousDatabaseBackupsClientGetResponse, error) { + var err error + const operationName = "AutonomousDatabaseBackupsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, autonomousdatabasename, adbbackupid, options) + if err != nil { + return AutonomousDatabaseBackupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AutonomousDatabaseBackupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AutonomousDatabaseBackupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AutonomousDatabaseBackupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, options *AutonomousDatabaseBackupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}" + 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 autonomousdatabasename == "" { + return nil, errors.New("parameter autonomousdatabasename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdatabasename}", url.PathEscape(autonomousdatabasename)) + if adbbackupid == "" { + return nil, errors.New("parameter adbbackupid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{adbbackupid}", url.PathEscape(adbbackupid)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AutonomousDatabaseBackupsClient) getHandleResponse(resp *http.Response) (AutonomousDatabaseBackupsClientGetResponse, error) { + result := AutonomousDatabaseBackupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutonomousDatabaseBackup); err != nil { + return AutonomousDatabaseBackupsClientGetResponse{}, err + } + return result, nil +} + +// NewListByAutonomousDatabasePager - List AutonomousDatabaseBackup resources by AutonomousDatabase +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autonomousdatabasename - The database name. +// - options - AutonomousDatabaseBackupsClientListByAutonomousDatabaseOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager +// method. +func (client *AutonomousDatabaseBackupsClient) NewListByAutonomousDatabasePager(resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabaseBackupsClientListByAutonomousDatabaseOptions) *runtime.Pager[AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse] { + return runtime.NewPager(runtime.PagingHandler[AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse]{ + More: func(page AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse) (AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByAutonomousDatabaseCreateRequest(ctx, resourceGroupName, autonomousdatabasename, options) + }, nil) + if err != nil { + return AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse{}, err + } + return client.listByAutonomousDatabaseHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByAutonomousDatabaseCreateRequest creates the ListByAutonomousDatabase request. +func (client *AutonomousDatabaseBackupsClient) listByAutonomousDatabaseCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabaseBackupsClientListByAutonomousDatabaseOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups" + 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 autonomousdatabasename == "" { + return nil, errors.New("parameter autonomousdatabasename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdatabasename}", url.PathEscape(autonomousdatabasename)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByAutonomousDatabaseHandleResponse handles the ListByAutonomousDatabase response. +func (client *AutonomousDatabaseBackupsClient) listByAutonomousDatabaseHandleResponse(resp *http.Response) (AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse, error) { + result := AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutonomousDatabaseBackupListResult); err != nil { + return AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a AutonomousDatabaseBackup +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autonomousdatabasename - The database name. +// - adbbackupid - AutonomousDatabaseBackup id +// - properties - The resource properties to be updated. +// - options - AutonomousDatabaseBackupsClientBeginUpdateOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.BeginUpdate +// method. +func (client *AutonomousDatabaseBackupsClient) BeginUpdate(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, properties AutonomousDatabaseBackupUpdate, options *AutonomousDatabaseBackupsClientBeginUpdateOptions) (*runtime.Poller[AutonomousDatabaseBackupsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, autonomousdatabasename, adbbackupid, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabaseBackupsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AutonomousDatabaseBackupsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a AutonomousDatabaseBackup +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *AutonomousDatabaseBackupsClient) update(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, properties AutonomousDatabaseBackupUpdate, options *AutonomousDatabaseBackupsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AutonomousDatabaseBackupsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, autonomousdatabasename, adbbackupid, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *AutonomousDatabaseBackupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, properties AutonomousDatabaseBackupUpdate, options *AutonomousDatabaseBackupsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}" + 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 autonomousdatabasename == "" { + return nil, errors.New("parameter autonomousdatabasename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdatabasename}", url.PathEscape(autonomousdatabasename)) + if adbbackupid == "" { + return nil, errors.New("parameter adbbackupid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{adbbackupid}", url.PathEscape(adbbackupid)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client.go new file mode 100644 index 000000000000..9c5649cb42f8 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client.go @@ -0,0 +1,169 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AutonomousDatabaseCharacterSetsClient contains the methods for the AutonomousDatabaseCharacterSets group. +// Don't use this type directly, use NewAutonomousDatabaseCharacterSetsClient() instead. +type AutonomousDatabaseCharacterSetsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAutonomousDatabaseCharacterSetsClient creates a new instance of AutonomousDatabaseCharacterSetsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAutonomousDatabaseCharacterSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutonomousDatabaseCharacterSetsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AutonomousDatabaseCharacterSetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a AutonomousDatabaseCharacterSet +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - adbscharsetname - AutonomousDatabaseCharacterSet name +// - options - AutonomousDatabaseCharacterSetsClientGetOptions contains the optional parameters for the AutonomousDatabaseCharacterSetsClient.Get +// method. +func (client *AutonomousDatabaseCharacterSetsClient) Get(ctx context.Context, location string, adbscharsetname string, options *AutonomousDatabaseCharacterSetsClientGetOptions) (AutonomousDatabaseCharacterSetsClientGetResponse, error) { + var err error + const operationName = "AutonomousDatabaseCharacterSetsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, adbscharsetname, options) + if err != nil { + return AutonomousDatabaseCharacterSetsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AutonomousDatabaseCharacterSetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AutonomousDatabaseCharacterSetsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AutonomousDatabaseCharacterSetsClient) getCreateRequest(ctx context.Context, location string, adbscharsetname string, options *AutonomousDatabaseCharacterSetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseCharacterSets/{adbscharsetname}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if adbscharsetname == "" { + return nil, errors.New("parameter adbscharsetname cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{adbscharsetname}", url.PathEscape(adbscharsetname)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AutonomousDatabaseCharacterSetsClient) getHandleResponse(resp *http.Response) (AutonomousDatabaseCharacterSetsClientGetResponse, error) { + result := AutonomousDatabaseCharacterSetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutonomousDatabaseCharacterSet); err != nil { + return AutonomousDatabaseCharacterSetsClientGetResponse{}, err + } + return result, nil +} + +// NewListByLocationPager - List AutonomousDatabaseCharacterSet resources by Location +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - options - AutonomousDatabaseCharacterSetsClientListByLocationOptions contains the optional parameters for the AutonomousDatabaseCharacterSetsClient.NewListByLocationPager +// method. +func (client *AutonomousDatabaseCharacterSetsClient) NewListByLocationPager(location string, options *AutonomousDatabaseCharacterSetsClientListByLocationOptions) *runtime.Pager[AutonomousDatabaseCharacterSetsClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[AutonomousDatabaseCharacterSetsClientListByLocationResponse]{ + More: func(page AutonomousDatabaseCharacterSetsClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AutonomousDatabaseCharacterSetsClientListByLocationResponse) (AutonomousDatabaseCharacterSetsClientListByLocationResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutonomousDatabaseCharacterSetsClient.NewListByLocationPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByLocationCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return AutonomousDatabaseCharacterSetsClientListByLocationResponse{}, err + } + return client.listByLocationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *AutonomousDatabaseCharacterSetsClient) listByLocationCreateRequest(ctx context.Context, location string, options *AutonomousDatabaseCharacterSetsClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseCharacterSets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *AutonomousDatabaseCharacterSetsClient) listByLocationHandleResponse(resp *http.Response) (AutonomousDatabaseCharacterSetsClientListByLocationResponse, error) { + result := AutonomousDatabaseCharacterSetsClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutonomousDatabaseCharacterSetListResult); err != nil { + return AutonomousDatabaseCharacterSetsClientListByLocationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client.go new file mode 100644 index 000000000000..28cdf787b252 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client.go @@ -0,0 +1,169 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AutonomousDatabaseNationalCharacterSetsClient contains the methods for the AutonomousDatabaseNationalCharacterSets group. +// Don't use this type directly, use NewAutonomousDatabaseNationalCharacterSetsClient() instead. +type AutonomousDatabaseNationalCharacterSetsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAutonomousDatabaseNationalCharacterSetsClient creates a new instance of AutonomousDatabaseNationalCharacterSetsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAutonomousDatabaseNationalCharacterSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutonomousDatabaseNationalCharacterSetsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AutonomousDatabaseNationalCharacterSetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a AutonomousDatabaseNationalCharacterSet +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - adbsncharsetname - AutonomousDatabaseNationalCharacterSets name +// - options - AutonomousDatabaseNationalCharacterSetsClientGetOptions contains the optional parameters for the AutonomousDatabaseNationalCharacterSetsClient.Get +// method. +func (client *AutonomousDatabaseNationalCharacterSetsClient) Get(ctx context.Context, location string, adbsncharsetname string, options *AutonomousDatabaseNationalCharacterSetsClientGetOptions) (AutonomousDatabaseNationalCharacterSetsClientGetResponse, error) { + var err error + const operationName = "AutonomousDatabaseNationalCharacterSetsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, adbsncharsetname, options) + if err != nil { + return AutonomousDatabaseNationalCharacterSetsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AutonomousDatabaseNationalCharacterSetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AutonomousDatabaseNationalCharacterSetsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AutonomousDatabaseNationalCharacterSetsClient) getCreateRequest(ctx context.Context, location string, adbsncharsetname string, options *AutonomousDatabaseNationalCharacterSetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseNationalCharacterSets/{adbsncharsetname}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if adbsncharsetname == "" { + return nil, errors.New("parameter adbsncharsetname cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{adbsncharsetname}", url.PathEscape(adbsncharsetname)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AutonomousDatabaseNationalCharacterSetsClient) getHandleResponse(resp *http.Response) (AutonomousDatabaseNationalCharacterSetsClientGetResponse, error) { + result := AutonomousDatabaseNationalCharacterSetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutonomousDatabaseNationalCharacterSet); err != nil { + return AutonomousDatabaseNationalCharacterSetsClientGetResponse{}, err + } + return result, nil +} + +// NewListByLocationPager - List AutonomousDatabaseNationalCharacterSet resources by Location +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - options - AutonomousDatabaseNationalCharacterSetsClientListByLocationOptions contains the optional parameters for the AutonomousDatabaseNationalCharacterSetsClient.NewListByLocationPager +// method. +func (client *AutonomousDatabaseNationalCharacterSetsClient) NewListByLocationPager(location string, options *AutonomousDatabaseNationalCharacterSetsClientListByLocationOptions) *runtime.Pager[AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse]{ + More: func(page AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse) (AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutonomousDatabaseNationalCharacterSetsClient.NewListByLocationPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByLocationCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse{}, err + } + return client.listByLocationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *AutonomousDatabaseNationalCharacterSetsClient) listByLocationCreateRequest(ctx context.Context, location string, options *AutonomousDatabaseNationalCharacterSetsClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseNationalCharacterSets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *AutonomousDatabaseNationalCharacterSetsClient) listByLocationHandleResponse(resp *http.Response) (AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse, error) { + result := AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutonomousDatabaseNationalCharacterSetListResult); err != nil { + return AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client.go new file mode 100644 index 000000000000..b52fb3ffa423 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client.go @@ -0,0 +1,693 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AutonomousDatabasesClient contains the methods for the AutonomousDatabases group. +// Don't use this type directly, use NewAutonomousDatabasesClient() instead. +type AutonomousDatabasesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAutonomousDatabasesClient creates a new instance of AutonomousDatabasesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAutonomousDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutonomousDatabasesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AutonomousDatabasesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a AutonomousDatabase +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autonomousdatabasename - The database name. +// - resource - Resource create parameters. +// - options - AutonomousDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the AutonomousDatabasesClient.BeginCreateOrUpdate +// method. +func (client *AutonomousDatabasesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, autonomousdatabasename string, resource AutonomousDatabase, options *AutonomousDatabasesClientBeginCreateOrUpdateOptions) (*runtime.Poller[AutonomousDatabasesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, autonomousdatabasename, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabasesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AutonomousDatabasesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a AutonomousDatabase +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *AutonomousDatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, autonomousdatabasename string, resource AutonomousDatabase, options *AutonomousDatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AutonomousDatabasesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, autonomousdatabasename, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AutonomousDatabasesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, resource AutonomousDatabase, options *AutonomousDatabasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}" + 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 autonomousdatabasename == "" { + return nil, errors.New("parameter autonomousdatabasename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdatabasename}", url.PathEscape(autonomousdatabasename)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a AutonomousDatabase +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autonomousdatabasename - The database name. +// - options - AutonomousDatabasesClientBeginDeleteOptions contains the optional parameters for the AutonomousDatabasesClient.BeginDelete +// method. +func (client *AutonomousDatabasesClient) BeginDelete(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabasesClientBeginDeleteOptions) (*runtime.Poller[AutonomousDatabasesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, autonomousdatabasename, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabasesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AutonomousDatabasesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a AutonomousDatabase +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *AutonomousDatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabasesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "AutonomousDatabasesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, autonomousdatabasename, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AutonomousDatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabasesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}" + 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 autonomousdatabasename == "" { + return nil, errors.New("parameter autonomousdatabasename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdatabasename}", url.PathEscape(autonomousdatabasename)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginFailover - Perform failover action on Autonomous Database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autonomousdatabasename - The database name. +// - body - The content of the action request +// - options - AutonomousDatabasesClientBeginFailoverOptions contains the optional parameters for the AutonomousDatabasesClient.BeginFailover +// method. +func (client *AutonomousDatabasesClient) BeginFailover(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, options *AutonomousDatabasesClientBeginFailoverOptions) (*runtime.Poller[AutonomousDatabasesClientFailoverResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.failover(ctx, resourceGroupName, autonomousdatabasename, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabasesClientFailoverResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AutonomousDatabasesClientFailoverResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Failover - Perform failover action on Autonomous Database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *AutonomousDatabasesClient) failover(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, options *AutonomousDatabasesClientBeginFailoverOptions) (*http.Response, error) { + var err error + const operationName = "AutonomousDatabasesClient.BeginFailover" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.failoverCreateRequest(ctx, resourceGroupName, autonomousdatabasename, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// failoverCreateRequest creates the Failover request. +func (client *AutonomousDatabasesClient) failoverCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, options *AutonomousDatabasesClientBeginFailoverOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/failover" + 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 autonomousdatabasename == "" { + return nil, errors.New("parameter autonomousdatabasename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdatabasename}", url.PathEscape(autonomousdatabasename)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// GenerateWallet - Generate wallet action on Autonomous Database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autonomousdatabasename - The database name. +// - body - The content of the action request +// - options - AutonomousDatabasesClientGenerateWalletOptions contains the optional parameters for the AutonomousDatabasesClient.GenerateWallet +// method. +func (client *AutonomousDatabasesClient) GenerateWallet(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body GenerateAutonomousDatabaseWalletDetails, options *AutonomousDatabasesClientGenerateWalletOptions) (AutonomousDatabasesClientGenerateWalletResponse, error) { + var err error + const operationName = "AutonomousDatabasesClient.GenerateWallet" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generateWalletCreateRequest(ctx, resourceGroupName, autonomousdatabasename, body, options) + if err != nil { + return AutonomousDatabasesClientGenerateWalletResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AutonomousDatabasesClientGenerateWalletResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AutonomousDatabasesClientGenerateWalletResponse{}, err + } + resp, err := client.generateWalletHandleResponse(httpResp) + return resp, err +} + +// generateWalletCreateRequest creates the GenerateWallet request. +func (client *AutonomousDatabasesClient) generateWalletCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body GenerateAutonomousDatabaseWalletDetails, options *AutonomousDatabasesClientGenerateWalletOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/generateWallet" + 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 autonomousdatabasename == "" { + return nil, errors.New("parameter autonomousdatabasename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdatabasename}", url.PathEscape(autonomousdatabasename)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// generateWalletHandleResponse handles the GenerateWallet response. +func (client *AutonomousDatabasesClient) generateWalletHandleResponse(resp *http.Response) (AutonomousDatabasesClientGenerateWalletResponse, error) { + result := AutonomousDatabasesClientGenerateWalletResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutonomousDatabaseWalletFile); err != nil { + return AutonomousDatabasesClientGenerateWalletResponse{}, err + } + return result, nil +} + +// Get - Get a AutonomousDatabase +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autonomousdatabasename - The database name. +// - options - AutonomousDatabasesClientGetOptions contains the optional parameters for the AutonomousDatabasesClient.Get method. +func (client *AutonomousDatabasesClient) Get(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabasesClientGetOptions) (AutonomousDatabasesClientGetResponse, error) { + var err error + const operationName = "AutonomousDatabasesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, autonomousdatabasename, options) + if err != nil { + return AutonomousDatabasesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AutonomousDatabasesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AutonomousDatabasesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AutonomousDatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabasesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}" + 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 autonomousdatabasename == "" { + return nil, errors.New("parameter autonomousdatabasename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdatabasename}", url.PathEscape(autonomousdatabasename)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AutonomousDatabasesClient) getHandleResponse(resp *http.Response) (AutonomousDatabasesClientGetResponse, error) { + result := AutonomousDatabasesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutonomousDatabase); err != nil { + return AutonomousDatabasesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List AutonomousDatabase resources by resource group +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AutonomousDatabasesClientListByResourceGroupOptions contains the optional parameters for the AutonomousDatabasesClient.NewListByResourceGroupPager +// method. +func (client *AutonomousDatabasesClient) NewListByResourceGroupPager(resourceGroupName string, options *AutonomousDatabasesClientListByResourceGroupOptions) *runtime.Pager[AutonomousDatabasesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AutonomousDatabasesClientListByResourceGroupResponse]{ + More: func(page AutonomousDatabasesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AutonomousDatabasesClientListByResourceGroupResponse) (AutonomousDatabasesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutonomousDatabasesClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return AutonomousDatabasesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *AutonomousDatabasesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AutonomousDatabasesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *AutonomousDatabasesClient) listByResourceGroupHandleResponse(resp *http.Response) (AutonomousDatabasesClientListByResourceGroupResponse, error) { + result := AutonomousDatabasesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutonomousDatabaseListResult); err != nil { + return AutonomousDatabasesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List AutonomousDatabase resources by subscription ID +// +// Generated from API version 2023-09-01-preview +// - options - AutonomousDatabasesClientListBySubscriptionOptions contains the optional parameters for the AutonomousDatabasesClient.NewListBySubscriptionPager +// method. +func (client *AutonomousDatabasesClient) NewListBySubscriptionPager(options *AutonomousDatabasesClientListBySubscriptionOptions) *runtime.Pager[AutonomousDatabasesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AutonomousDatabasesClientListBySubscriptionResponse]{ + More: func(page AutonomousDatabasesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AutonomousDatabasesClientListBySubscriptionResponse) (AutonomousDatabasesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutonomousDatabasesClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return AutonomousDatabasesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *AutonomousDatabasesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AutonomousDatabasesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/autonomousDatabases" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *AutonomousDatabasesClient) listBySubscriptionHandleResponse(resp *http.Response) (AutonomousDatabasesClientListBySubscriptionResponse, error) { + result := AutonomousDatabasesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutonomousDatabaseListResult); err != nil { + return AutonomousDatabasesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginSwitchover - Perform switchover action on Autonomous Database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autonomousdatabasename - The database name. +// - body - The content of the action request +// - options - AutonomousDatabasesClientBeginSwitchoverOptions contains the optional parameters for the AutonomousDatabasesClient.BeginSwitchover +// method. +func (client *AutonomousDatabasesClient) BeginSwitchover(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, options *AutonomousDatabasesClientBeginSwitchoverOptions) (*runtime.Poller[AutonomousDatabasesClientSwitchoverResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.switchover(ctx, resourceGroupName, autonomousdatabasename, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabasesClientSwitchoverResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AutonomousDatabasesClientSwitchoverResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Switchover - Perform switchover action on Autonomous Database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *AutonomousDatabasesClient) switchover(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, options *AutonomousDatabasesClientBeginSwitchoverOptions) (*http.Response, error) { + var err error + const operationName = "AutonomousDatabasesClient.BeginSwitchover" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.switchoverCreateRequest(ctx, resourceGroupName, autonomousdatabasename, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// switchoverCreateRequest creates the Switchover request. +func (client *AutonomousDatabasesClient) switchoverCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, options *AutonomousDatabasesClientBeginSwitchoverOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/switchover" + 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 autonomousdatabasename == "" { + return nil, errors.New("parameter autonomousdatabasename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdatabasename}", url.PathEscape(autonomousdatabasename)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdate - Update a AutonomousDatabase +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autonomousdatabasename - The database name. +// - properties - The resource properties to be updated. +// - options - AutonomousDatabasesClientBeginUpdateOptions contains the optional parameters for the AutonomousDatabasesClient.BeginUpdate +// method. +func (client *AutonomousDatabasesClient) BeginUpdate(ctx context.Context, resourceGroupName string, autonomousdatabasename string, properties AutonomousDatabaseUpdate, options *AutonomousDatabasesClientBeginUpdateOptions) (*runtime.Poller[AutonomousDatabasesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, autonomousdatabasename, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabasesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AutonomousDatabasesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a AutonomousDatabase +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *AutonomousDatabasesClient) update(ctx context.Context, resourceGroupName string, autonomousdatabasename string, properties AutonomousDatabaseUpdate, options *AutonomousDatabasesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AutonomousDatabasesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, autonomousdatabasename, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *AutonomousDatabasesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, properties AutonomousDatabaseUpdate, options *AutonomousDatabasesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}" + 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 autonomousdatabasename == "" { + return nil, errors.New("parameter autonomousdatabasename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdatabasename}", url.PathEscape(autonomousdatabasename)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client.go new file mode 100644 index 000000000000..e3608622c057 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client.go @@ -0,0 +1,169 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AutonomousDatabaseVersionsClient contains the methods for the AutonomousDatabaseVersions group. +// Don't use this type directly, use NewAutonomousDatabaseVersionsClient() instead. +type AutonomousDatabaseVersionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAutonomousDatabaseVersionsClient creates a new instance of AutonomousDatabaseVersionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAutonomousDatabaseVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutonomousDatabaseVersionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AutonomousDatabaseVersionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a AutonomousDbVersion +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - autonomousdbversionsname - AutonomousDbVersion name +// - options - AutonomousDatabaseVersionsClientGetOptions contains the optional parameters for the AutonomousDatabaseVersionsClient.Get +// method. +func (client *AutonomousDatabaseVersionsClient) Get(ctx context.Context, location string, autonomousdbversionsname string, options *AutonomousDatabaseVersionsClientGetOptions) (AutonomousDatabaseVersionsClientGetResponse, error) { + var err error + const operationName = "AutonomousDatabaseVersionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, autonomousdbversionsname, options) + if err != nil { + return AutonomousDatabaseVersionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AutonomousDatabaseVersionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AutonomousDatabaseVersionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AutonomousDatabaseVersionsClient) getCreateRequest(ctx context.Context, location string, autonomousdbversionsname string, options *AutonomousDatabaseVersionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDbVersions/{autonomousdbversionsname}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if autonomousdbversionsname == "" { + return nil, errors.New("parameter autonomousdbversionsname cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdbversionsname}", url.PathEscape(autonomousdbversionsname)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AutonomousDatabaseVersionsClient) getHandleResponse(resp *http.Response) (AutonomousDatabaseVersionsClientGetResponse, error) { + result := AutonomousDatabaseVersionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutonomousDbVersion); err != nil { + return AutonomousDatabaseVersionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByLocationPager - List AutonomousDbVersion resources by Location +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - options - AutonomousDatabaseVersionsClientListByLocationOptions contains the optional parameters for the AutonomousDatabaseVersionsClient.NewListByLocationPager +// method. +func (client *AutonomousDatabaseVersionsClient) NewListByLocationPager(location string, options *AutonomousDatabaseVersionsClientListByLocationOptions) *runtime.Pager[AutonomousDatabaseVersionsClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[AutonomousDatabaseVersionsClientListByLocationResponse]{ + More: func(page AutonomousDatabaseVersionsClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AutonomousDatabaseVersionsClientListByLocationResponse) (AutonomousDatabaseVersionsClientListByLocationResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutonomousDatabaseVersionsClient.NewListByLocationPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByLocationCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return AutonomousDatabaseVersionsClientListByLocationResponse{}, err + } + return client.listByLocationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *AutonomousDatabaseVersionsClient) listByLocationCreateRequest(ctx context.Context, location string, options *AutonomousDatabaseVersionsClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDbVersions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *AutonomousDatabaseVersionsClient) listByLocationHandleResponse(resp *http.Response) (AutonomousDatabaseVersionsClientListByLocationResponse, error) { + result := AutonomousDatabaseVersionsClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutonomousDbVersionListResult); err != nil { + return AutonomousDatabaseVersionsClientListByLocationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autorest.md b/sdk/resourcemanager/oracledatabase/armoracledatabase/autorest.md new file mode 100644 index 000000000000..1f01c51b5116 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/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/oracle/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/oracle/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/oracledatabase/armoracledatabase/build.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/build.go new file mode 100644 index 000000000000..4aad56d9bf48 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/oracledatabase/armoracledatabase + +package armoracledatabase diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/ci.yml b/sdk/resourcemanager/oracledatabase/armoracledatabase/ci.yml new file mode 100644 index 000000000000..1bd227ffc742 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/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/oracledatabase/armoracledatabase/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/oracledatabase/armoracledatabase/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/oracledatabase/armoracledatabase' diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/client_factory.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/client_factory.go new file mode 100644 index 000000000000..71429b6831f4 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/client_factory.go @@ -0,0 +1,164 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewAutonomousDatabaseBackupsClient creates a new instance of AutonomousDatabaseBackupsClient. +func (c *ClientFactory) NewAutonomousDatabaseBackupsClient() *AutonomousDatabaseBackupsClient { + return &AutonomousDatabaseBackupsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewAutonomousDatabaseCharacterSetsClient creates a new instance of AutonomousDatabaseCharacterSetsClient. +func (c *ClientFactory) NewAutonomousDatabaseCharacterSetsClient() *AutonomousDatabaseCharacterSetsClient { + return &AutonomousDatabaseCharacterSetsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewAutonomousDatabaseNationalCharacterSetsClient creates a new instance of AutonomousDatabaseNationalCharacterSetsClient. +func (c *ClientFactory) NewAutonomousDatabaseNationalCharacterSetsClient() *AutonomousDatabaseNationalCharacterSetsClient { + return &AutonomousDatabaseNationalCharacterSetsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewAutonomousDatabaseVersionsClient creates a new instance of AutonomousDatabaseVersionsClient. +func (c *ClientFactory) NewAutonomousDatabaseVersionsClient() *AutonomousDatabaseVersionsClient { + return &AutonomousDatabaseVersionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewAutonomousDatabasesClient creates a new instance of AutonomousDatabasesClient. +func (c *ClientFactory) NewAutonomousDatabasesClient() *AutonomousDatabasesClient { + return &AutonomousDatabasesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewCloudExadataInfrastructuresClient creates a new instance of CloudExadataInfrastructuresClient. +func (c *ClientFactory) NewCloudExadataInfrastructuresClient() *CloudExadataInfrastructuresClient { + return &CloudExadataInfrastructuresClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewCloudVMClustersClient creates a new instance of CloudVMClustersClient. +func (c *ClientFactory) NewCloudVMClustersClient() *CloudVMClustersClient { + return &CloudVMClustersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewDNSPrivateViewsClient creates a new instance of DNSPrivateViewsClient. +func (c *ClientFactory) NewDNSPrivateViewsClient() *DNSPrivateViewsClient { + return &DNSPrivateViewsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewDNSPrivateZonesClient creates a new instance of DNSPrivateZonesClient. +func (c *ClientFactory) NewDNSPrivateZonesClient() *DNSPrivateZonesClient { + return &DNSPrivateZonesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewDbNodesClient creates a new instance of DbNodesClient. +func (c *ClientFactory) NewDbNodesClient() *DbNodesClient { + return &DbNodesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewDbServersClient creates a new instance of DbServersClient. +func (c *ClientFactory) NewDbServersClient() *DbServersClient { + return &DbServersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewDbSystemShapesClient creates a new instance of DbSystemShapesClient. +func (c *ClientFactory) NewDbSystemShapesClient() *DbSystemShapesClient { + return &DbSystemShapesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewGiVersionsClient creates a new instance of GiVersionsClient. +func (c *ClientFactory) NewGiVersionsClient() *GiVersionsClient { + return &GiVersionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewOracleSubscriptionsClient creates a new instance of OracleSubscriptionsClient. +func (c *ClientFactory) NewOracleSubscriptionsClient() *OracleSubscriptionsClient { + return &OracleSubscriptionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewVirtualNetworkAddressesClient creates a new instance of VirtualNetworkAddressesClient. +func (c *ClientFactory) NewVirtualNetworkAddressesClient() *VirtualNetworkAddressesClient { + return &VirtualNetworkAddressesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client.go new file mode 100644 index 000000000000..89bdef566d47 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client.go @@ -0,0 +1,540 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CloudExadataInfrastructuresClient contains the methods for the CloudExadataInfrastructures group. +// Don't use this type directly, use NewCloudExadataInfrastructuresClient() instead. +type CloudExadataInfrastructuresClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCloudExadataInfrastructuresClient creates a new instance of CloudExadataInfrastructuresClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCloudExadataInfrastructuresClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudExadataInfrastructuresClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CloudExadataInfrastructuresClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginAddStorageCapacity - Perform add storage capacity on exadata infra +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudexadatainfrastructurename - CloudExadataInfrastructure name +// - options - CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginAddStorageCapacity +// method. +func (client *CloudExadataInfrastructuresClient) BeginAddStorageCapacity(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions) (*runtime.Poller[CloudExadataInfrastructuresClientAddStorageCapacityResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.addStorageCapacity(ctx, resourceGroupName, cloudexadatainfrastructurename, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudExadataInfrastructuresClientAddStorageCapacityResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudExadataInfrastructuresClientAddStorageCapacityResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// AddStorageCapacity - Perform add storage capacity on exadata infra +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *CloudExadataInfrastructuresClient) addStorageCapacity(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions) (*http.Response, error) { + var err error + const operationName = "CloudExadataInfrastructuresClient.BeginAddStorageCapacity" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.addStorageCapacityCreateRequest(ctx, resourceGroupName, cloudexadatainfrastructurename, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// addStorageCapacityCreateRequest creates the AddStorageCapacity request. +func (client *CloudExadataInfrastructuresClient) addStorageCapacityCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}/addStorageCapacity" + 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 cloudexadatainfrastructurename == "" { + return nil, errors.New("parameter cloudexadatainfrastructurename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudexadatainfrastructurename}", url.PathEscape(cloudexadatainfrastructurename)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginCreateOrUpdate - Create a CloudExadataInfrastructure +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudexadatainfrastructurename - CloudExadataInfrastructure name +// - resource - Resource create parameters. +// - options - CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginCreateOrUpdate +// method. +func (client *CloudExadataInfrastructuresClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, resource CloudExadataInfrastructure, options *CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions) (*runtime.Poller[CloudExadataInfrastructuresClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, cloudexadatainfrastructurename, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudExadataInfrastructuresClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudExadataInfrastructuresClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a CloudExadataInfrastructure +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *CloudExadataInfrastructuresClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, resource CloudExadataInfrastructure, options *CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CloudExadataInfrastructuresClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, cloudexadatainfrastructurename, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CloudExadataInfrastructuresClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, resource CloudExadataInfrastructure, options *CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}" + 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 cloudexadatainfrastructurename == "" { + return nil, errors.New("parameter cloudexadatainfrastructurename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudexadatainfrastructurename}", url.PathEscape(cloudexadatainfrastructurename)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a CloudExadataInfrastructure +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudexadatainfrastructurename - CloudExadataInfrastructure name +// - options - CloudExadataInfrastructuresClientBeginDeleteOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginDelete +// method. +func (client *CloudExadataInfrastructuresClient) BeginDelete(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientBeginDeleteOptions) (*runtime.Poller[CloudExadataInfrastructuresClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, cloudexadatainfrastructurename, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudExadataInfrastructuresClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudExadataInfrastructuresClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a CloudExadataInfrastructure +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *CloudExadataInfrastructuresClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CloudExadataInfrastructuresClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, cloudexadatainfrastructurename, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CloudExadataInfrastructuresClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}" + 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 cloudexadatainfrastructurename == "" { + return nil, errors.New("parameter cloudexadatainfrastructurename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudexadatainfrastructurename}", url.PathEscape(cloudexadatainfrastructurename)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a CloudExadataInfrastructure +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudexadatainfrastructurename - CloudExadataInfrastructure name +// - options - CloudExadataInfrastructuresClientGetOptions contains the optional parameters for the CloudExadataInfrastructuresClient.Get +// method. +func (client *CloudExadataInfrastructuresClient) Get(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientGetOptions) (CloudExadataInfrastructuresClientGetResponse, error) { + var err error + const operationName = "CloudExadataInfrastructuresClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, cloudexadatainfrastructurename, options) + if err != nil { + return CloudExadataInfrastructuresClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudExadataInfrastructuresClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudExadataInfrastructuresClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CloudExadataInfrastructuresClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}" + 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 cloudexadatainfrastructurename == "" { + return nil, errors.New("parameter cloudexadatainfrastructurename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudexadatainfrastructurename}", url.PathEscape(cloudexadatainfrastructurename)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CloudExadataInfrastructuresClient) getHandleResponse(resp *http.Response) (CloudExadataInfrastructuresClientGetResponse, error) { + result := CloudExadataInfrastructuresClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudExadataInfrastructure); err != nil { + return CloudExadataInfrastructuresClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List CloudExadataInfrastructure resources by resource group +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - CloudExadataInfrastructuresClientListByResourceGroupOptions contains the optional parameters for the CloudExadataInfrastructuresClient.NewListByResourceGroupPager +// method. +func (client *CloudExadataInfrastructuresClient) NewListByResourceGroupPager(resourceGroupName string, options *CloudExadataInfrastructuresClientListByResourceGroupOptions) *runtime.Pager[CloudExadataInfrastructuresClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudExadataInfrastructuresClientListByResourceGroupResponse]{ + More: func(page CloudExadataInfrastructuresClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudExadataInfrastructuresClientListByResourceGroupResponse) (CloudExadataInfrastructuresClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudExadataInfrastructuresClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return CloudExadataInfrastructuresClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *CloudExadataInfrastructuresClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CloudExadataInfrastructuresClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *CloudExadataInfrastructuresClient) listByResourceGroupHandleResponse(resp *http.Response) (CloudExadataInfrastructuresClientListByResourceGroupResponse, error) { + result := CloudExadataInfrastructuresClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudExadataInfrastructureListResult); err != nil { + return CloudExadataInfrastructuresClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List CloudExadataInfrastructure resources by subscription ID +// +// Generated from API version 2023-09-01-preview +// - options - CloudExadataInfrastructuresClientListBySubscriptionOptions contains the optional parameters for the CloudExadataInfrastructuresClient.NewListBySubscriptionPager +// method. +func (client *CloudExadataInfrastructuresClient) NewListBySubscriptionPager(options *CloudExadataInfrastructuresClientListBySubscriptionOptions) *runtime.Pager[CloudExadataInfrastructuresClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudExadataInfrastructuresClientListBySubscriptionResponse]{ + More: func(page CloudExadataInfrastructuresClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudExadataInfrastructuresClientListBySubscriptionResponse) (CloudExadataInfrastructuresClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudExadataInfrastructuresClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return CloudExadataInfrastructuresClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *CloudExadataInfrastructuresClient) listBySubscriptionCreateRequest(ctx context.Context, options *CloudExadataInfrastructuresClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/cloudExadataInfrastructures" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *CloudExadataInfrastructuresClient) listBySubscriptionHandleResponse(resp *http.Response) (CloudExadataInfrastructuresClientListBySubscriptionResponse, error) { + result := CloudExadataInfrastructuresClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudExadataInfrastructureListResult); err != nil { + return CloudExadataInfrastructuresClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a CloudExadataInfrastructure +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudexadatainfrastructurename - CloudExadataInfrastructure name +// - properties - The resource properties to be updated. +// - options - CloudExadataInfrastructuresClientBeginUpdateOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginUpdate +// method. +func (client *CloudExadataInfrastructuresClient) BeginUpdate(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, properties CloudExadataInfrastructureUpdate, options *CloudExadataInfrastructuresClientBeginUpdateOptions) (*runtime.Poller[CloudExadataInfrastructuresClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, cloudexadatainfrastructurename, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudExadataInfrastructuresClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudExadataInfrastructuresClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a CloudExadataInfrastructure +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *CloudExadataInfrastructuresClient) update(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, properties CloudExadataInfrastructureUpdate, options *CloudExadataInfrastructuresClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CloudExadataInfrastructuresClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, cloudexadatainfrastructurename, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *CloudExadataInfrastructuresClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, properties CloudExadataInfrastructureUpdate, options *CloudExadataInfrastructuresClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}" + 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 cloudexadatainfrastructurename == "" { + return nil, errors.New("parameter cloudexadatainfrastructurename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudexadatainfrastructurename}", url.PathEscape(cloudexadatainfrastructurename)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client.go new file mode 100644 index 000000000000..7ea821ef47e1 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client.go @@ -0,0 +1,693 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CloudVMClustersClient contains the methods for the CloudVMClusters group. +// Don't use this type directly, use NewCloudVMClustersClient() instead. +type CloudVMClustersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCloudVMClustersClient creates a new instance of CloudVMClustersClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCloudVMClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudVMClustersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CloudVMClustersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginAddVMs - Add VMs to the VM Cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - body - The content of the action request +// - options - CloudVMClustersClientBeginAddVMsOptions contains the optional parameters for the CloudVMClustersClient.BeginAddVMs +// method. +func (client *CloudVMClustersClient) BeginAddVMs(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, options *CloudVMClustersClientBeginAddVMsOptions) (*runtime.Poller[CloudVMClustersClientAddVMsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.addVMs(ctx, resourceGroupName, cloudvmclustername, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudVMClustersClientAddVMsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudVMClustersClientAddVMsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// AddVMs - Add VMs to the VM Cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *CloudVMClustersClient) addVMs(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, options *CloudVMClustersClientBeginAddVMsOptions) (*http.Response, error) { + var err error + const operationName = "CloudVMClustersClient.BeginAddVMs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.addVMsCreateRequest(ctx, resourceGroupName, cloudvmclustername, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// addVMsCreateRequest creates the AddVMs request. +func (client *CloudVMClustersClient) addVMsCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, options *CloudVMClustersClientBeginAddVMsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/addVms" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginCreateOrUpdate - Create a CloudVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - resource - Resource create parameters. +// - options - CloudVMClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudVMClustersClient.BeginCreateOrUpdate +// method. +func (client *CloudVMClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, cloudvmclustername string, resource CloudVMCluster, options *CloudVMClustersClientBeginCreateOrUpdateOptions) (*runtime.Poller[CloudVMClustersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, cloudvmclustername, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudVMClustersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudVMClustersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a CloudVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *CloudVMClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudvmclustername string, resource CloudVMCluster, options *CloudVMClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CloudVMClustersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, cloudvmclustername, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CloudVMClustersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, resource CloudVMCluster, options *CloudVMClustersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a CloudVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - options - CloudVMClustersClientBeginDeleteOptions contains the optional parameters for the CloudVMClustersClient.BeginDelete +// method. +func (client *CloudVMClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *CloudVMClustersClientBeginDeleteOptions) (*runtime.Poller[CloudVMClustersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, cloudvmclustername, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudVMClustersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudVMClustersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a CloudVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *CloudVMClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *CloudVMClustersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CloudVMClustersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, cloudvmclustername, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CloudVMClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *CloudVMClustersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a CloudVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - options - CloudVMClustersClientGetOptions contains the optional parameters for the CloudVMClustersClient.Get method. +func (client *CloudVMClustersClient) Get(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *CloudVMClustersClientGetOptions) (CloudVMClustersClientGetResponse, error) { + var err error + const operationName = "CloudVMClustersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, cloudvmclustername, options) + if err != nil { + return CloudVMClustersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudVMClustersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudVMClustersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CloudVMClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *CloudVMClustersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CloudVMClustersClient) getHandleResponse(resp *http.Response) (CloudVMClustersClientGetResponse, error) { + result := CloudVMClustersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudVMCluster); err != nil { + return CloudVMClustersClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List CloudVmCluster resources by resource group +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - CloudVMClustersClientListByResourceGroupOptions contains the optional parameters for the CloudVMClustersClient.NewListByResourceGroupPager +// method. +func (client *CloudVMClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *CloudVMClustersClientListByResourceGroupOptions) *runtime.Pager[CloudVMClustersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudVMClustersClientListByResourceGroupResponse]{ + More: func(page CloudVMClustersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudVMClustersClientListByResourceGroupResponse) (CloudVMClustersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudVMClustersClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return CloudVMClustersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *CloudVMClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CloudVMClustersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *CloudVMClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (CloudVMClustersClientListByResourceGroupResponse, error) { + result := CloudVMClustersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudVMClusterListResult); err != nil { + return CloudVMClustersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List CloudVmCluster resources by subscription ID +// +// Generated from API version 2023-09-01-preview +// - options - CloudVMClustersClientListBySubscriptionOptions contains the optional parameters for the CloudVMClustersClient.NewListBySubscriptionPager +// method. +func (client *CloudVMClustersClient) NewListBySubscriptionPager(options *CloudVMClustersClientListBySubscriptionOptions) *runtime.Pager[CloudVMClustersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudVMClustersClientListBySubscriptionResponse]{ + More: func(page CloudVMClustersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudVMClustersClientListBySubscriptionResponse) (CloudVMClustersClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudVMClustersClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return CloudVMClustersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *CloudVMClustersClient) listBySubscriptionCreateRequest(ctx context.Context, options *CloudVMClustersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/cloudVmClusters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *CloudVMClustersClient) listBySubscriptionHandleResponse(resp *http.Response) (CloudVMClustersClientListBySubscriptionResponse, error) { + result := CloudVMClustersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudVMClusterListResult); err != nil { + return CloudVMClustersClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// ListPrivateIPAddresses - List Private IP Addresses by the provided filter +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - body - The content of the action request +// - options - CloudVMClustersClientListPrivateIPAddressesOptions contains the optional parameters for the CloudVMClustersClient.ListPrivateIPAddresses +// method. +func (client *CloudVMClustersClient) ListPrivateIPAddresses(ctx context.Context, resourceGroupName string, cloudvmclustername string, body PrivateIPAddressesFilter, options *CloudVMClustersClientListPrivateIPAddressesOptions) (CloudVMClustersClientListPrivateIPAddressesResponse, error) { + var err error + const operationName = "CloudVMClustersClient.ListPrivateIPAddresses" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listPrivateIPAddressesCreateRequest(ctx, resourceGroupName, cloudvmclustername, body, options) + if err != nil { + return CloudVMClustersClientListPrivateIPAddressesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudVMClustersClientListPrivateIPAddressesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudVMClustersClientListPrivateIPAddressesResponse{}, err + } + resp, err := client.listPrivateIPAddressesHandleResponse(httpResp) + return resp, err +} + +// listPrivateIPAddressesCreateRequest creates the ListPrivateIPAddresses request. +func (client *CloudVMClustersClient) listPrivateIPAddressesCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, body PrivateIPAddressesFilter, options *CloudVMClustersClientListPrivateIPAddressesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/listPrivateIpAddresses" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// listPrivateIPAddressesHandleResponse handles the ListPrivateIPAddresses response. +func (client *CloudVMClustersClient) listPrivateIPAddressesHandleResponse(resp *http.Response) (CloudVMClustersClientListPrivateIPAddressesResponse, error) { + result := CloudVMClustersClientListPrivateIPAddressesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateIPAddressPropertiesArray); err != nil { + return CloudVMClustersClientListPrivateIPAddressesResponse{}, err + } + return result, nil +} + +// BeginRemoveVMs - Remove VMs from the VM Cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - body - The content of the action request +// - options - CloudVMClustersClientBeginRemoveVMsOptions contains the optional parameters for the CloudVMClustersClient.BeginRemoveVMs +// method. +func (client *CloudVMClustersClient) BeginRemoveVMs(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, options *CloudVMClustersClientBeginRemoveVMsOptions) (*runtime.Poller[CloudVMClustersClientRemoveVMsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.removeVMs(ctx, resourceGroupName, cloudvmclustername, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudVMClustersClientRemoveVMsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudVMClustersClientRemoveVMsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RemoveVMs - Remove VMs from the VM Cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *CloudVMClustersClient) removeVMs(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, options *CloudVMClustersClientBeginRemoveVMsOptions) (*http.Response, error) { + var err error + const operationName = "CloudVMClustersClient.BeginRemoveVMs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.removeVMsCreateRequest(ctx, resourceGroupName, cloudvmclustername, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// removeVMsCreateRequest creates the RemoveVMs request. +func (client *CloudVMClustersClient) removeVMsCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, options *CloudVMClustersClientBeginRemoveVMsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/removeVms" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdate - Update a CloudVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - properties - The resource properties to be updated. +// - options - CloudVMClustersClientBeginUpdateOptions contains the optional parameters for the CloudVMClustersClient.BeginUpdate +// method. +func (client *CloudVMClustersClient) BeginUpdate(ctx context.Context, resourceGroupName string, cloudvmclustername string, properties CloudVMClusterUpdate, options *CloudVMClustersClientBeginUpdateOptions) (*runtime.Poller[CloudVMClustersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, cloudvmclustername, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudVMClustersClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudVMClustersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a CloudVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *CloudVMClustersClient) update(ctx context.Context, resourceGroupName string, cloudvmclustername string, properties CloudVMClusterUpdate, options *CloudVMClustersClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CloudVMClustersClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, cloudvmclustername, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *CloudVMClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, properties CloudVMClusterUpdate, options *CloudVMClustersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/constants.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/constants.go new file mode 100644 index 000000000000..29652630c534 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/constants.go @@ -0,0 +1,1247 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + 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, + } +} + +// AutonomousDatabaseBackupLifecycleState - AutonomousDatabaseBackupLifecycleState enum +type AutonomousDatabaseBackupLifecycleState string + +const ( + AutonomousDatabaseBackupLifecycleStateActive AutonomousDatabaseBackupLifecycleState = "Active" + AutonomousDatabaseBackupLifecycleStateCreating AutonomousDatabaseBackupLifecycleState = "Creating" + AutonomousDatabaseBackupLifecycleStateDeleting AutonomousDatabaseBackupLifecycleState = "Deleting" + AutonomousDatabaseBackupLifecycleStateFailed AutonomousDatabaseBackupLifecycleState = "Failed" + AutonomousDatabaseBackupLifecycleStateUpdating AutonomousDatabaseBackupLifecycleState = "Updating" +) + +// PossibleAutonomousDatabaseBackupLifecycleStateValues returns the possible values for the AutonomousDatabaseBackupLifecycleState const type. +func PossibleAutonomousDatabaseBackupLifecycleStateValues() []AutonomousDatabaseBackupLifecycleState { + return []AutonomousDatabaseBackupLifecycleState{ + AutonomousDatabaseBackupLifecycleStateActive, + AutonomousDatabaseBackupLifecycleStateCreating, + AutonomousDatabaseBackupLifecycleStateDeleting, + AutonomousDatabaseBackupLifecycleStateFailed, + AutonomousDatabaseBackupLifecycleStateUpdating, + } +} + +// AutonomousDatabaseBackupType - AutonomousDatabaseBackupType enum +type AutonomousDatabaseBackupType string + +const ( + AutonomousDatabaseBackupTypeFull AutonomousDatabaseBackupType = "Full" + AutonomousDatabaseBackupTypeIncremental AutonomousDatabaseBackupType = "Incremental" + AutonomousDatabaseBackupTypeLongTerm AutonomousDatabaseBackupType = "LongTerm" +) + +// PossibleAutonomousDatabaseBackupTypeValues returns the possible values for the AutonomousDatabaseBackupType const type. +func PossibleAutonomousDatabaseBackupTypeValues() []AutonomousDatabaseBackupType { + return []AutonomousDatabaseBackupType{ + AutonomousDatabaseBackupTypeFull, + AutonomousDatabaseBackupTypeIncremental, + AutonomousDatabaseBackupTypeLongTerm, + } +} + +// AutonomousDatabaseLifecycleState - AutonomousDatabaseLifecycleState enum +type AutonomousDatabaseLifecycleState string + +const ( + // AutonomousDatabaseLifecycleStateAvailable - AVAILABLE value + AutonomousDatabaseLifecycleStateAvailable AutonomousDatabaseLifecycleState = "Available" + // AutonomousDatabaseLifecycleStateAvailableNeedsAttention - AVAILABLE_NEEDS_ATTENTION value + AutonomousDatabaseLifecycleStateAvailableNeedsAttention AutonomousDatabaseLifecycleState = "AvailableNeedsAttention" + // AutonomousDatabaseLifecycleStateBackupInProgress - BACKUP_IN_PROGRESS value + AutonomousDatabaseLifecycleStateBackupInProgress AutonomousDatabaseLifecycleState = "BackupInProgress" + // AutonomousDatabaseLifecycleStateInaccessible - INACCESSIBLE value + AutonomousDatabaseLifecycleStateInaccessible AutonomousDatabaseLifecycleState = "Inaccessible" + // AutonomousDatabaseLifecycleStateMaintenanceInProgress - MAINTENANCE_IN_PROGRESS value + AutonomousDatabaseLifecycleStateMaintenanceInProgress AutonomousDatabaseLifecycleState = "MaintenanceInProgress" + // AutonomousDatabaseLifecycleStateProvisioning - PROVISIONING value + AutonomousDatabaseLifecycleStateProvisioning AutonomousDatabaseLifecycleState = "Provisioning" + // AutonomousDatabaseLifecycleStateRecreating - RECREATING value + AutonomousDatabaseLifecycleStateRecreating AutonomousDatabaseLifecycleState = "Recreating" + // AutonomousDatabaseLifecycleStateRestarting - RESTARTING value + AutonomousDatabaseLifecycleStateRestarting AutonomousDatabaseLifecycleState = "Restarting" + // AutonomousDatabaseLifecycleStateRestoreFailed - RESTORE_FAILED value + AutonomousDatabaseLifecycleStateRestoreFailed AutonomousDatabaseLifecycleState = "RestoreFailed" + // AutonomousDatabaseLifecycleStateRestoreInProgress - RESTORE_IN_PROGRESS value + AutonomousDatabaseLifecycleStateRestoreInProgress AutonomousDatabaseLifecycleState = "RestoreInProgress" + // AutonomousDatabaseLifecycleStateRoleChangeInProgress - ROLE_CHANGE_IN_PROGRESS value + AutonomousDatabaseLifecycleStateRoleChangeInProgress AutonomousDatabaseLifecycleState = "RoleChangeInProgress" + // AutonomousDatabaseLifecycleStateScaleInProgress - SCALE_IN_PROGRESS value + AutonomousDatabaseLifecycleStateScaleInProgress AutonomousDatabaseLifecycleState = "ScaleInProgress" + // AutonomousDatabaseLifecycleStateStandby - STANDBY value + AutonomousDatabaseLifecycleStateStandby AutonomousDatabaseLifecycleState = "Standby" + // AutonomousDatabaseLifecycleStateStarting - STARTING value + AutonomousDatabaseLifecycleStateStarting AutonomousDatabaseLifecycleState = "Starting" + // AutonomousDatabaseLifecycleStateStopped - STOPPED value + AutonomousDatabaseLifecycleStateStopped AutonomousDatabaseLifecycleState = "Stopped" + // AutonomousDatabaseLifecycleStateStopping - STOPPING value + AutonomousDatabaseLifecycleStateStopping AutonomousDatabaseLifecycleState = "Stopping" + // AutonomousDatabaseLifecycleStateTerminated - TERMINATED value + AutonomousDatabaseLifecycleStateTerminated AutonomousDatabaseLifecycleState = "Terminated" + // AutonomousDatabaseLifecycleStateTerminating - TERMINATING value + AutonomousDatabaseLifecycleStateTerminating AutonomousDatabaseLifecycleState = "Terminating" + // AutonomousDatabaseLifecycleStateUnavailable - UNAVAILABLE value + AutonomousDatabaseLifecycleStateUnavailable AutonomousDatabaseLifecycleState = "Unavailable" + // AutonomousDatabaseLifecycleStateUpdating - UPDATING value + AutonomousDatabaseLifecycleStateUpdating AutonomousDatabaseLifecycleState = "Updating" + // AutonomousDatabaseLifecycleStateUpgrading - UPGRADING value + AutonomousDatabaseLifecycleStateUpgrading AutonomousDatabaseLifecycleState = "Upgrading" +) + +// PossibleAutonomousDatabaseLifecycleStateValues returns the possible values for the AutonomousDatabaseLifecycleState const type. +func PossibleAutonomousDatabaseLifecycleStateValues() []AutonomousDatabaseLifecycleState { + return []AutonomousDatabaseLifecycleState{ + AutonomousDatabaseLifecycleStateAvailable, + AutonomousDatabaseLifecycleStateAvailableNeedsAttention, + AutonomousDatabaseLifecycleStateBackupInProgress, + AutonomousDatabaseLifecycleStateInaccessible, + AutonomousDatabaseLifecycleStateMaintenanceInProgress, + AutonomousDatabaseLifecycleStateProvisioning, + AutonomousDatabaseLifecycleStateRecreating, + AutonomousDatabaseLifecycleStateRestarting, + AutonomousDatabaseLifecycleStateRestoreFailed, + AutonomousDatabaseLifecycleStateRestoreInProgress, + AutonomousDatabaseLifecycleStateRoleChangeInProgress, + AutonomousDatabaseLifecycleStateScaleInProgress, + AutonomousDatabaseLifecycleStateStandby, + AutonomousDatabaseLifecycleStateStarting, + AutonomousDatabaseLifecycleStateStopped, + AutonomousDatabaseLifecycleStateStopping, + AutonomousDatabaseLifecycleStateTerminated, + AutonomousDatabaseLifecycleStateTerminating, + AutonomousDatabaseLifecycleStateUnavailable, + AutonomousDatabaseLifecycleStateUpdating, + AutonomousDatabaseLifecycleStateUpgrading, + } +} + +// AutonomousMaintenanceScheduleType - AutonomousMaintenanceScheduleType enum. +type AutonomousMaintenanceScheduleType string + +const ( + // AutonomousMaintenanceScheduleTypeEarly - EARLY value + AutonomousMaintenanceScheduleTypeEarly AutonomousMaintenanceScheduleType = "Early" + // AutonomousMaintenanceScheduleTypeRegular - REGULAR value + AutonomousMaintenanceScheduleTypeRegular AutonomousMaintenanceScheduleType = "Regular" +) + +// PossibleAutonomousMaintenanceScheduleTypeValues returns the possible values for the AutonomousMaintenanceScheduleType const type. +func PossibleAutonomousMaintenanceScheduleTypeValues() []AutonomousMaintenanceScheduleType { + return []AutonomousMaintenanceScheduleType{ + AutonomousMaintenanceScheduleTypeEarly, + AutonomousMaintenanceScheduleTypeRegular, + } +} + +// AzureResourceProvisioningState - Azure Resource Provisioning State enum +type AzureResourceProvisioningState string + +const ( + // AzureResourceProvisioningStateCanceled - Resource creation was canceled. + AzureResourceProvisioningStateCanceled AzureResourceProvisioningState = "Canceled" + // AzureResourceProvisioningStateFailed - Resource creation failed. + AzureResourceProvisioningStateFailed AzureResourceProvisioningState = "Failed" + // AzureResourceProvisioningStateProvisioning - Provisioning value + AzureResourceProvisioningStateProvisioning AzureResourceProvisioningState = "Provisioning" + // AzureResourceProvisioningStateSucceeded - Resource has been created. + AzureResourceProvisioningStateSucceeded AzureResourceProvisioningState = "Succeeded" +) + +// PossibleAzureResourceProvisioningStateValues returns the possible values for the AzureResourceProvisioningState const type. +func PossibleAzureResourceProvisioningStateValues() []AzureResourceProvisioningState { + return []AzureResourceProvisioningState{ + AzureResourceProvisioningStateCanceled, + AzureResourceProvisioningStateFailed, + AzureResourceProvisioningStateProvisioning, + AzureResourceProvisioningStateSucceeded, + } +} + +// CloneType - CloneType enum +type CloneType string + +const ( + // CloneTypeFull - FULL value + CloneTypeFull CloneType = "Full" + // CloneTypeMetadata - METADATA value + CloneTypeMetadata CloneType = "Metadata" +) + +// PossibleCloneTypeValues returns the possible values for the CloneType const type. +func PossibleCloneTypeValues() []CloneType { + return []CloneType{ + CloneTypeFull, + CloneTypeMetadata, + } +} + +// CloudAccountProvisioningState - CloudAccountProvisioningState enum +type CloudAccountProvisioningState string + +const ( + // CloudAccountProvisioningStateAvailable - Available value + CloudAccountProvisioningStateAvailable CloudAccountProvisioningState = "Available" + // CloudAccountProvisioningStatePending - Pending value + CloudAccountProvisioningStatePending CloudAccountProvisioningState = "Pending" + // CloudAccountProvisioningStateProvisioning - Provisioning value + CloudAccountProvisioningStateProvisioning CloudAccountProvisioningState = "Provisioning" +) + +// PossibleCloudAccountProvisioningStateValues returns the possible values for the CloudAccountProvisioningState const type. +func PossibleCloudAccountProvisioningStateValues() []CloudAccountProvisioningState { + return []CloudAccountProvisioningState{ + CloudAccountProvisioningStateAvailable, + CloudAccountProvisioningStatePending, + CloudAccountProvisioningStateProvisioning, + } +} + +// CloudExadataInfrastructureLifecycleState - CloudExadataInfrastructureLifecycleState enum +type CloudExadataInfrastructureLifecycleState string + +const ( + // CloudExadataInfrastructureLifecycleStateAvailable - AVAILABLE value + CloudExadataInfrastructureLifecycleStateAvailable CloudExadataInfrastructureLifecycleState = "Available" + // CloudExadataInfrastructureLifecycleStateFailed - FAILED value + CloudExadataInfrastructureLifecycleStateFailed CloudExadataInfrastructureLifecycleState = "Failed" + // CloudExadataInfrastructureLifecycleStateMaintenanceInProgress - MAINTENANCE_IN_PROGRESS value + CloudExadataInfrastructureLifecycleStateMaintenanceInProgress CloudExadataInfrastructureLifecycleState = "MaintenanceInProgress" + // CloudExadataInfrastructureLifecycleStateProvisioning - PROVISIONING value + CloudExadataInfrastructureLifecycleStateProvisioning CloudExadataInfrastructureLifecycleState = "Provisioning" + // CloudExadataInfrastructureLifecycleStateTerminated - TERMINATED value + CloudExadataInfrastructureLifecycleStateTerminated CloudExadataInfrastructureLifecycleState = "Terminated" + // CloudExadataInfrastructureLifecycleStateTerminating - TERMINATING value + CloudExadataInfrastructureLifecycleStateTerminating CloudExadataInfrastructureLifecycleState = "Terminating" + // CloudExadataInfrastructureLifecycleStateUpdating - UPDATING value + CloudExadataInfrastructureLifecycleStateUpdating CloudExadataInfrastructureLifecycleState = "Updating" +) + +// PossibleCloudExadataInfrastructureLifecycleStateValues returns the possible values for the CloudExadataInfrastructureLifecycleState const type. +func PossibleCloudExadataInfrastructureLifecycleStateValues() []CloudExadataInfrastructureLifecycleState { + return []CloudExadataInfrastructureLifecycleState{ + CloudExadataInfrastructureLifecycleStateAvailable, + CloudExadataInfrastructureLifecycleStateFailed, + CloudExadataInfrastructureLifecycleStateMaintenanceInProgress, + CloudExadataInfrastructureLifecycleStateProvisioning, + CloudExadataInfrastructureLifecycleStateTerminated, + CloudExadataInfrastructureLifecycleStateTerminating, + CloudExadataInfrastructureLifecycleStateUpdating, + } +} + +// CloudVMClusterLifecycleState - CloudVmClusterLifecycleState enum +type CloudVMClusterLifecycleState string + +const ( + // CloudVMClusterLifecycleStateAvailable - AVAILABLE value + CloudVMClusterLifecycleStateAvailable CloudVMClusterLifecycleState = "Available" + // CloudVMClusterLifecycleStateFailed - FAILED value + CloudVMClusterLifecycleStateFailed CloudVMClusterLifecycleState = "Failed" + // CloudVMClusterLifecycleStateMaintenanceInProgress - MAINTENANCE_IN_PROGRESS value + CloudVMClusterLifecycleStateMaintenanceInProgress CloudVMClusterLifecycleState = "MaintenanceInProgress" + // CloudVMClusterLifecycleStateProvisioning - PROVISIONING value + CloudVMClusterLifecycleStateProvisioning CloudVMClusterLifecycleState = "Provisioning" + // CloudVMClusterLifecycleStateTerminated - TERMINATED value + CloudVMClusterLifecycleStateTerminated CloudVMClusterLifecycleState = "Terminated" + // CloudVMClusterLifecycleStateTerminating - TERMINATING value + CloudVMClusterLifecycleStateTerminating CloudVMClusterLifecycleState = "Terminating" + // CloudVMClusterLifecycleStateUpdating - UPDATING value + CloudVMClusterLifecycleStateUpdating CloudVMClusterLifecycleState = "Updating" +) + +// PossibleCloudVMClusterLifecycleStateValues returns the possible values for the CloudVMClusterLifecycleState const type. +func PossibleCloudVMClusterLifecycleStateValues() []CloudVMClusterLifecycleState { + return []CloudVMClusterLifecycleState{ + CloudVMClusterLifecycleStateAvailable, + CloudVMClusterLifecycleStateFailed, + CloudVMClusterLifecycleStateMaintenanceInProgress, + CloudVMClusterLifecycleStateProvisioning, + CloudVMClusterLifecycleStateTerminated, + CloudVMClusterLifecycleStateTerminating, + CloudVMClusterLifecycleStateUpdating, + } +} + +// ComputeModel - ComputeModel enum +type ComputeModel string + +const ( + // ComputeModelECPU - ECPU value + ComputeModelECPU ComputeModel = "ECPU" + // ComputeModelOCPU - OCPU value + ComputeModelOCPU ComputeModel = "OCPU" +) + +// PossibleComputeModelValues returns the possible values for the ComputeModel const type. +func PossibleComputeModelValues() []ComputeModel { + return []ComputeModel{ + ComputeModelECPU, + ComputeModelOCPU, + } +} + +// ConsumerGroup - ConsumerGroup enum. +type ConsumerGroup string + +const ( + // ConsumerGroupHigh - HIGH value + ConsumerGroupHigh ConsumerGroup = "High" + // ConsumerGroupLow - LOW value + ConsumerGroupLow ConsumerGroup = "Low" + // ConsumerGroupMedium - MEDIUM value + ConsumerGroupMedium ConsumerGroup = "Medium" + // ConsumerGroupTp - TP value + ConsumerGroupTp ConsumerGroup = "Tp" + // ConsumerGroupTpurgent - TPURGENT value + ConsumerGroupTpurgent ConsumerGroup = "Tpurgent" +) + +// PossibleConsumerGroupValues returns the possible values for the ConsumerGroup const type. +func PossibleConsumerGroupValues() []ConsumerGroup { + return []ConsumerGroup{ + ConsumerGroupHigh, + ConsumerGroupLow, + ConsumerGroupMedium, + ConsumerGroupTp, + ConsumerGroupTpurgent, + } +} + +// 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, + } +} + +// DNSPrivateViewsLifecycleState - DnsPrivateViews lifecycle state enum +type DNSPrivateViewsLifecycleState string + +const ( + // DNSPrivateViewsLifecycleStateActive - Active value + DNSPrivateViewsLifecycleStateActive DNSPrivateViewsLifecycleState = "Active" + // DNSPrivateViewsLifecycleStateDeleted - Deleted value + DNSPrivateViewsLifecycleStateDeleted DNSPrivateViewsLifecycleState = "Deleted" + // DNSPrivateViewsLifecycleStateDeleting - Deleting value + DNSPrivateViewsLifecycleStateDeleting DNSPrivateViewsLifecycleState = "Deleting" + // DNSPrivateViewsLifecycleStateUpdating - Updating value + DNSPrivateViewsLifecycleStateUpdating DNSPrivateViewsLifecycleState = "Updating" +) + +// PossibleDNSPrivateViewsLifecycleStateValues returns the possible values for the DNSPrivateViewsLifecycleState const type. +func PossibleDNSPrivateViewsLifecycleStateValues() []DNSPrivateViewsLifecycleState { + return []DNSPrivateViewsLifecycleState{ + DNSPrivateViewsLifecycleStateActive, + DNSPrivateViewsLifecycleStateDeleted, + DNSPrivateViewsLifecycleStateDeleting, + DNSPrivateViewsLifecycleStateUpdating, + } +} + +// DNSPrivateZonesLifecycleState - DnsPrivateZones lifecycle state enum +type DNSPrivateZonesLifecycleState string + +const ( + // DNSPrivateZonesLifecycleStateActive - Active value + DNSPrivateZonesLifecycleStateActive DNSPrivateZonesLifecycleState = "Active" + // DNSPrivateZonesLifecycleStateCreating - Creating value + DNSPrivateZonesLifecycleStateCreating DNSPrivateZonesLifecycleState = "Creating" + // DNSPrivateZonesLifecycleStateDeleted - Deleted value + DNSPrivateZonesLifecycleStateDeleted DNSPrivateZonesLifecycleState = "Deleted" + // DNSPrivateZonesLifecycleStateDeleting - Deleting value + DNSPrivateZonesLifecycleStateDeleting DNSPrivateZonesLifecycleState = "Deleting" + // DNSPrivateZonesLifecycleStateUpdating - Updating value + DNSPrivateZonesLifecycleStateUpdating DNSPrivateZonesLifecycleState = "Updating" +) + +// PossibleDNSPrivateZonesLifecycleStateValues returns the possible values for the DNSPrivateZonesLifecycleState const type. +func PossibleDNSPrivateZonesLifecycleStateValues() []DNSPrivateZonesLifecycleState { + return []DNSPrivateZonesLifecycleState{ + DNSPrivateZonesLifecycleStateActive, + DNSPrivateZonesLifecycleStateCreating, + DNSPrivateZonesLifecycleStateDeleted, + DNSPrivateZonesLifecycleStateDeleting, + DNSPrivateZonesLifecycleStateUpdating, + } +} + +// DataBaseType - DataBaseType enum +type DataBaseType string + +const ( + // DataBaseTypeClone - CLONE value + DataBaseTypeClone DataBaseType = "Clone" + // DataBaseTypeRegular - REGULAR value + DataBaseTypeRegular DataBaseType = "Regular" +) + +// PossibleDataBaseTypeValues returns the possible values for the DataBaseType const type. +func PossibleDataBaseTypeValues() []DataBaseType { + return []DataBaseType{ + DataBaseTypeClone, + DataBaseTypeRegular, + } +} + +// DataSafeStatusType - DataSafeStatusType enum. +type DataSafeStatusType string + +const ( + // DataSafeStatusTypeDeregistering - DEREGISTERING value + DataSafeStatusTypeDeregistering DataSafeStatusType = "Deregistering" + // DataSafeStatusTypeFailed - FAILED value + DataSafeStatusTypeFailed DataSafeStatusType = "Failed" + // DataSafeStatusTypeNotRegistered - NOT_REGISTERED value + DataSafeStatusTypeNotRegistered DataSafeStatusType = "NotRegistered" + // DataSafeStatusTypeRegistered - REGISTERED value + DataSafeStatusTypeRegistered DataSafeStatusType = "Registered" + // DataSafeStatusTypeRegistering - REGISTERING value + DataSafeStatusTypeRegistering DataSafeStatusType = "Registering" +) + +// PossibleDataSafeStatusTypeValues returns the possible values for the DataSafeStatusType const type. +func PossibleDataSafeStatusTypeValues() []DataSafeStatusType { + return []DataSafeStatusType{ + DataSafeStatusTypeDeregistering, + DataSafeStatusTypeFailed, + DataSafeStatusTypeNotRegistered, + DataSafeStatusTypeRegistered, + DataSafeStatusTypeRegistering, + } +} + +// DatabaseEditionType - DatabaseEditionType enum. +type DatabaseEditionType string + +const ( + // DatabaseEditionTypeEnterpriseEdition - ENTERPRISE_EDITION value + DatabaseEditionTypeEnterpriseEdition DatabaseEditionType = "EnterpriseEdition" + // DatabaseEditionTypeStandardEdition - STANDARD_EDITION value + DatabaseEditionTypeStandardEdition DatabaseEditionType = "StandardEdition" +) + +// PossibleDatabaseEditionTypeValues returns the possible values for the DatabaseEditionType const type. +func PossibleDatabaseEditionTypeValues() []DatabaseEditionType { + return []DatabaseEditionType{ + DatabaseEditionTypeEnterpriseEdition, + DatabaseEditionTypeStandardEdition, + } +} + +// DayOfWeekName - DayOfWeekName enum +type DayOfWeekName string + +const ( + // DayOfWeekNameFriday - Friday value + DayOfWeekNameFriday DayOfWeekName = "Friday" + // DayOfWeekNameMonday - Monday value + DayOfWeekNameMonday DayOfWeekName = "Monday" + // DayOfWeekNameSaturday - Saturday value + DayOfWeekNameSaturday DayOfWeekName = "Saturday" + // DayOfWeekNameSunday - Sunday value + DayOfWeekNameSunday DayOfWeekName = "Sunday" + // DayOfWeekNameThursday - Thursday value + DayOfWeekNameThursday DayOfWeekName = "Thursday" + // DayOfWeekNameTuesday - Tuesday value + DayOfWeekNameTuesday DayOfWeekName = "Tuesday" + // DayOfWeekNameWednesday - Wednesday value + DayOfWeekNameWednesday DayOfWeekName = "Wednesday" +) + +// PossibleDayOfWeekNameValues returns the possible values for the DayOfWeekName const type. +func PossibleDayOfWeekNameValues() []DayOfWeekName { + return []DayOfWeekName{ + DayOfWeekNameFriday, + DayOfWeekNameMonday, + DayOfWeekNameSaturday, + DayOfWeekNameSunday, + DayOfWeekNameThursday, + DayOfWeekNameTuesday, + DayOfWeekNameWednesday, + } +} + +// DbNodeActionEnum - DbNode action enum +type DbNodeActionEnum string + +const ( + // DbNodeActionEnumReset - Reset DbNode + DbNodeActionEnumReset DbNodeActionEnum = "Reset" + // DbNodeActionEnumSoftReset - Soft reset DbNode + DbNodeActionEnumSoftReset DbNodeActionEnum = "SoftReset" + // DbNodeActionEnumStart - Start DbNode + DbNodeActionEnumStart DbNodeActionEnum = "Start" + // DbNodeActionEnumStop - Stop DbNode + DbNodeActionEnumStop DbNodeActionEnum = "Stop" +) + +// PossibleDbNodeActionEnumValues returns the possible values for the DbNodeActionEnum const type. +func PossibleDbNodeActionEnumValues() []DbNodeActionEnum { + return []DbNodeActionEnum{ + DbNodeActionEnumReset, + DbNodeActionEnumSoftReset, + DbNodeActionEnumStart, + DbNodeActionEnumStop, + } +} + +// DbNodeMaintenanceType - The type of database node maintenance. +type DbNodeMaintenanceType string + +const ( + // DbNodeMaintenanceTypeVmdbRebootMigration - Provisioning value + DbNodeMaintenanceTypeVmdbRebootMigration DbNodeMaintenanceType = "VmdbRebootMigration" +) + +// PossibleDbNodeMaintenanceTypeValues returns the possible values for the DbNodeMaintenanceType const type. +func PossibleDbNodeMaintenanceTypeValues() []DbNodeMaintenanceType { + return []DbNodeMaintenanceType{ + DbNodeMaintenanceTypeVmdbRebootMigration, + } +} + +// DbNodeProvisioningState - DnNode provisioning state enum +type DbNodeProvisioningState string + +const ( + // DbNodeProvisioningStateAvailable - AVAILABLE value + DbNodeProvisioningStateAvailable DbNodeProvisioningState = "Available" + // DbNodeProvisioningStateFailed - FAILED value + DbNodeProvisioningStateFailed DbNodeProvisioningState = "Failed" + // DbNodeProvisioningStateProvisioning - PROVISIONING value + DbNodeProvisioningStateProvisioning DbNodeProvisioningState = "Provisioning" + // DbNodeProvisioningStateStarting - STARTING value + DbNodeProvisioningStateStarting DbNodeProvisioningState = "Starting" + // DbNodeProvisioningStateStopped - STOPPED value + DbNodeProvisioningStateStopped DbNodeProvisioningState = "Stopped" + // DbNodeProvisioningStateStopping - STOPPING value + DbNodeProvisioningStateStopping DbNodeProvisioningState = "Stopping" + // DbNodeProvisioningStateTerminated - TERMINATED value + DbNodeProvisioningStateTerminated DbNodeProvisioningState = "Terminated" + // DbNodeProvisioningStateTerminating - TERMINATING value + DbNodeProvisioningStateTerminating DbNodeProvisioningState = "Terminating" + // DbNodeProvisioningStateUpdating - UPDATING value + DbNodeProvisioningStateUpdating DbNodeProvisioningState = "Updating" +) + +// PossibleDbNodeProvisioningStateValues returns the possible values for the DbNodeProvisioningState const type. +func PossibleDbNodeProvisioningStateValues() []DbNodeProvisioningState { + return []DbNodeProvisioningState{ + DbNodeProvisioningStateAvailable, + DbNodeProvisioningStateFailed, + DbNodeProvisioningStateProvisioning, + DbNodeProvisioningStateStarting, + DbNodeProvisioningStateStopped, + DbNodeProvisioningStateStopping, + DbNodeProvisioningStateTerminated, + DbNodeProvisioningStateTerminating, + DbNodeProvisioningStateUpdating, + } +} + +// DbServerPatchingStatus - Db Server patching status enum +type DbServerPatchingStatus string + +const ( + // DbServerPatchingStatusComplete - COMPLETE value + DbServerPatchingStatusComplete DbServerPatchingStatus = "Complete" + // DbServerPatchingStatusFailed - FAILED value + DbServerPatchingStatusFailed DbServerPatchingStatus = "Failed" + // DbServerPatchingStatusMaintenanceInProgress - MAINTENANCE_IN_PROGRESS value + DbServerPatchingStatusMaintenanceInProgress DbServerPatchingStatus = "MaintenanceInProgress" + // DbServerPatchingStatusScheduled - SCHEDULED value + DbServerPatchingStatusScheduled DbServerPatchingStatus = "Scheduled" +) + +// PossibleDbServerPatchingStatusValues returns the possible values for the DbServerPatchingStatus const type. +func PossibleDbServerPatchingStatusValues() []DbServerPatchingStatus { + return []DbServerPatchingStatus{ + DbServerPatchingStatusComplete, + DbServerPatchingStatusFailed, + DbServerPatchingStatusMaintenanceInProgress, + DbServerPatchingStatusScheduled, + } +} + +// DbServerProvisioningState - DbServerProvisioningState enum +type DbServerProvisioningState string + +const ( + // DbServerProvisioningStateAvailable - AVAILABLE value + DbServerProvisioningStateAvailable DbServerProvisioningState = "Available" + // DbServerProvisioningStateCreating - CREATING value + DbServerProvisioningStateCreating DbServerProvisioningState = "Creating" + // DbServerProvisioningStateDeleted - DELETED value + DbServerProvisioningStateDeleted DbServerProvisioningState = "Deleted" + // DbServerProvisioningStateDeleting - DELETING value + DbServerProvisioningStateDeleting DbServerProvisioningState = "Deleting" + // DbServerProvisioningStateMaintenanceInProgress - MAINTENANCE_IN_PROGRESS value + DbServerProvisioningStateMaintenanceInProgress DbServerProvisioningState = "MaintenanceInProgress" + // DbServerProvisioningStateUnavailable - UNAVAILABLE value + DbServerProvisioningStateUnavailable DbServerProvisioningState = "Unavailable" +) + +// PossibleDbServerProvisioningStateValues returns the possible values for the DbServerProvisioningState const type. +func PossibleDbServerProvisioningStateValues() []DbServerProvisioningState { + return []DbServerProvisioningState{ + DbServerProvisioningStateAvailable, + DbServerProvisioningStateCreating, + DbServerProvisioningStateDeleted, + DbServerProvisioningStateDeleting, + DbServerProvisioningStateMaintenanceInProgress, + DbServerProvisioningStateUnavailable, + } +} + +// DisasterRecoveryType - DisasterRecoveryType enum. +type DisasterRecoveryType string + +const ( + // DisasterRecoveryTypeAdg - ADG value + DisasterRecoveryTypeAdg DisasterRecoveryType = "Adg" + // DisasterRecoveryTypeBackupBased - BACKUP_BASED value + DisasterRecoveryTypeBackupBased DisasterRecoveryType = "BackupBased" +) + +// PossibleDisasterRecoveryTypeValues returns the possible values for the DisasterRecoveryType const type. +func PossibleDisasterRecoveryTypeValues() []DisasterRecoveryType { + return []DisasterRecoveryType{ + DisasterRecoveryTypeAdg, + DisasterRecoveryTypeBackupBased, + } +} + +// DiskRedundancy - DiskRedundancy enum +type DiskRedundancy string + +const ( + // DiskRedundancyHigh - High value + DiskRedundancyHigh DiskRedundancy = "High" + // DiskRedundancyNormal - Normal value + DiskRedundancyNormal DiskRedundancy = "Normal" +) + +// PossibleDiskRedundancyValues returns the possible values for the DiskRedundancy const type. +func PossibleDiskRedundancyValues() []DiskRedundancy { + return []DiskRedundancy{ + DiskRedundancyHigh, + DiskRedundancyNormal, + } +} + +// GenerateType - GenerateType enum +type GenerateType string + +const ( + // GenerateTypeAll - ALL value + GenerateTypeAll GenerateType = "All" + // GenerateTypeSingle - SINGLE value + GenerateTypeSingle GenerateType = "Single" +) + +// PossibleGenerateTypeValues returns the possible values for the GenerateType const type. +func PossibleGenerateTypeValues() []GenerateType { + return []GenerateType{ + GenerateTypeAll, + GenerateTypeSingle, + } +} + +// HostFormatType - HostFormatType enum. +type HostFormatType string + +const ( + // HostFormatTypeFqdn - FQDN value + HostFormatTypeFqdn HostFormatType = "Fqdn" + // HostFormatTypeIP - IP value + HostFormatTypeIP HostFormatType = "Ip" +) + +// PossibleHostFormatTypeValues returns the possible values for the HostFormatType const type. +func PossibleHostFormatTypeValues() []HostFormatType { + return []HostFormatType{ + HostFormatTypeFqdn, + HostFormatTypeIP, + } +} + +// Intent - Intent enum +type Intent string + +const ( + // IntentReset - Reset value + IntentReset Intent = "Reset" + // IntentRetain - Retain value + IntentRetain Intent = "Retain" +) + +// PossibleIntentValues returns the possible values for the Intent const type. +func PossibleIntentValues() []Intent { + return []Intent{ + IntentReset, + IntentRetain, + } +} + +// IormLifecycleState - IORMLifecycleState enum +type IormLifecycleState string + +const ( + // IormLifecycleStateBootStrapping - BOOTSTRAPPING value + IormLifecycleStateBootStrapping IormLifecycleState = "BootStrapping" + // IormLifecycleStateDisabled - DISABLED value + IormLifecycleStateDisabled IormLifecycleState = "Disabled" + // IormLifecycleStateEnabled - ENABLED value + IormLifecycleStateEnabled IormLifecycleState = "Enabled" + // IormLifecycleStateFailed - FAILED value + IormLifecycleStateFailed IormLifecycleState = "Failed" + // IormLifecycleStateUpdating - UPDATING value + IormLifecycleStateUpdating IormLifecycleState = "Updating" +) + +// PossibleIormLifecycleStateValues returns the possible values for the IormLifecycleState const type. +func PossibleIormLifecycleStateValues() []IormLifecycleState { + return []IormLifecycleState{ + IormLifecycleStateBootStrapping, + IormLifecycleStateDisabled, + IormLifecycleStateEnabled, + IormLifecycleStateFailed, + IormLifecycleStateUpdating, + } +} + +// LicenseModel - LicenseModel enum +type LicenseModel string + +const ( + // LicenseModelBringYourOwnLicense - BringYourOwnLicense value + LicenseModelBringYourOwnLicense LicenseModel = "BringYourOwnLicense" + // LicenseModelLicenseIncluded - LicenseIncluded value + LicenseModelLicenseIncluded LicenseModel = "LicenseIncluded" +) + +// PossibleLicenseModelValues returns the possible values for the LicenseModel const type. +func PossibleLicenseModelValues() []LicenseModel { + return []LicenseModel{ + LicenseModelBringYourOwnLicense, + LicenseModelLicenseIncluded, + } +} + +// MonthName - MonthName enum +type MonthName string + +const ( + // MonthNameApril - April value + MonthNameApril MonthName = "April" + // MonthNameAugust - August value + MonthNameAugust MonthName = "August" + // MonthNameDecember - December value + MonthNameDecember MonthName = "December" + // MonthNameFebruary - February value + MonthNameFebruary MonthName = "February" + // MonthNameJanuary - January value + MonthNameJanuary MonthName = "January" + // MonthNameJuly - July value + MonthNameJuly MonthName = "July" + // MonthNameJune - June value + MonthNameJune MonthName = "June" + // MonthNameMarch - March value + MonthNameMarch MonthName = "March" + // MonthNameMay - May value + MonthNameMay MonthName = "May" + // MonthNameNovember - November value + MonthNameNovember MonthName = "November" + // MonthNameOctober - October value + MonthNameOctober MonthName = "October" + // MonthNameSeptember - September value + MonthNameSeptember MonthName = "September" +) + +// PossibleMonthNameValues returns the possible values for the MonthName const type. +func PossibleMonthNameValues() []MonthName { + return []MonthName{ + MonthNameApril, + MonthNameAugust, + MonthNameDecember, + MonthNameFebruary, + MonthNameJanuary, + MonthNameJuly, + MonthNameJune, + MonthNameMarch, + MonthNameMay, + MonthNameNovember, + MonthNameOctober, + MonthNameSeptember, + } +} + +// Objective - Objective enum +type Objective string + +const ( + // ObjectiveAuto - AUTO value + ObjectiveAuto Objective = "Auto" + // ObjectiveBalanced - BALANCED value + ObjectiveBalanced Objective = "Balanced" + // ObjectiveBasic - BASIC value + ObjectiveBasic Objective = "Basic" + // ObjectiveHighThroughput - HIGH_THROUGHPUT value + ObjectiveHighThroughput Objective = "HighThroughput" + // ObjectiveLowLatency - LOW_LATENCY value + ObjectiveLowLatency Objective = "LowLatency" +) + +// PossibleObjectiveValues returns the possible values for the Objective const type. +func PossibleObjectiveValues() []Objective { + return []Objective{ + ObjectiveAuto, + ObjectiveBalanced, + ObjectiveBasic, + ObjectiveHighThroughput, + ObjectiveLowLatency, + } +} + +// OpenModeType - OpenModeType enum. +type OpenModeType string + +const ( + // OpenModeTypeReadOnly - READ_ONLY value + OpenModeTypeReadOnly OpenModeType = "ReadOnly" + // OpenModeTypeReadWrite - READ_WRITE value + OpenModeTypeReadWrite OpenModeType = "ReadWrite" +) + +// PossibleOpenModeTypeValues returns the possible values for the OpenModeType const type. +func PossibleOpenModeTypeValues() []OpenModeType { + return []OpenModeType{ + OpenModeTypeReadOnly, + OpenModeTypeReadWrite, + } +} + +// OperationsInsightsStatusType - OperationsInsightsStatusType enum. +type OperationsInsightsStatusType string + +const ( + // OperationsInsightsStatusTypeDisabling - DISABLING value + OperationsInsightsStatusTypeDisabling OperationsInsightsStatusType = "Disabling" + // OperationsInsightsStatusTypeEnabled - ENABLED value + OperationsInsightsStatusTypeEnabled OperationsInsightsStatusType = "Enabled" + // OperationsInsightsStatusTypeEnabling - ENABLING value + OperationsInsightsStatusTypeEnabling OperationsInsightsStatusType = "Enabling" + // OperationsInsightsStatusTypeFailedDisabling - FAILED_DISABLING value + OperationsInsightsStatusTypeFailedDisabling OperationsInsightsStatusType = "FailedDisabling" + // OperationsInsightsStatusTypeFailedEnabling - FAILED_ENABLING value + OperationsInsightsStatusTypeFailedEnabling OperationsInsightsStatusType = "FailedEnabling" + // OperationsInsightsStatusTypeNotEnabled - NOT_ENABLED value + OperationsInsightsStatusTypeNotEnabled OperationsInsightsStatusType = "NotEnabled" +) + +// PossibleOperationsInsightsStatusTypeValues returns the possible values for the OperationsInsightsStatusType const type. +func PossibleOperationsInsightsStatusTypeValues() []OperationsInsightsStatusType { + return []OperationsInsightsStatusType{ + OperationsInsightsStatusTypeDisabling, + OperationsInsightsStatusTypeEnabled, + OperationsInsightsStatusTypeEnabling, + OperationsInsightsStatusTypeFailedDisabling, + OperationsInsightsStatusTypeFailedEnabling, + OperationsInsightsStatusTypeNotEnabled, + } +} + +// OracleSubscriptionProvisioningState - OracleSubscriptionProvisioningState enum +type OracleSubscriptionProvisioningState string + +const ( + // OracleSubscriptionProvisioningStateCanceled - Resource creation was canceled. + OracleSubscriptionProvisioningStateCanceled OracleSubscriptionProvisioningState = "Canceled" + // OracleSubscriptionProvisioningStateFailed - Resource creation failed. + OracleSubscriptionProvisioningStateFailed OracleSubscriptionProvisioningState = "Failed" + // OracleSubscriptionProvisioningStateSucceeded - Resource has been created. + OracleSubscriptionProvisioningStateSucceeded OracleSubscriptionProvisioningState = "Succeeded" +) + +// PossibleOracleSubscriptionProvisioningStateValues returns the possible values for the OracleSubscriptionProvisioningState const type. +func PossibleOracleSubscriptionProvisioningStateValues() []OracleSubscriptionProvisioningState { + return []OracleSubscriptionProvisioningState{ + OracleSubscriptionProvisioningStateCanceled, + OracleSubscriptionProvisioningStateFailed, + OracleSubscriptionProvisioningStateSucceeded, + } +} + +// 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, + } +} + +// PatchingMode - PatchingMode enum +type PatchingMode string + +const ( + // PatchingModeNonRolling - Non Rolling value + PatchingModeNonRolling PatchingMode = "NonRolling" + // PatchingModeRolling - Rolling value + PatchingModeRolling PatchingMode = "Rolling" +) + +// PossiblePatchingModeValues returns the possible values for the PatchingMode const type. +func PossiblePatchingModeValues() []PatchingMode { + return []PatchingMode{ + PatchingModeNonRolling, + PatchingModeRolling, + } +} + +// PermissionLevelType - PermissionLevelType enum. +type PermissionLevelType string + +const ( + // PermissionLevelTypeRestricted - RESTRICTED value + PermissionLevelTypeRestricted PermissionLevelType = "Restricted" + // PermissionLevelTypeUnrestricted - UNRESTRICTED value + PermissionLevelTypeUnrestricted PermissionLevelType = "Unrestricted" +) + +// PossiblePermissionLevelTypeValues returns the possible values for the PermissionLevelType const type. +func PossiblePermissionLevelTypeValues() []PermissionLevelType { + return []PermissionLevelType{ + PermissionLevelTypeRestricted, + PermissionLevelTypeUnrestricted, + } +} + +// Preference - Preference enum +type Preference string + +const ( + // PreferenceCustomPreference - CustomPreference value + PreferenceCustomPreference Preference = "CustomPreference" + // PreferenceNoPreference - NoPreference value + PreferenceNoPreference Preference = "NoPreference" +) + +// PossiblePreferenceValues returns the possible values for the Preference const type. +func PossiblePreferenceValues() []Preference { + return []Preference{ + PreferenceCustomPreference, + PreferenceNoPreference, + } +} + +// ProtocolType - ProtocolType enum. +type ProtocolType string + +const ( + // ProtocolTypeTCP - TCP value + ProtocolTypeTCP ProtocolType = "TCP" + // ProtocolTypeTCPS - TCPS value + ProtocolTypeTCPS ProtocolType = "TCPS" +) + +// PossibleProtocolTypeValues returns the possible values for the ProtocolType const type. +func PossibleProtocolTypeValues() []ProtocolType { + return []ProtocolType{ + ProtocolTypeTCP, + ProtocolTypeTCPS, + } +} + +// RefreshableModelType - RefreshableModelType enum +type RefreshableModelType string + +const ( + // RefreshableModelTypeAutomatic - AUTOMATIC value + RefreshableModelTypeAutomatic RefreshableModelType = "Automatic" + // RefreshableModelTypeManual - MANUAL value + RefreshableModelTypeManual RefreshableModelType = "Manual" +) + +// PossibleRefreshableModelTypeValues returns the possible values for the RefreshableModelType const type. +func PossibleRefreshableModelTypeValues() []RefreshableModelType { + return []RefreshableModelType{ + RefreshableModelTypeAutomatic, + RefreshableModelTypeManual, + } +} + +// RefreshableStatusType - RefreshableStatusType enum. +type RefreshableStatusType string + +const ( + // RefreshableStatusTypeNotRefreshing - NOT_REFRESHING value + RefreshableStatusTypeNotRefreshing RefreshableStatusType = "NotRefreshing" + // RefreshableStatusTypeRefreshing - REFRESHING value + RefreshableStatusTypeRefreshing RefreshableStatusType = "Refreshing" +) + +// PossibleRefreshableStatusTypeValues returns the possible values for the RefreshableStatusType const type. +func PossibleRefreshableStatusTypeValues() []RefreshableStatusType { + return []RefreshableStatusType{ + RefreshableStatusTypeNotRefreshing, + RefreshableStatusTypeRefreshing, + } +} + +// ResourceProvisioningState - The provisioning state of a resource type. +type ResourceProvisioningState string + +const ( + // ResourceProvisioningStateCanceled - Resource creation was canceled. + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + // ResourceProvisioningStateFailed - Resource creation failed. + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + // ResourceProvisioningStateSucceeded - Resource has been created. + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" +) + +// PossibleResourceProvisioningStateValues returns the possible values for the ResourceProvisioningState const type. +func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { + return []ResourceProvisioningState{ + ResourceProvisioningStateCanceled, + ResourceProvisioningStateFailed, + ResourceProvisioningStateSucceeded, + } +} + +// RoleType - RoleType enum. +type RoleType string + +const ( + // RoleTypeBackupCopy - BACKUP_COPY value + RoleTypeBackupCopy RoleType = "BackupCopy" + // RoleTypeDisabledStandby - DISABLED_STANDBY value + RoleTypeDisabledStandby RoleType = "DisabledStandby" + // RoleTypePrimary - PRIMARY value + RoleTypePrimary RoleType = "Primary" + // RoleTypeSnapshotStandby - SNAPSHOT_STANDBY value + RoleTypeSnapshotStandby RoleType = "SnapshotStandby" + // RoleTypeStandby - STANDBY value + RoleTypeStandby RoleType = "Standby" +) + +// PossibleRoleTypeValues returns the possible values for the RoleType const type. +func PossibleRoleTypeValues() []RoleType { + return []RoleType{ + RoleTypeBackupCopy, + RoleTypeDisabledStandby, + RoleTypePrimary, + RoleTypeSnapshotStandby, + RoleTypeStandby, + } +} + +// SessionModeType - SessionModeType enum. +type SessionModeType string + +const ( + // SessionModeTypeDirect - DIRECT value + SessionModeTypeDirect SessionModeType = "Direct" + // SessionModeTypeRedirect - REDIRECT value + SessionModeTypeRedirect SessionModeType = "Redirect" +) + +// PossibleSessionModeTypeValues returns the possible values for the SessionModeType const type. +func PossibleSessionModeTypeValues() []SessionModeType { + return []SessionModeType{ + SessionModeTypeDirect, + SessionModeTypeRedirect, + } +} + +// SourceType - SourceType enum. +type SourceType string + +const ( + // SourceTypeBackupFromID - BACKUP_FROM_ID value + SourceTypeBackupFromID SourceType = "BackupFromId" + // SourceTypeBackupFromTimestamp - BACKUP_FROM_TIMESTAMP value + SourceTypeBackupFromTimestamp SourceType = "BackupFromTimestamp" + // SourceTypeCloneToRefreshable - CLONE_TO_REFRESHABLE value + SourceTypeCloneToRefreshable SourceType = "CloneToRefreshable" + // SourceTypeCrossRegionDataguard - CROSS_REGION_DATAGUARD value + SourceTypeCrossRegionDataguard SourceType = "CrossRegionDataguard" + // SourceTypeCrossRegionDisasterRecovery - CROSS_REGION_DISASTER_RECOVERY value + SourceTypeCrossRegionDisasterRecovery SourceType = "CrossRegionDisasterRecovery" + // SourceTypeDatabase - DATABASE value + SourceTypeDatabase SourceType = "Database" + // SourceTypeNone - NONE value + SourceTypeNone SourceType = "None" +) + +// PossibleSourceTypeValues returns the possible values for the SourceType const type. +func PossibleSourceTypeValues() []SourceType { + return []SourceType{ + SourceTypeBackupFromID, + SourceTypeBackupFromTimestamp, + SourceTypeCloneToRefreshable, + SourceTypeCrossRegionDataguard, + SourceTypeCrossRegionDisasterRecovery, + SourceTypeDatabase, + SourceTypeNone, + } +} + +// SyntaxFormatType - SyntaxFormatType enum. +type SyntaxFormatType string + +const ( + // SyntaxFormatTypeEzconnect - EZCONNECT value + SyntaxFormatTypeEzconnect SyntaxFormatType = "Ezconnect" + // SyntaxFormatTypeEzconnectplus - EZCONNECTPLUS value + SyntaxFormatTypeEzconnectplus SyntaxFormatType = "Ezconnectplus" + // SyntaxFormatTypeLong - LONG value + SyntaxFormatTypeLong SyntaxFormatType = "Long" +) + +// PossibleSyntaxFormatTypeValues returns the possible values for the SyntaxFormatType const type. +func PossibleSyntaxFormatTypeValues() []SyntaxFormatType { + return []SyntaxFormatType{ + SyntaxFormatTypeEzconnect, + SyntaxFormatTypeEzconnectplus, + SyntaxFormatTypeLong, + } +} + +// TLSAuthenticationType - TlsAuthenticationType enum. +type TLSAuthenticationType string + +const ( + // TLSAuthenticationTypeMutual - MUTUAL value + TLSAuthenticationTypeMutual TLSAuthenticationType = "Mutual" + // TLSAuthenticationTypeServer - SERVER value + TLSAuthenticationTypeServer TLSAuthenticationType = "Server" +) + +// PossibleTLSAuthenticationTypeValues returns the possible values for the TLSAuthenticationType const type. +func PossibleTLSAuthenticationTypeValues() []TLSAuthenticationType { + return []TLSAuthenticationType{ + TLSAuthenticationTypeMutual, + TLSAuthenticationTypeServer, + } +} + +// VirtualNetworkAddressLifecycleState - VirtualNetworkAddressLifecycleState enum +type VirtualNetworkAddressLifecycleState string + +const ( + // VirtualNetworkAddressLifecycleStateAvailable - Available value + VirtualNetworkAddressLifecycleStateAvailable VirtualNetworkAddressLifecycleState = "Available" + // VirtualNetworkAddressLifecycleStateFailed - Failed value + VirtualNetworkAddressLifecycleStateFailed VirtualNetworkAddressLifecycleState = "Failed" + // VirtualNetworkAddressLifecycleStateProvisioning - Provisioning value + VirtualNetworkAddressLifecycleStateProvisioning VirtualNetworkAddressLifecycleState = "Provisioning" + // VirtualNetworkAddressLifecycleStateTerminated - Terminated value + VirtualNetworkAddressLifecycleStateTerminated VirtualNetworkAddressLifecycleState = "Terminated" + // VirtualNetworkAddressLifecycleStateTerminating - Terminating value + VirtualNetworkAddressLifecycleStateTerminating VirtualNetworkAddressLifecycleState = "Terminating" +) + +// PossibleVirtualNetworkAddressLifecycleStateValues returns the possible values for the VirtualNetworkAddressLifecycleState const type. +func PossibleVirtualNetworkAddressLifecycleStateValues() []VirtualNetworkAddressLifecycleState { + return []VirtualNetworkAddressLifecycleState{ + VirtualNetworkAddressLifecycleStateAvailable, + VirtualNetworkAddressLifecycleStateFailed, + VirtualNetworkAddressLifecycleStateProvisioning, + VirtualNetworkAddressLifecycleStateTerminated, + VirtualNetworkAddressLifecycleStateTerminating, + } +} + +// WorkloadType - WorkloadType enum +type WorkloadType string + +const ( + // WorkloadTypeAJD - AJD - indicates an Autonomous JSON Database + WorkloadTypeAJD WorkloadType = "AJD" + // WorkloadTypeAPEX - APEX - indicates an Autonomous Database with the Oracle APEX Application Development workload type. + WorkloadTypeAPEX WorkloadType = "APEX" + // WorkloadTypeDW - DW - indicates an Autonomous Data Warehouse database + WorkloadTypeDW WorkloadType = "DW" + // WorkloadTypeOLTP - OLTP - indicates an Autonomous Transaction Processing database + WorkloadTypeOLTP WorkloadType = "OLTP" +) + +// PossibleWorkloadTypeValues returns the possible values for the WorkloadType const type. +func PossibleWorkloadTypeValues() []WorkloadType { + return []WorkloadType{ + WorkloadTypeAJD, + WorkloadTypeAPEX, + WorkloadTypeDW, + WorkloadTypeOLTP, + } +} + +// ZoneType - ZoneType enum +type ZoneType string + +const ( + // ZoneTypePrimary - Primary value + ZoneTypePrimary ZoneType = "Primary" + // ZoneTypeSecondary - Secondary value + ZoneTypeSecondary ZoneType = "Secondary" +) + +// PossibleZoneTypeValues returns the possible values for the ZoneType const type. +func PossibleZoneTypeValues() []ZoneType { + return []ZoneType{ + ZoneTypePrimary, + ZoneTypeSecondary, + } +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client.go new file mode 100644 index 000000000000..d12d678ee30b --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client.go @@ -0,0 +1,263 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DbNodesClient contains the methods for the DbNodes group. +// Don't use this type directly, use NewDbNodesClient() instead. +type DbNodesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDbNodesClient creates a new instance of DbNodesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDbNodesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DbNodesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DbNodesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginAction - VM actions on DbNode of VM Cluster by the provided filter +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - dbnodeocid - DbNode OCID. +// - body - The content of the action request +// - options - DbNodesClientBeginActionOptions contains the optional parameters for the DbNodesClient.BeginAction method. +func (client *DbNodesClient) BeginAction(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, body DbNodeAction, options *DbNodesClientBeginActionOptions) (*runtime.Poller[DbNodesClientActionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.action(ctx, resourceGroupName, cloudvmclustername, dbnodeocid, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DbNodesClientActionResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DbNodesClientActionResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Action - VM actions on DbNode of VM Cluster by the provided filter +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *DbNodesClient) action(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, body DbNodeAction, options *DbNodesClientBeginActionOptions) (*http.Response, error) { + var err error + const operationName = "DbNodesClient.BeginAction" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.actionCreateRequest(ctx, resourceGroupName, cloudvmclustername, dbnodeocid, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// actionCreateRequest creates the Action request. +func (client *DbNodesClient) actionCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, body DbNodeAction, options *DbNodesClientBeginActionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/dbNodes/{dbnodeocid}/action" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + if dbnodeocid == "" { + return nil, errors.New("parameter dbnodeocid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dbnodeocid}", url.PathEscape(dbnodeocid)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Get - Get a DbNode +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - dbnodeocid - DbNode OCID. +// - options - DbNodesClientGetOptions contains the optional parameters for the DbNodesClient.Get method. +func (client *DbNodesClient) Get(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, options *DbNodesClientGetOptions) (DbNodesClientGetResponse, error) { + var err error + const operationName = "DbNodesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, cloudvmclustername, dbnodeocid, options) + if err != nil { + return DbNodesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DbNodesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DbNodesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DbNodesClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, options *DbNodesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/dbNodes/{dbnodeocid}" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + if dbnodeocid == "" { + return nil, errors.New("parameter dbnodeocid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dbnodeocid}", url.PathEscape(dbnodeocid)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DbNodesClient) getHandleResponse(resp *http.Response) (DbNodesClientGetResponse, error) { + result := DbNodesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DbNode); err != nil { + return DbNodesClientGetResponse{}, err + } + return result, nil +} + +// NewListByCloudVMClusterPager - List DbNode resources by CloudVmCluster +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - options - DbNodesClientListByCloudVMClusterOptions contains the optional parameters for the DbNodesClient.NewListByCloudVMClusterPager +// method. +func (client *DbNodesClient) NewListByCloudVMClusterPager(resourceGroupName string, cloudvmclustername string, options *DbNodesClientListByCloudVMClusterOptions) *runtime.Pager[DbNodesClientListByCloudVMClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[DbNodesClientListByCloudVMClusterResponse]{ + More: func(page DbNodesClientListByCloudVMClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DbNodesClientListByCloudVMClusterResponse) (DbNodesClientListByCloudVMClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DbNodesClient.NewListByCloudVMClusterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByCloudVMClusterCreateRequest(ctx, resourceGroupName, cloudvmclustername, options) + }, nil) + if err != nil { + return DbNodesClientListByCloudVMClusterResponse{}, err + } + return client.listByCloudVMClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByCloudVMClusterCreateRequest creates the ListByCloudVMCluster request. +func (client *DbNodesClient) listByCloudVMClusterCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *DbNodesClientListByCloudVMClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/dbNodes" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByCloudVMClusterHandleResponse handles the ListByCloudVMCluster response. +func (client *DbNodesClient) listByCloudVMClusterHandleResponse(resp *http.Response) (DbNodesClientListByCloudVMClusterResponse, error) { + result := DbNodesClientListByCloudVMClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DbNodeListResult); err != nil { + return DbNodesClientListByCloudVMClusterResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client.go new file mode 100644 index 000000000000..048bd0dde0d8 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client.go @@ -0,0 +1,178 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DbServersClient contains the methods for the DbServers group. +// Don't use this type directly, use NewDbServersClient() instead. +type DbServersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDbServersClient creates a new instance of DbServersClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDbServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DbServersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DbServersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a DbServer +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudexadatainfrastructurename - CloudExadataInfrastructure name +// - dbserverocid - DbServer OCID. +// - options - DbServersClientGetOptions contains the optional parameters for the DbServersClient.Get method. +func (client *DbServersClient) Get(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, dbserverocid string, options *DbServersClientGetOptions) (DbServersClientGetResponse, error) { + var err error + const operationName = "DbServersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, cloudexadatainfrastructurename, dbserverocid, options) + if err != nil { + return DbServersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DbServersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DbServersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DbServersClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, dbserverocid string, options *DbServersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}/dbServers/{dbserverocid}" + 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 cloudexadatainfrastructurename == "" { + return nil, errors.New("parameter cloudexadatainfrastructurename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudexadatainfrastructurename}", url.PathEscape(cloudexadatainfrastructurename)) + if dbserverocid == "" { + return nil, errors.New("parameter dbserverocid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dbserverocid}", url.PathEscape(dbserverocid)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DbServersClient) getHandleResponse(resp *http.Response) (DbServersClientGetResponse, error) { + result := DbServersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DbServer); err != nil { + return DbServersClientGetResponse{}, err + } + return result, nil +} + +// NewListByCloudExadataInfrastructurePager - List DbServer resources by CloudExadataInfrastructure +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudexadatainfrastructurename - CloudExadataInfrastructure name +// - options - DbServersClientListByCloudExadataInfrastructureOptions contains the optional parameters for the DbServersClient.NewListByCloudExadataInfrastructurePager +// method. +func (client *DbServersClient) NewListByCloudExadataInfrastructurePager(resourceGroupName string, cloudexadatainfrastructurename string, options *DbServersClientListByCloudExadataInfrastructureOptions) *runtime.Pager[DbServersClientListByCloudExadataInfrastructureResponse] { + return runtime.NewPager(runtime.PagingHandler[DbServersClientListByCloudExadataInfrastructureResponse]{ + More: func(page DbServersClientListByCloudExadataInfrastructureResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DbServersClientListByCloudExadataInfrastructureResponse) (DbServersClientListByCloudExadataInfrastructureResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DbServersClient.NewListByCloudExadataInfrastructurePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByCloudExadataInfrastructureCreateRequest(ctx, resourceGroupName, cloudexadatainfrastructurename, options) + }, nil) + if err != nil { + return DbServersClientListByCloudExadataInfrastructureResponse{}, err + } + return client.listByCloudExadataInfrastructureHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByCloudExadataInfrastructureCreateRequest creates the ListByCloudExadataInfrastructure request. +func (client *DbServersClient) listByCloudExadataInfrastructureCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *DbServersClientListByCloudExadataInfrastructureOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}/dbServers" + 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 cloudexadatainfrastructurename == "" { + return nil, errors.New("parameter cloudexadatainfrastructurename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudexadatainfrastructurename}", url.PathEscape(cloudexadatainfrastructurename)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByCloudExadataInfrastructureHandleResponse handles the ListByCloudExadataInfrastructure response. +func (client *DbServersClient) listByCloudExadataInfrastructureHandleResponse(resp *http.Response) (DbServersClientListByCloudExadataInfrastructureResponse, error) { + result := DbServersClientListByCloudExadataInfrastructureResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DbServerListResult); err != nil { + return DbServersClientListByCloudExadataInfrastructureResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client.go new file mode 100644 index 000000000000..0ff8cb4947cc --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client.go @@ -0,0 +1,168 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DbSystemShapesClient contains the methods for the DbSystemShapes group. +// Don't use this type directly, use NewDbSystemShapesClient() instead. +type DbSystemShapesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDbSystemShapesClient creates a new instance of DbSystemShapesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDbSystemShapesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DbSystemShapesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DbSystemShapesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a DbSystemShape +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - dbsystemshapename - DbSystemShape name +// - options - DbSystemShapesClientGetOptions contains the optional parameters for the DbSystemShapesClient.Get method. +func (client *DbSystemShapesClient) Get(ctx context.Context, location string, dbsystemshapename string, options *DbSystemShapesClientGetOptions) (DbSystemShapesClientGetResponse, error) { + var err error + const operationName = "DbSystemShapesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, dbsystemshapename, options) + if err != nil { + return DbSystemShapesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DbSystemShapesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DbSystemShapesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DbSystemShapesClient) getCreateRequest(ctx context.Context, location string, dbsystemshapename string, options *DbSystemShapesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dbSystemShapes/{dbsystemshapename}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if dbsystemshapename == "" { + return nil, errors.New("parameter dbsystemshapename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dbsystemshapename}", url.PathEscape(dbsystemshapename)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DbSystemShapesClient) getHandleResponse(resp *http.Response) (DbSystemShapesClientGetResponse, error) { + result := DbSystemShapesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DbSystemShape); err != nil { + return DbSystemShapesClientGetResponse{}, err + } + return result, nil +} + +// NewListByLocationPager - List DbSystemShape resources by Location +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - options - DbSystemShapesClientListByLocationOptions contains the optional parameters for the DbSystemShapesClient.NewListByLocationPager +// method. +func (client *DbSystemShapesClient) NewListByLocationPager(location string, options *DbSystemShapesClientListByLocationOptions) *runtime.Pager[DbSystemShapesClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[DbSystemShapesClientListByLocationResponse]{ + More: func(page DbSystemShapesClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DbSystemShapesClientListByLocationResponse) (DbSystemShapesClientListByLocationResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DbSystemShapesClient.NewListByLocationPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByLocationCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return DbSystemShapesClientListByLocationResponse{}, err + } + return client.listByLocationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *DbSystemShapesClient) listByLocationCreateRequest(ctx context.Context, location string, options *DbSystemShapesClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dbSystemShapes" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *DbSystemShapesClient) listByLocationHandleResponse(resp *http.Response) (DbSystemShapesClientListByLocationResponse, error) { + result := DbSystemShapesClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DbSystemShapeListResult); err != nil { + return DbSystemShapesClientListByLocationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client.go new file mode 100644 index 000000000000..4ed3f11c3928 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client.go @@ -0,0 +1,168 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DNSPrivateViewsClient contains the methods for the DNSPrivateViews group. +// Don't use this type directly, use NewDNSPrivateViewsClient() instead. +type DNSPrivateViewsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDNSPrivateViewsClient creates a new instance of DNSPrivateViewsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDNSPrivateViewsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DNSPrivateViewsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DNSPrivateViewsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a DnsPrivateView +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - dnsprivateviewocid - DnsPrivateView OCID +// - options - DNSPrivateViewsClientGetOptions contains the optional parameters for the DNSPrivateViewsClient.Get method. +func (client *DNSPrivateViewsClient) Get(ctx context.Context, location string, dnsprivateviewocid string, options *DNSPrivateViewsClientGetOptions) (DNSPrivateViewsClientGetResponse, error) { + var err error + const operationName = "DNSPrivateViewsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, dnsprivateviewocid, options) + if err != nil { + return DNSPrivateViewsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DNSPrivateViewsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DNSPrivateViewsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DNSPrivateViewsClient) getCreateRequest(ctx context.Context, location string, dnsprivateviewocid string, options *DNSPrivateViewsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateViews/{dnsprivateviewocid}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if dnsprivateviewocid == "" { + return nil, errors.New("parameter dnsprivateviewocid cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dnsprivateviewocid}", url.PathEscape(dnsprivateviewocid)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DNSPrivateViewsClient) getHandleResponse(resp *http.Response) (DNSPrivateViewsClientGetResponse, error) { + result := DNSPrivateViewsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DNSPrivateView); err != nil { + return DNSPrivateViewsClientGetResponse{}, err + } + return result, nil +} + +// NewListByLocationPager - List DnsPrivateView resources by Location +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - options - DNSPrivateViewsClientListByLocationOptions contains the optional parameters for the DNSPrivateViewsClient.NewListByLocationPager +// method. +func (client *DNSPrivateViewsClient) NewListByLocationPager(location string, options *DNSPrivateViewsClientListByLocationOptions) *runtime.Pager[DNSPrivateViewsClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[DNSPrivateViewsClientListByLocationResponse]{ + More: func(page DNSPrivateViewsClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DNSPrivateViewsClientListByLocationResponse) (DNSPrivateViewsClientListByLocationResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DNSPrivateViewsClient.NewListByLocationPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByLocationCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return DNSPrivateViewsClientListByLocationResponse{}, err + } + return client.listByLocationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *DNSPrivateViewsClient) listByLocationCreateRequest(ctx context.Context, location string, options *DNSPrivateViewsClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateViews" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *DNSPrivateViewsClient) listByLocationHandleResponse(resp *http.Response) (DNSPrivateViewsClientListByLocationResponse, error) { + result := DNSPrivateViewsClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DNSPrivateViewListResult); err != nil { + return DNSPrivateViewsClientListByLocationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client.go new file mode 100644 index 000000000000..154edec92b15 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client.go @@ -0,0 +1,168 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DNSPrivateZonesClient contains the methods for the DNSPrivateZones group. +// Don't use this type directly, use NewDNSPrivateZonesClient() instead. +type DNSPrivateZonesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDNSPrivateZonesClient creates a new instance of DNSPrivateZonesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDNSPrivateZonesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DNSPrivateZonesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DNSPrivateZonesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a DnsPrivateZone +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - dnsprivatezonename - DnsPrivateZone name +// - options - DNSPrivateZonesClientGetOptions contains the optional parameters for the DNSPrivateZonesClient.Get method. +func (client *DNSPrivateZonesClient) Get(ctx context.Context, location string, dnsprivatezonename string, options *DNSPrivateZonesClientGetOptions) (DNSPrivateZonesClientGetResponse, error) { + var err error + const operationName = "DNSPrivateZonesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, dnsprivatezonename, options) + if err != nil { + return DNSPrivateZonesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DNSPrivateZonesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DNSPrivateZonesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DNSPrivateZonesClient) getCreateRequest(ctx context.Context, location string, dnsprivatezonename string, options *DNSPrivateZonesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateZones/{dnsprivatezonename}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if dnsprivatezonename == "" { + return nil, errors.New("parameter dnsprivatezonename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dnsprivatezonename}", url.PathEscape(dnsprivatezonename)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DNSPrivateZonesClient) getHandleResponse(resp *http.Response) (DNSPrivateZonesClientGetResponse, error) { + result := DNSPrivateZonesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DNSPrivateZone); err != nil { + return DNSPrivateZonesClientGetResponse{}, err + } + return result, nil +} + +// NewListByLocationPager - List DnsPrivateZone resources by Location +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - options - DNSPrivateZonesClientListByLocationOptions contains the optional parameters for the DNSPrivateZonesClient.NewListByLocationPager +// method. +func (client *DNSPrivateZonesClient) NewListByLocationPager(location string, options *DNSPrivateZonesClientListByLocationOptions) *runtime.Pager[DNSPrivateZonesClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[DNSPrivateZonesClientListByLocationResponse]{ + More: func(page DNSPrivateZonesClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DNSPrivateZonesClientListByLocationResponse) (DNSPrivateZonesClientListByLocationResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DNSPrivateZonesClient.NewListByLocationPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByLocationCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return DNSPrivateZonesClientListByLocationResponse{}, err + } + return client.listByLocationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *DNSPrivateZonesClient) listByLocationCreateRequest(ctx context.Context, location string, options *DNSPrivateZonesClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateZones" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *DNSPrivateZonesClient) listByLocationHandleResponse(resp *http.Response) (DNSPrivateZonesClientListByLocationResponse, error) { + result := DNSPrivateZonesClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DNSPrivateZoneListResult); err != nil { + return DNSPrivateZonesClientListByLocationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasebackups_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasebackups_server.go new file mode 100644 index 000000000000..5e0bd6cdfd6b --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasebackups_server.go @@ -0,0 +1,332 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// AutonomousDatabaseBackupsServer is a fake server for instances of the armoracledatabase.AutonomousDatabaseBackupsClient type. +type AutonomousDatabaseBackupsServer struct { + // BeginCreateOrUpdate is the fake for method AutonomousDatabaseBackupsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, resource armoracledatabase.AutonomousDatabaseBackup, options *armoracledatabase.AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method AutonomousDatabaseBackupsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, options *armoracledatabase.AutonomousDatabaseBackupsClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AutonomousDatabaseBackupsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, options *armoracledatabase.AutonomousDatabaseBackupsClientGetOptions) (resp azfake.Responder[armoracledatabase.AutonomousDatabaseBackupsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByAutonomousDatabasePager is the fake for method AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager + // HTTP status codes to indicate success: http.StatusOK + NewListByAutonomousDatabasePager func(resourceGroupName string, autonomousdatabasename string, options *armoracledatabase.AutonomousDatabaseBackupsClientListByAutonomousDatabaseOptions) (resp azfake.PagerResponder[armoracledatabase.AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse]) + + // BeginUpdate is the fake for method AutonomousDatabaseBackupsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, properties armoracledatabase.AutonomousDatabaseBackupUpdate, options *armoracledatabase.AutonomousDatabaseBackupsClientBeginUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewAutonomousDatabaseBackupsServerTransport creates a new instance of AutonomousDatabaseBackupsServerTransport with the provided implementation. +// The returned AutonomousDatabaseBackupsServerTransport instance is connected to an instance of armoracledatabase.AutonomousDatabaseBackupsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAutonomousDatabaseBackupsServerTransport(srv *AutonomousDatabaseBackupsServer) *AutonomousDatabaseBackupsServerTransport { + return &AutonomousDatabaseBackupsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientDeleteResponse]](), + newListByAutonomousDatabasePager: newTracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientUpdateResponse]](), + } +} + +// AutonomousDatabaseBackupsServerTransport connects instances of armoracledatabase.AutonomousDatabaseBackupsClient to instances of AutonomousDatabaseBackupsServer. +// Don't use this type directly, use NewAutonomousDatabaseBackupsServerTransport instead. +type AutonomousDatabaseBackupsServerTransport struct { + srv *AutonomousDatabaseBackupsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientDeleteResponse]] + newListByAutonomousDatabasePager *tracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse]] + beginUpdate *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for AutonomousDatabaseBackupsServerTransport. +func (a *AutonomousDatabaseBackupsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "AutonomousDatabaseBackupsClient.BeginCreateOrUpdate": + resp, err = a.dispatchBeginCreateOrUpdate(req) + case "AutonomousDatabaseBackupsClient.BeginDelete": + resp, err = a.dispatchBeginDelete(req) + case "AutonomousDatabaseBackupsClient.Get": + resp, err = a.dispatchGet(req) + case "AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager": + resp, err = a.dispatchNewListByAutonomousDatabasePager(req) + case "AutonomousDatabaseBackupsClient.BeginUpdate": + resp, err = a.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AutonomousDatabaseBackupsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseBackups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AutonomousDatabaseBackup](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + autonomousdatabasenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdatabasename")]) + if err != nil { + return nil, err + } + adbbackupidParam, err := url.PathUnescape(matches[regex.SubexpIndex("adbbackupid")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, autonomousdatabasenameParam, adbbackupidParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + a.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + a.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + a.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (a *AutonomousDatabaseBackupsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseBackups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + autonomousdatabasenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdatabasename")]) + if err != nil { + return nil, err + } + adbbackupidParam, err := url.PathUnescape(matches[regex.SubexpIndex("adbbackupid")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, autonomousdatabasenameParam, adbbackupidParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *AutonomousDatabaseBackupsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseBackups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + autonomousdatabasenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdatabasename")]) + if err != nil { + return nil, err + } + adbbackupidParam, err := url.PathUnescape(matches[regex.SubexpIndex("adbbackupid")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, autonomousdatabasenameParam, adbbackupidParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutonomousDatabaseBackup, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AutonomousDatabaseBackupsServerTransport) dispatchNewListByAutonomousDatabasePager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByAutonomousDatabasePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByAutonomousDatabasePager not implemented")} + } + newListByAutonomousDatabasePager := a.newListByAutonomousDatabasePager.get(req) + if newListByAutonomousDatabasePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseBackups` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + autonomousdatabasenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdatabasename")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListByAutonomousDatabasePager(resourceGroupNameParam, autonomousdatabasenameParam, nil) + newListByAutonomousDatabasePager = &resp + a.newListByAutonomousDatabasePager.add(req, newListByAutonomousDatabasePager) + server.PagerResponderInjectNextLinks(newListByAutonomousDatabasePager, req, func(page *armoracledatabase.AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByAutonomousDatabasePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByAutonomousDatabasePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByAutonomousDatabasePager) { + a.newListByAutonomousDatabasePager.remove(req) + } + return resp, nil +} + +func (a *AutonomousDatabaseBackupsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := a.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseBackups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AutonomousDatabaseBackupUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + autonomousdatabasenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdatabasename")]) + if err != nil { + return nil, err + } + adbbackupidParam, err := url.PathUnescape(matches[regex.SubexpIndex("adbbackupid")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginUpdate(req.Context(), resourceGroupNameParam, autonomousdatabasenameParam, adbbackupidParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + a.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + a.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasecharactersets_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasecharactersets_server.go new file mode 100644 index 000000000000..9d1bd70f9046 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasecharactersets_server.go @@ -0,0 +1,148 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// AutonomousDatabaseCharacterSetsServer is a fake server for instances of the armoracledatabase.AutonomousDatabaseCharacterSetsClient type. +type AutonomousDatabaseCharacterSetsServer struct { + // Get is the fake for method AutonomousDatabaseCharacterSetsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, location string, adbscharsetname string, options *armoracledatabase.AutonomousDatabaseCharacterSetsClientGetOptions) (resp azfake.Responder[armoracledatabase.AutonomousDatabaseCharacterSetsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByLocationPager is the fake for method AutonomousDatabaseCharacterSetsClient.NewListByLocationPager + // HTTP status codes to indicate success: http.StatusOK + NewListByLocationPager func(location string, options *armoracledatabase.AutonomousDatabaseCharacterSetsClientListByLocationOptions) (resp azfake.PagerResponder[armoracledatabase.AutonomousDatabaseCharacterSetsClientListByLocationResponse]) +} + +// NewAutonomousDatabaseCharacterSetsServerTransport creates a new instance of AutonomousDatabaseCharacterSetsServerTransport with the provided implementation. +// The returned AutonomousDatabaseCharacterSetsServerTransport instance is connected to an instance of armoracledatabase.AutonomousDatabaseCharacterSetsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAutonomousDatabaseCharacterSetsServerTransport(srv *AutonomousDatabaseCharacterSetsServer) *AutonomousDatabaseCharacterSetsServerTransport { + return &AutonomousDatabaseCharacterSetsServerTransport{ + srv: srv, + newListByLocationPager: newTracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabaseCharacterSetsClientListByLocationResponse]](), + } +} + +// AutonomousDatabaseCharacterSetsServerTransport connects instances of armoracledatabase.AutonomousDatabaseCharacterSetsClient to instances of AutonomousDatabaseCharacterSetsServer. +// Don't use this type directly, use NewAutonomousDatabaseCharacterSetsServerTransport instead. +type AutonomousDatabaseCharacterSetsServerTransport struct { + srv *AutonomousDatabaseCharacterSetsServer + newListByLocationPager *tracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabaseCharacterSetsClientListByLocationResponse]] +} + +// Do implements the policy.Transporter interface for AutonomousDatabaseCharacterSetsServerTransport. +func (a *AutonomousDatabaseCharacterSetsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "AutonomousDatabaseCharacterSetsClient.Get": + resp, err = a.dispatchGet(req) + case "AutonomousDatabaseCharacterSetsClient.NewListByLocationPager": + resp, err = a.dispatchNewListByLocationPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AutonomousDatabaseCharacterSetsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseCharacterSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + adbscharsetnameParam, err := url.PathUnescape(matches[regex.SubexpIndex("adbscharsetname")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), locationParam, adbscharsetnameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutonomousDatabaseCharacterSet, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AutonomousDatabaseCharacterSetsServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByLocationPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByLocationPager not implemented")} + } + newListByLocationPager := a.newListByLocationPager.get(req) + if newListByLocationPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseCharacterSets` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListByLocationPager(locationParam, nil) + newListByLocationPager = &resp + a.newListByLocationPager.add(req, newListByLocationPager) + server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armoracledatabase.AutonomousDatabaseCharacterSetsClientListByLocationResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByLocationPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByLocationPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByLocationPager) { + a.newListByLocationPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasenationalcharactersets_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasenationalcharactersets_server.go new file mode 100644 index 000000000000..dafabee3cd7d --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasenationalcharactersets_server.go @@ -0,0 +1,148 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// AutonomousDatabaseNationalCharacterSetsServer is a fake server for instances of the armoracledatabase.AutonomousDatabaseNationalCharacterSetsClient type. +type AutonomousDatabaseNationalCharacterSetsServer struct { + // Get is the fake for method AutonomousDatabaseNationalCharacterSetsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, location string, adbsncharsetname string, options *armoracledatabase.AutonomousDatabaseNationalCharacterSetsClientGetOptions) (resp azfake.Responder[armoracledatabase.AutonomousDatabaseNationalCharacterSetsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByLocationPager is the fake for method AutonomousDatabaseNationalCharacterSetsClient.NewListByLocationPager + // HTTP status codes to indicate success: http.StatusOK + NewListByLocationPager func(location string, options *armoracledatabase.AutonomousDatabaseNationalCharacterSetsClientListByLocationOptions) (resp azfake.PagerResponder[armoracledatabase.AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse]) +} + +// NewAutonomousDatabaseNationalCharacterSetsServerTransport creates a new instance of AutonomousDatabaseNationalCharacterSetsServerTransport with the provided implementation. +// The returned AutonomousDatabaseNationalCharacterSetsServerTransport instance is connected to an instance of armoracledatabase.AutonomousDatabaseNationalCharacterSetsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAutonomousDatabaseNationalCharacterSetsServerTransport(srv *AutonomousDatabaseNationalCharacterSetsServer) *AutonomousDatabaseNationalCharacterSetsServerTransport { + return &AutonomousDatabaseNationalCharacterSetsServerTransport{ + srv: srv, + newListByLocationPager: newTracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse]](), + } +} + +// AutonomousDatabaseNationalCharacterSetsServerTransport connects instances of armoracledatabase.AutonomousDatabaseNationalCharacterSetsClient to instances of AutonomousDatabaseNationalCharacterSetsServer. +// Don't use this type directly, use NewAutonomousDatabaseNationalCharacterSetsServerTransport instead. +type AutonomousDatabaseNationalCharacterSetsServerTransport struct { + srv *AutonomousDatabaseNationalCharacterSetsServer + newListByLocationPager *tracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse]] +} + +// Do implements the policy.Transporter interface for AutonomousDatabaseNationalCharacterSetsServerTransport. +func (a *AutonomousDatabaseNationalCharacterSetsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "AutonomousDatabaseNationalCharacterSetsClient.Get": + resp, err = a.dispatchGet(req) + case "AutonomousDatabaseNationalCharacterSetsClient.NewListByLocationPager": + resp, err = a.dispatchNewListByLocationPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AutonomousDatabaseNationalCharacterSetsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseNationalCharacterSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + adbsncharsetnameParam, err := url.PathUnescape(matches[regex.SubexpIndex("adbsncharsetname")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), locationParam, adbsncharsetnameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutonomousDatabaseNationalCharacterSet, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AutonomousDatabaseNationalCharacterSetsServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByLocationPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByLocationPager not implemented")} + } + newListByLocationPager := a.newListByLocationPager.get(req) + if newListByLocationPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseNationalCharacterSets` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListByLocationPager(locationParam, nil) + newListByLocationPager = &resp + a.newListByLocationPager.add(req, newListByLocationPager) + server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armoracledatabase.AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByLocationPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByLocationPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByLocationPager) { + a.newListByLocationPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabases_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabases_server.go new file mode 100644 index 000000000000..c57ed2ca5b10 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabases_server.go @@ -0,0 +1,508 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// AutonomousDatabasesServer is a fake server for instances of the armoracledatabase.AutonomousDatabasesClient type. +type AutonomousDatabasesServer struct { + // BeginCreateOrUpdate is the fake for method AutonomousDatabasesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, resource armoracledatabase.AutonomousDatabase, options *armoracledatabase.AutonomousDatabasesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method AutonomousDatabasesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *armoracledatabase.AutonomousDatabasesClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientDeleteResponse], errResp azfake.ErrorResponder) + + // BeginFailover is the fake for method AutonomousDatabasesClient.BeginFailover + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginFailover func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body armoracledatabase.PeerDbDetails, options *armoracledatabase.AutonomousDatabasesClientBeginFailoverOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientFailoverResponse], errResp azfake.ErrorResponder) + + // GenerateWallet is the fake for method AutonomousDatabasesClient.GenerateWallet + // HTTP status codes to indicate success: http.StatusOK + GenerateWallet func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body armoracledatabase.GenerateAutonomousDatabaseWalletDetails, options *armoracledatabase.AutonomousDatabasesClientGenerateWalletOptions) (resp azfake.Responder[armoracledatabase.AutonomousDatabasesClientGenerateWalletResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AutonomousDatabasesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *armoracledatabase.AutonomousDatabasesClientGetOptions) (resp azfake.Responder[armoracledatabase.AutonomousDatabasesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method AutonomousDatabasesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armoracledatabase.AutonomousDatabasesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method AutonomousDatabasesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armoracledatabase.AutonomousDatabasesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListBySubscriptionResponse]) + + // BeginSwitchover is the fake for method AutonomousDatabasesClient.BeginSwitchover + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginSwitchover func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body armoracledatabase.PeerDbDetails, options *armoracledatabase.AutonomousDatabasesClientBeginSwitchoverOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientSwitchoverResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method AutonomousDatabasesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, properties armoracledatabase.AutonomousDatabaseUpdate, options *armoracledatabase.AutonomousDatabasesClientBeginUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewAutonomousDatabasesServerTransport creates a new instance of AutonomousDatabasesServerTransport with the provided implementation. +// The returned AutonomousDatabasesServerTransport instance is connected to an instance of armoracledatabase.AutonomousDatabasesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAutonomousDatabasesServerTransport(srv *AutonomousDatabasesServer) *AutonomousDatabasesServerTransport { + return &AutonomousDatabasesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientDeleteResponse]](), + beginFailover: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientFailoverResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListBySubscriptionResponse]](), + beginSwitchover: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientSwitchoverResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientUpdateResponse]](), + } +} + +// AutonomousDatabasesServerTransport connects instances of armoracledatabase.AutonomousDatabasesClient to instances of AutonomousDatabasesServer. +// Don't use this type directly, use NewAutonomousDatabasesServerTransport instead. +type AutonomousDatabasesServerTransport struct { + srv *AutonomousDatabasesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientDeleteResponse]] + beginFailover *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientFailoverResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListBySubscriptionResponse]] + beginSwitchover *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientSwitchoverResponse]] + beginUpdate *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for AutonomousDatabasesServerTransport. +func (a *AutonomousDatabasesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "AutonomousDatabasesClient.BeginCreateOrUpdate": + resp, err = a.dispatchBeginCreateOrUpdate(req) + case "AutonomousDatabasesClient.BeginDelete": + resp, err = a.dispatchBeginDelete(req) + case "AutonomousDatabasesClient.BeginFailover": + resp, err = a.dispatchBeginFailover(req) + case "AutonomousDatabasesClient.GenerateWallet": + resp, err = a.dispatchGenerateWallet(req) + case "AutonomousDatabasesClient.Get": + resp, err = a.dispatchGet(req) + case "AutonomousDatabasesClient.NewListByResourceGroupPager": + resp, err = a.dispatchNewListByResourceGroupPager(req) + case "AutonomousDatabasesClient.NewListBySubscriptionPager": + resp, err = a.dispatchNewListBySubscriptionPager(req) + case "AutonomousDatabasesClient.BeginSwitchover": + resp, err = a.dispatchBeginSwitchover(req) + case "AutonomousDatabasesClient.BeginUpdate": + resp, err = a.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AutonomousDatabasesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AutonomousDatabase](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + autonomousdatabasenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdatabasename")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, autonomousdatabasenameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + a.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + a.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + a.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (a *AutonomousDatabasesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + autonomousdatabasenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdatabasename")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, autonomousdatabasenameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *AutonomousDatabasesServerTransport) dispatchBeginFailover(req *http.Request) (*http.Response, error) { + if a.srv.BeginFailover == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginFailover not implemented")} + } + beginFailover := a.beginFailover.get(req) + if beginFailover == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/failover` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.PeerDbDetails](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + autonomousdatabasenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdatabasename")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginFailover(req.Context(), resourceGroupNameParam, autonomousdatabasenameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginFailover = &respr + a.beginFailover.add(req, beginFailover) + } + + resp, err := server.PollerResponderNext(beginFailover, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginFailover.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginFailover) { + a.beginFailover.remove(req) + } + + return resp, nil +} + +func (a *AutonomousDatabasesServerTransport) dispatchGenerateWallet(req *http.Request) (*http.Response, error) { + if a.srv.GenerateWallet == nil { + return nil, &nonRetriableError{errors.New("fake for method GenerateWallet not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generateWallet` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.GenerateAutonomousDatabaseWalletDetails](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + autonomousdatabasenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdatabasename")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.GenerateWallet(req.Context(), resourceGroupNameParam, autonomousdatabasenameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutonomousDatabaseWalletFile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AutonomousDatabasesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + autonomousdatabasenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdatabasename")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, autonomousdatabasenameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutonomousDatabase, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AutonomousDatabasesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armoracledatabase.AutonomousDatabasesClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + a.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (a *AutonomousDatabasesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := a.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := a.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armoracledatabase.AutonomousDatabasesClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + a.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (a *AutonomousDatabasesServerTransport) dispatchBeginSwitchover(req *http.Request) (*http.Response, error) { + if a.srv.BeginSwitchover == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSwitchover not implemented")} + } + beginSwitchover := a.beginSwitchover.get(req) + if beginSwitchover == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/switchover` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.PeerDbDetails](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + autonomousdatabasenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdatabasename")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginSwitchover(req.Context(), resourceGroupNameParam, autonomousdatabasenameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSwitchover = &respr + a.beginSwitchover.add(req, beginSwitchover) + } + + resp, err := server.PollerResponderNext(beginSwitchover, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginSwitchover.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSwitchover) { + a.beginSwitchover.remove(req) + } + + return resp, nil +} + +func (a *AutonomousDatabasesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := a.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AutonomousDatabaseUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + autonomousdatabasenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdatabasename")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginUpdate(req.Context(), resourceGroupNameParam, autonomousdatabasenameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + a.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + a.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabaseversions_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabaseversions_server.go new file mode 100644 index 000000000000..de5dcb9d5459 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabaseversions_server.go @@ -0,0 +1,148 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// AutonomousDatabaseVersionsServer is a fake server for instances of the armoracledatabase.AutonomousDatabaseVersionsClient type. +type AutonomousDatabaseVersionsServer struct { + // Get is the fake for method AutonomousDatabaseVersionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, location string, autonomousdbversionsname string, options *armoracledatabase.AutonomousDatabaseVersionsClientGetOptions) (resp azfake.Responder[armoracledatabase.AutonomousDatabaseVersionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByLocationPager is the fake for method AutonomousDatabaseVersionsClient.NewListByLocationPager + // HTTP status codes to indicate success: http.StatusOK + NewListByLocationPager func(location string, options *armoracledatabase.AutonomousDatabaseVersionsClientListByLocationOptions) (resp azfake.PagerResponder[armoracledatabase.AutonomousDatabaseVersionsClientListByLocationResponse]) +} + +// NewAutonomousDatabaseVersionsServerTransport creates a new instance of AutonomousDatabaseVersionsServerTransport with the provided implementation. +// The returned AutonomousDatabaseVersionsServerTransport instance is connected to an instance of armoracledatabase.AutonomousDatabaseVersionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAutonomousDatabaseVersionsServerTransport(srv *AutonomousDatabaseVersionsServer) *AutonomousDatabaseVersionsServerTransport { + return &AutonomousDatabaseVersionsServerTransport{ + srv: srv, + newListByLocationPager: newTracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabaseVersionsClientListByLocationResponse]](), + } +} + +// AutonomousDatabaseVersionsServerTransport connects instances of armoracledatabase.AutonomousDatabaseVersionsClient to instances of AutonomousDatabaseVersionsServer. +// Don't use this type directly, use NewAutonomousDatabaseVersionsServerTransport instead. +type AutonomousDatabaseVersionsServerTransport struct { + srv *AutonomousDatabaseVersionsServer + newListByLocationPager *tracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabaseVersionsClientListByLocationResponse]] +} + +// Do implements the policy.Transporter interface for AutonomousDatabaseVersionsServerTransport. +func (a *AutonomousDatabaseVersionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "AutonomousDatabaseVersionsClient.Get": + resp, err = a.dispatchGet(req) + case "AutonomousDatabaseVersionsClient.NewListByLocationPager": + resp, err = a.dispatchNewListByLocationPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AutonomousDatabaseVersionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDbVersions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + autonomousdbversionsnameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdbversionsname")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), locationParam, autonomousdbversionsnameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutonomousDbVersion, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AutonomousDatabaseVersionsServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByLocationPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByLocationPager not implemented")} + } + newListByLocationPager := a.newListByLocationPager.get(req) + if newListByLocationPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDbVersions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListByLocationPager(locationParam, nil) + newListByLocationPager = &resp + a.newListByLocationPager.add(req, newListByLocationPager) + server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armoracledatabase.AutonomousDatabaseVersionsClientListByLocationResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByLocationPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByLocationPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByLocationPager) { + a.newListByLocationPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudexadatainfrastructures_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudexadatainfrastructures_server.go new file mode 100644 index 000000000000..851f6f489568 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudexadatainfrastructures_server.go @@ -0,0 +1,405 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// CloudExadataInfrastructuresServer is a fake server for instances of the armoracledatabase.CloudExadataInfrastructuresClient type. +type CloudExadataInfrastructuresServer struct { + // BeginAddStorageCapacity is the fake for method CloudExadataInfrastructuresClient.BeginAddStorageCapacity + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginAddStorageCapacity func(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *armoracledatabase.CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions) (resp azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientAddStorageCapacityResponse], errResp azfake.ErrorResponder) + + // BeginCreateOrUpdate is the fake for method CloudExadataInfrastructuresClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, resource armoracledatabase.CloudExadataInfrastructure, options *armoracledatabase.CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method CloudExadataInfrastructuresClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *armoracledatabase.CloudExadataInfrastructuresClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CloudExadataInfrastructuresClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *armoracledatabase.CloudExadataInfrastructuresClientGetOptions) (resp azfake.Responder[armoracledatabase.CloudExadataInfrastructuresClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method CloudExadataInfrastructuresClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armoracledatabase.CloudExadataInfrastructuresClientListByResourceGroupOptions) (resp azfake.PagerResponder[armoracledatabase.CloudExadataInfrastructuresClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method CloudExadataInfrastructuresClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armoracledatabase.CloudExadataInfrastructuresClientListBySubscriptionOptions) (resp azfake.PagerResponder[armoracledatabase.CloudExadataInfrastructuresClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method CloudExadataInfrastructuresClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, properties armoracledatabase.CloudExadataInfrastructureUpdate, options *armoracledatabase.CloudExadataInfrastructuresClientBeginUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewCloudExadataInfrastructuresServerTransport creates a new instance of CloudExadataInfrastructuresServerTransport with the provided implementation. +// The returned CloudExadataInfrastructuresServerTransport instance is connected to an instance of armoracledatabase.CloudExadataInfrastructuresClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCloudExadataInfrastructuresServerTransport(srv *CloudExadataInfrastructuresServer) *CloudExadataInfrastructuresServerTransport { + return &CloudExadataInfrastructuresServerTransport{ + srv: srv, + beginAddStorageCapacity: newTracker[azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientAddStorageCapacityResponse]](), + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armoracledatabase.CloudExadataInfrastructuresClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armoracledatabase.CloudExadataInfrastructuresClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientUpdateResponse]](), + } +} + +// CloudExadataInfrastructuresServerTransport connects instances of armoracledatabase.CloudExadataInfrastructuresClient to instances of CloudExadataInfrastructuresServer. +// Don't use this type directly, use NewCloudExadataInfrastructuresServerTransport instead. +type CloudExadataInfrastructuresServerTransport struct { + srv *CloudExadataInfrastructuresServer + beginAddStorageCapacity *tracker[azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientAddStorageCapacityResponse]] + beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armoracledatabase.CloudExadataInfrastructuresClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armoracledatabase.CloudExadataInfrastructuresClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for CloudExadataInfrastructuresServerTransport. +func (c *CloudExadataInfrastructuresServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CloudExadataInfrastructuresClient.BeginAddStorageCapacity": + resp, err = c.dispatchBeginAddStorageCapacity(req) + case "CloudExadataInfrastructuresClient.BeginCreateOrUpdate": + resp, err = c.dispatchBeginCreateOrUpdate(req) + case "CloudExadataInfrastructuresClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "CloudExadataInfrastructuresClient.Get": + resp, err = c.dispatchGet(req) + case "CloudExadataInfrastructuresClient.NewListByResourceGroupPager": + resp, err = c.dispatchNewListByResourceGroupPager(req) + case "CloudExadataInfrastructuresClient.NewListBySubscriptionPager": + resp, err = c.dispatchNewListBySubscriptionPager(req) + case "CloudExadataInfrastructuresClient.BeginUpdate": + resp, err = c.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CloudExadataInfrastructuresServerTransport) dispatchBeginAddStorageCapacity(req *http.Request) (*http.Response, error) { + if c.srv.BeginAddStorageCapacity == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginAddStorageCapacity not implemented")} + } + beginAddStorageCapacity := c.beginAddStorageCapacity.get(req) + if beginAddStorageCapacity == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/addStorageCapacity` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudexadatainfrastructurenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudexadatainfrastructurename")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginAddStorageCapacity(req.Context(), resourceGroupNameParam, cloudexadatainfrastructurenameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginAddStorageCapacity = &respr + c.beginAddStorageCapacity.add(req, beginAddStorageCapacity) + } + + resp, err := server.PollerResponderNext(beginAddStorageCapacity, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginAddStorageCapacity.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginAddStorageCapacity) { + c.beginAddStorageCapacity.remove(req) + } + + return resp, nil +} + +func (c *CloudExadataInfrastructuresServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := c.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.CloudExadataInfrastructure](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudexadatainfrastructurenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudexadatainfrastructurename")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, cloudexadatainfrastructurenameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + c.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (c *CloudExadataInfrastructuresServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudexadatainfrastructurenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudexadatainfrastructurename")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, cloudexadatainfrastructurenameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *CloudExadataInfrastructuresServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudexadatainfrastructurenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudexadatainfrastructurename")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, cloudexadatainfrastructurenameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CloudExadataInfrastructure, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CloudExadataInfrastructuresServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armoracledatabase.CloudExadataInfrastructuresClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + c.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (c *CloudExadataInfrastructuresServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := c.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armoracledatabase.CloudExadataInfrastructuresClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + c.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (c *CloudExadataInfrastructuresServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := c.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.CloudExadataInfrastructureUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudexadatainfrastructurenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudexadatainfrastructurename")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameParam, cloudexadatainfrastructurenameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + c.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + c.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudvmclusters_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudvmclusters_server.go new file mode 100644 index 000000000000..36881c8e6c04 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudvmclusters_server.go @@ -0,0 +1,508 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// CloudVMClustersServer is a fake server for instances of the armoracledatabase.CloudVMClustersClient type. +type CloudVMClustersServer struct { + // BeginAddVMs is the fake for method CloudVMClustersClient.BeginAddVMs + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginAddVMs func(ctx context.Context, resourceGroupName string, cloudvmclustername string, body armoracledatabase.AddRemoveDbNode, options *armoracledatabase.CloudVMClustersClientBeginAddVMsOptions) (resp azfake.PollerResponder[armoracledatabase.CloudVMClustersClientAddVMsResponse], errResp azfake.ErrorResponder) + + // BeginCreateOrUpdate is the fake for method CloudVMClustersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, cloudvmclustername string, resource armoracledatabase.CloudVMCluster, options *armoracledatabase.CloudVMClustersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.CloudVMClustersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method CloudVMClustersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *armoracledatabase.CloudVMClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.CloudVMClustersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CloudVMClustersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *armoracledatabase.CloudVMClustersClientGetOptions) (resp azfake.Responder[armoracledatabase.CloudVMClustersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method CloudVMClustersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armoracledatabase.CloudVMClustersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armoracledatabase.CloudVMClustersClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method CloudVMClustersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armoracledatabase.CloudVMClustersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armoracledatabase.CloudVMClustersClientListBySubscriptionResponse]) + + // ListPrivateIPAddresses is the fake for method CloudVMClustersClient.ListPrivateIPAddresses + // HTTP status codes to indicate success: http.StatusOK + ListPrivateIPAddresses func(ctx context.Context, resourceGroupName string, cloudvmclustername string, body armoracledatabase.PrivateIPAddressesFilter, options *armoracledatabase.CloudVMClustersClientListPrivateIPAddressesOptions) (resp azfake.Responder[armoracledatabase.CloudVMClustersClientListPrivateIPAddressesResponse], errResp azfake.ErrorResponder) + + // BeginRemoveVMs is the fake for method CloudVMClustersClient.BeginRemoveVMs + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginRemoveVMs func(ctx context.Context, resourceGroupName string, cloudvmclustername string, body armoracledatabase.AddRemoveDbNode, options *armoracledatabase.CloudVMClustersClientBeginRemoveVMsOptions) (resp azfake.PollerResponder[armoracledatabase.CloudVMClustersClientRemoveVMsResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method CloudVMClustersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, cloudvmclustername string, properties armoracledatabase.CloudVMClusterUpdate, options *armoracledatabase.CloudVMClustersClientBeginUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.CloudVMClustersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewCloudVMClustersServerTransport creates a new instance of CloudVMClustersServerTransport with the provided implementation. +// The returned CloudVMClustersServerTransport instance is connected to an instance of armoracledatabase.CloudVMClustersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCloudVMClustersServerTransport(srv *CloudVMClustersServer) *CloudVMClustersServerTransport { + return &CloudVMClustersServerTransport{ + srv: srv, + beginAddVMs: newTracker[azfake.PollerResponder[armoracledatabase.CloudVMClustersClientAddVMsResponse]](), + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.CloudVMClustersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.CloudVMClustersClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armoracledatabase.CloudVMClustersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armoracledatabase.CloudVMClustersClientListBySubscriptionResponse]](), + beginRemoveVMs: newTracker[azfake.PollerResponder[armoracledatabase.CloudVMClustersClientRemoveVMsResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armoracledatabase.CloudVMClustersClientUpdateResponse]](), + } +} + +// CloudVMClustersServerTransport connects instances of armoracledatabase.CloudVMClustersClient to instances of CloudVMClustersServer. +// Don't use this type directly, use NewCloudVMClustersServerTransport instead. +type CloudVMClustersServerTransport struct { + srv *CloudVMClustersServer + beginAddVMs *tracker[azfake.PollerResponder[armoracledatabase.CloudVMClustersClientAddVMsResponse]] + beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.CloudVMClustersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armoracledatabase.CloudVMClustersClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armoracledatabase.CloudVMClustersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armoracledatabase.CloudVMClustersClientListBySubscriptionResponse]] + beginRemoveVMs *tracker[azfake.PollerResponder[armoracledatabase.CloudVMClustersClientRemoveVMsResponse]] + beginUpdate *tracker[azfake.PollerResponder[armoracledatabase.CloudVMClustersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for CloudVMClustersServerTransport. +func (c *CloudVMClustersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CloudVMClustersClient.BeginAddVMs": + resp, err = c.dispatchBeginAddVMs(req) + case "CloudVMClustersClient.BeginCreateOrUpdate": + resp, err = c.dispatchBeginCreateOrUpdate(req) + case "CloudVMClustersClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "CloudVMClustersClient.Get": + resp, err = c.dispatchGet(req) + case "CloudVMClustersClient.NewListByResourceGroupPager": + resp, err = c.dispatchNewListByResourceGroupPager(req) + case "CloudVMClustersClient.NewListBySubscriptionPager": + resp, err = c.dispatchNewListBySubscriptionPager(req) + case "CloudVMClustersClient.ListPrivateIPAddresses": + resp, err = c.dispatchListPrivateIPAddresses(req) + case "CloudVMClustersClient.BeginRemoveVMs": + resp, err = c.dispatchBeginRemoveVMs(req) + case "CloudVMClustersClient.BeginUpdate": + resp, err = c.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CloudVMClustersServerTransport) dispatchBeginAddVMs(req *http.Request) (*http.Response, error) { + if c.srv.BeginAddVMs == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginAddVMs not implemented")} + } + beginAddVMs := c.beginAddVMs.get(req) + if beginAddVMs == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/addVms` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AddRemoveDbNode](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginAddVMs(req.Context(), resourceGroupNameParam, cloudvmclusternameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginAddVMs = &respr + c.beginAddVMs.add(req, beginAddVMs) + } + + resp, err := server.PollerResponderNext(beginAddVMs, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginAddVMs.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginAddVMs) { + c.beginAddVMs.remove(req) + } + + return resp, nil +} + +func (c *CloudVMClustersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := c.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.CloudVMCluster](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, cloudvmclusternameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + c.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (c *CloudVMClustersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, cloudvmclusternameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *CloudVMClustersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, cloudvmclusternameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CloudVMCluster, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CloudVMClustersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armoracledatabase.CloudVMClustersClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + c.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (c *CloudVMClustersServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := c.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armoracledatabase.CloudVMClustersClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + c.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (c *CloudVMClustersServerTransport) dispatchListPrivateIPAddresses(req *http.Request) (*http.Response, error) { + if c.srv.ListPrivateIPAddresses == nil { + return nil, &nonRetriableError{errors.New("fake for method ListPrivateIPAddresses not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listPrivateIpAddresses` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.PrivateIPAddressesFilter](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.ListPrivateIPAddresses(req.Context(), resourceGroupNameParam, cloudvmclusternameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateIPAddressPropertiesArray, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CloudVMClustersServerTransport) dispatchBeginRemoveVMs(req *http.Request) (*http.Response, error) { + if c.srv.BeginRemoveVMs == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRemoveVMs not implemented")} + } + beginRemoveVMs := c.beginRemoveVMs.get(req) + if beginRemoveVMs == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/removeVms` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AddRemoveDbNode](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginRemoveVMs(req.Context(), resourceGroupNameParam, cloudvmclusternameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRemoveVMs = &respr + c.beginRemoveVMs.add(req, beginRemoveVMs) + } + + resp, err := server.PollerResponderNext(beginRemoveVMs, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginRemoveVMs.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRemoveVMs) { + c.beginRemoveVMs.remove(req) + } + + return resp, nil +} + +func (c *CloudVMClustersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := c.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.CloudVMClusterUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameParam, cloudvmclusternameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + c.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + c.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbnodes_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbnodes_server.go new file mode 100644 index 000000000000..592576157fa6 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbnodes_server.go @@ -0,0 +1,216 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// DbNodesServer is a fake server for instances of the armoracledatabase.DbNodesClient type. +type DbNodesServer struct { + // BeginAction is the fake for method DbNodesClient.BeginAction + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginAction func(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, body armoracledatabase.DbNodeAction, options *armoracledatabase.DbNodesClientBeginActionOptions) (resp azfake.PollerResponder[armoracledatabase.DbNodesClientActionResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method DbNodesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, options *armoracledatabase.DbNodesClientGetOptions) (resp azfake.Responder[armoracledatabase.DbNodesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByCloudVMClusterPager is the fake for method DbNodesClient.NewListByCloudVMClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByCloudVMClusterPager func(resourceGroupName string, cloudvmclustername string, options *armoracledatabase.DbNodesClientListByCloudVMClusterOptions) (resp azfake.PagerResponder[armoracledatabase.DbNodesClientListByCloudVMClusterResponse]) +} + +// NewDbNodesServerTransport creates a new instance of DbNodesServerTransport with the provided implementation. +// The returned DbNodesServerTransport instance is connected to an instance of armoracledatabase.DbNodesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDbNodesServerTransport(srv *DbNodesServer) *DbNodesServerTransport { + return &DbNodesServerTransport{ + srv: srv, + beginAction: newTracker[azfake.PollerResponder[armoracledatabase.DbNodesClientActionResponse]](), + newListByCloudVMClusterPager: newTracker[azfake.PagerResponder[armoracledatabase.DbNodesClientListByCloudVMClusterResponse]](), + } +} + +// DbNodesServerTransport connects instances of armoracledatabase.DbNodesClient to instances of DbNodesServer. +// Don't use this type directly, use NewDbNodesServerTransport instead. +type DbNodesServerTransport struct { + srv *DbNodesServer + beginAction *tracker[azfake.PollerResponder[armoracledatabase.DbNodesClientActionResponse]] + newListByCloudVMClusterPager *tracker[azfake.PagerResponder[armoracledatabase.DbNodesClientListByCloudVMClusterResponse]] +} + +// Do implements the policy.Transporter interface for DbNodesServerTransport. +func (d *DbNodesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "DbNodesClient.BeginAction": + resp, err = d.dispatchBeginAction(req) + case "DbNodesClient.Get": + resp, err = d.dispatchGet(req) + case "DbNodesClient.NewListByCloudVMClusterPager": + resp, err = d.dispatchNewListByCloudVMClusterPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DbNodesServerTransport) dispatchBeginAction(req *http.Request) (*http.Response, error) { + if d.srv.BeginAction == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginAction not implemented")} + } + beginAction := d.beginAction.get(req) + if beginAction == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/action` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.DbNodeAction](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + dbnodeocidParam, err := url.PathUnescape(matches[regex.SubexpIndex("dbnodeocid")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginAction(req.Context(), resourceGroupNameParam, cloudvmclusternameParam, dbnodeocidParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginAction = &respr + d.beginAction.add(req, beginAction) + } + + resp, err := server.PollerResponderNext(beginAction, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + d.beginAction.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginAction) { + d.beginAction.remove(req) + } + + return resp, nil +} + +func (d *DbNodesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + dbnodeocidParam, err := url.PathUnescape(matches[regex.SubexpIndex("dbnodeocid")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, cloudvmclusternameParam, dbnodeocidParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DbNode, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DbNodesServerTransport) dispatchNewListByCloudVMClusterPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListByCloudVMClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByCloudVMClusterPager not implemented")} + } + newListByCloudVMClusterPager := d.newListByCloudVMClusterPager.get(req) + if newListByCloudVMClusterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbNodes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + resp := d.srv.NewListByCloudVMClusterPager(resourceGroupNameParam, cloudvmclusternameParam, nil) + newListByCloudVMClusterPager = &resp + d.newListByCloudVMClusterPager.add(req, newListByCloudVMClusterPager) + server.PagerResponderInjectNextLinks(newListByCloudVMClusterPager, req, func(page *armoracledatabase.DbNodesClientListByCloudVMClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByCloudVMClusterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListByCloudVMClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByCloudVMClusterPager) { + d.newListByCloudVMClusterPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbservers_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbservers_server.go new file mode 100644 index 000000000000..1235b75c166e --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbservers_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// DbServersServer is a fake server for instances of the armoracledatabase.DbServersClient type. +type DbServersServer struct { + // Get is the fake for method DbServersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, dbserverocid string, options *armoracledatabase.DbServersClientGetOptions) (resp azfake.Responder[armoracledatabase.DbServersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByCloudExadataInfrastructurePager is the fake for method DbServersClient.NewListByCloudExadataInfrastructurePager + // HTTP status codes to indicate success: http.StatusOK + NewListByCloudExadataInfrastructurePager func(resourceGroupName string, cloudexadatainfrastructurename string, options *armoracledatabase.DbServersClientListByCloudExadataInfrastructureOptions) (resp azfake.PagerResponder[armoracledatabase.DbServersClientListByCloudExadataInfrastructureResponse]) +} + +// NewDbServersServerTransport creates a new instance of DbServersServerTransport with the provided implementation. +// The returned DbServersServerTransport instance is connected to an instance of armoracledatabase.DbServersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDbServersServerTransport(srv *DbServersServer) *DbServersServerTransport { + return &DbServersServerTransport{ + srv: srv, + newListByCloudExadataInfrastructurePager: newTracker[azfake.PagerResponder[armoracledatabase.DbServersClientListByCloudExadataInfrastructureResponse]](), + } +} + +// DbServersServerTransport connects instances of armoracledatabase.DbServersClient to instances of DbServersServer. +// Don't use this type directly, use NewDbServersServerTransport instead. +type DbServersServerTransport struct { + srv *DbServersServer + newListByCloudExadataInfrastructurePager *tracker[azfake.PagerResponder[armoracledatabase.DbServersClientListByCloudExadataInfrastructureResponse]] +} + +// Do implements the policy.Transporter interface for DbServersServerTransport. +func (d *DbServersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "DbServersClient.Get": + resp, err = d.dispatchGet(req) + case "DbServersClient.NewListByCloudExadataInfrastructurePager": + resp, err = d.dispatchNewListByCloudExadataInfrastructurePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DbServersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudexadatainfrastructurenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudexadatainfrastructurename")]) + if err != nil { + return nil, err + } + dbserverocidParam, err := url.PathUnescape(matches[regex.SubexpIndex("dbserverocid")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, cloudexadatainfrastructurenameParam, dbserverocidParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DbServer, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DbServersServerTransport) dispatchNewListByCloudExadataInfrastructurePager(req *http.Request) (*http.Response, error) { + if d.srv.NewListByCloudExadataInfrastructurePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByCloudExadataInfrastructurePager not implemented")} + } + newListByCloudExadataInfrastructurePager := d.newListByCloudExadataInfrastructurePager.get(req) + if newListByCloudExadataInfrastructurePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbServers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudexadatainfrastructurenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudexadatainfrastructurename")]) + if err != nil { + return nil, err + } + resp := d.srv.NewListByCloudExadataInfrastructurePager(resourceGroupNameParam, cloudexadatainfrastructurenameParam, nil) + newListByCloudExadataInfrastructurePager = &resp + d.newListByCloudExadataInfrastructurePager.add(req, newListByCloudExadataInfrastructurePager) + server.PagerResponderInjectNextLinks(newListByCloudExadataInfrastructurePager, req, func(page *armoracledatabase.DbServersClientListByCloudExadataInfrastructureResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByCloudExadataInfrastructurePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListByCloudExadataInfrastructurePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByCloudExadataInfrastructurePager) { + d.newListByCloudExadataInfrastructurePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbsystemshapes_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbsystemshapes_server.go new file mode 100644 index 000000000000..3d93e8727067 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbsystemshapes_server.go @@ -0,0 +1,148 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// DbSystemShapesServer is a fake server for instances of the armoracledatabase.DbSystemShapesClient type. +type DbSystemShapesServer struct { + // Get is the fake for method DbSystemShapesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, location string, dbsystemshapename string, options *armoracledatabase.DbSystemShapesClientGetOptions) (resp azfake.Responder[armoracledatabase.DbSystemShapesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByLocationPager is the fake for method DbSystemShapesClient.NewListByLocationPager + // HTTP status codes to indicate success: http.StatusOK + NewListByLocationPager func(location string, options *armoracledatabase.DbSystemShapesClientListByLocationOptions) (resp azfake.PagerResponder[armoracledatabase.DbSystemShapesClientListByLocationResponse]) +} + +// NewDbSystemShapesServerTransport creates a new instance of DbSystemShapesServerTransport with the provided implementation. +// The returned DbSystemShapesServerTransport instance is connected to an instance of armoracledatabase.DbSystemShapesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDbSystemShapesServerTransport(srv *DbSystemShapesServer) *DbSystemShapesServerTransport { + return &DbSystemShapesServerTransport{ + srv: srv, + newListByLocationPager: newTracker[azfake.PagerResponder[armoracledatabase.DbSystemShapesClientListByLocationResponse]](), + } +} + +// DbSystemShapesServerTransport connects instances of armoracledatabase.DbSystemShapesClient to instances of DbSystemShapesServer. +// Don't use this type directly, use NewDbSystemShapesServerTransport instead. +type DbSystemShapesServerTransport struct { + srv *DbSystemShapesServer + newListByLocationPager *tracker[azfake.PagerResponder[armoracledatabase.DbSystemShapesClientListByLocationResponse]] +} + +// Do implements the policy.Transporter interface for DbSystemShapesServerTransport. +func (d *DbSystemShapesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "DbSystemShapesClient.Get": + resp, err = d.dispatchGet(req) + case "DbSystemShapesClient.NewListByLocationPager": + resp, err = d.dispatchNewListByLocationPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DbSystemShapesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbSystemShapes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + dbsystemshapenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dbsystemshapename")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), locationParam, dbsystemshapenameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DbSystemShape, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DbSystemShapesServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListByLocationPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByLocationPager not implemented")} + } + newListByLocationPager := d.newListByLocationPager.get(req) + if newListByLocationPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbSystemShapes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resp := d.srv.NewListByLocationPager(locationParam, nil) + newListByLocationPager = &resp + d.newListByLocationPager.add(req, newListByLocationPager) + server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armoracledatabase.DbSystemShapesClientListByLocationResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByLocationPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListByLocationPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByLocationPager) { + d.newListByLocationPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivateviews_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivateviews_server.go new file mode 100644 index 000000000000..53257e7ca744 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivateviews_server.go @@ -0,0 +1,148 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// DNSPrivateViewsServer is a fake server for instances of the armoracledatabase.DNSPrivateViewsClient type. +type DNSPrivateViewsServer struct { + // Get is the fake for method DNSPrivateViewsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, location string, dnsprivateviewocid string, options *armoracledatabase.DNSPrivateViewsClientGetOptions) (resp azfake.Responder[armoracledatabase.DNSPrivateViewsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByLocationPager is the fake for method DNSPrivateViewsClient.NewListByLocationPager + // HTTP status codes to indicate success: http.StatusOK + NewListByLocationPager func(location string, options *armoracledatabase.DNSPrivateViewsClientListByLocationOptions) (resp azfake.PagerResponder[armoracledatabase.DNSPrivateViewsClientListByLocationResponse]) +} + +// NewDNSPrivateViewsServerTransport creates a new instance of DNSPrivateViewsServerTransport with the provided implementation. +// The returned DNSPrivateViewsServerTransport instance is connected to an instance of armoracledatabase.DNSPrivateViewsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDNSPrivateViewsServerTransport(srv *DNSPrivateViewsServer) *DNSPrivateViewsServerTransport { + return &DNSPrivateViewsServerTransport{ + srv: srv, + newListByLocationPager: newTracker[azfake.PagerResponder[armoracledatabase.DNSPrivateViewsClientListByLocationResponse]](), + } +} + +// DNSPrivateViewsServerTransport connects instances of armoracledatabase.DNSPrivateViewsClient to instances of DNSPrivateViewsServer. +// Don't use this type directly, use NewDNSPrivateViewsServerTransport instead. +type DNSPrivateViewsServerTransport struct { + srv *DNSPrivateViewsServer + newListByLocationPager *tracker[azfake.PagerResponder[armoracledatabase.DNSPrivateViewsClientListByLocationResponse]] +} + +// Do implements the policy.Transporter interface for DNSPrivateViewsServerTransport. +func (d *DNSPrivateViewsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "DNSPrivateViewsClient.Get": + resp, err = d.dispatchGet(req) + case "DNSPrivateViewsClient.NewListByLocationPager": + resp, err = d.dispatchNewListByLocationPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DNSPrivateViewsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dnsPrivateViews/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + dnsprivateviewocidParam, err := url.PathUnescape(matches[regex.SubexpIndex("dnsprivateviewocid")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), locationParam, dnsprivateviewocidParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DNSPrivateView, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DNSPrivateViewsServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListByLocationPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByLocationPager not implemented")} + } + newListByLocationPager := d.newListByLocationPager.get(req) + if newListByLocationPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dnsPrivateViews` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resp := d.srv.NewListByLocationPager(locationParam, nil) + newListByLocationPager = &resp + d.newListByLocationPager.add(req, newListByLocationPager) + server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armoracledatabase.DNSPrivateViewsClientListByLocationResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByLocationPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListByLocationPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByLocationPager) { + d.newListByLocationPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivatezones_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivatezones_server.go new file mode 100644 index 000000000000..6c379ca9545d --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivatezones_server.go @@ -0,0 +1,148 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// DNSPrivateZonesServer is a fake server for instances of the armoracledatabase.DNSPrivateZonesClient type. +type DNSPrivateZonesServer struct { + // Get is the fake for method DNSPrivateZonesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, location string, dnsprivatezonename string, options *armoracledatabase.DNSPrivateZonesClientGetOptions) (resp azfake.Responder[armoracledatabase.DNSPrivateZonesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByLocationPager is the fake for method DNSPrivateZonesClient.NewListByLocationPager + // HTTP status codes to indicate success: http.StatusOK + NewListByLocationPager func(location string, options *armoracledatabase.DNSPrivateZonesClientListByLocationOptions) (resp azfake.PagerResponder[armoracledatabase.DNSPrivateZonesClientListByLocationResponse]) +} + +// NewDNSPrivateZonesServerTransport creates a new instance of DNSPrivateZonesServerTransport with the provided implementation. +// The returned DNSPrivateZonesServerTransport instance is connected to an instance of armoracledatabase.DNSPrivateZonesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDNSPrivateZonesServerTransport(srv *DNSPrivateZonesServer) *DNSPrivateZonesServerTransport { + return &DNSPrivateZonesServerTransport{ + srv: srv, + newListByLocationPager: newTracker[azfake.PagerResponder[armoracledatabase.DNSPrivateZonesClientListByLocationResponse]](), + } +} + +// DNSPrivateZonesServerTransport connects instances of armoracledatabase.DNSPrivateZonesClient to instances of DNSPrivateZonesServer. +// Don't use this type directly, use NewDNSPrivateZonesServerTransport instead. +type DNSPrivateZonesServerTransport struct { + srv *DNSPrivateZonesServer + newListByLocationPager *tracker[azfake.PagerResponder[armoracledatabase.DNSPrivateZonesClientListByLocationResponse]] +} + +// Do implements the policy.Transporter interface for DNSPrivateZonesServerTransport. +func (d *DNSPrivateZonesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "DNSPrivateZonesClient.Get": + resp, err = d.dispatchGet(req) + case "DNSPrivateZonesClient.NewListByLocationPager": + resp, err = d.dispatchNewListByLocationPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DNSPrivateZonesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dnsPrivateZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + dnsprivatezonenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dnsprivatezonename")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), locationParam, dnsprivatezonenameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DNSPrivateZone, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DNSPrivateZonesServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListByLocationPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByLocationPager not implemented")} + } + newListByLocationPager := d.newListByLocationPager.get(req) + if newListByLocationPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dnsPrivateZones` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resp := d.srv.NewListByLocationPager(locationParam, nil) + newListByLocationPager = &resp + d.newListByLocationPager.add(req, newListByLocationPager) + server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armoracledatabase.DNSPrivateZonesClientListByLocationResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByLocationPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListByLocationPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByLocationPager) { + d.newListByLocationPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/giversions_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/giversions_server.go new file mode 100644 index 000000000000..551d8334a426 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/giversions_server.go @@ -0,0 +1,148 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// GiVersionsServer is a fake server for instances of the armoracledatabase.GiVersionsClient type. +type GiVersionsServer struct { + // Get is the fake for method GiVersionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, location string, giversionname string, options *armoracledatabase.GiVersionsClientGetOptions) (resp azfake.Responder[armoracledatabase.GiVersionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByLocationPager is the fake for method GiVersionsClient.NewListByLocationPager + // HTTP status codes to indicate success: http.StatusOK + NewListByLocationPager func(location string, options *armoracledatabase.GiVersionsClientListByLocationOptions) (resp azfake.PagerResponder[armoracledatabase.GiVersionsClientListByLocationResponse]) +} + +// NewGiVersionsServerTransport creates a new instance of GiVersionsServerTransport with the provided implementation. +// The returned GiVersionsServerTransport instance is connected to an instance of armoracledatabase.GiVersionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewGiVersionsServerTransport(srv *GiVersionsServer) *GiVersionsServerTransport { + return &GiVersionsServerTransport{ + srv: srv, + newListByLocationPager: newTracker[azfake.PagerResponder[armoracledatabase.GiVersionsClientListByLocationResponse]](), + } +} + +// GiVersionsServerTransport connects instances of armoracledatabase.GiVersionsClient to instances of GiVersionsServer. +// Don't use this type directly, use NewGiVersionsServerTransport instead. +type GiVersionsServerTransport struct { + srv *GiVersionsServer + newListByLocationPager *tracker[azfake.PagerResponder[armoracledatabase.GiVersionsClientListByLocationResponse]] +} + +// Do implements the policy.Transporter interface for GiVersionsServerTransport. +func (g *GiVersionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "GiVersionsClient.Get": + resp, err = g.dispatchGet(req) + case "GiVersionsClient.NewListByLocationPager": + resp, err = g.dispatchNewListByLocationPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (g *GiVersionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if g.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/giVersions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + giversionnameParam, err := url.PathUnescape(matches[regex.SubexpIndex("giversionname")]) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.Get(req.Context(), locationParam, giversionnameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GiVersion, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (g *GiVersionsServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { + if g.srv.NewListByLocationPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByLocationPager not implemented")} + } + newListByLocationPager := g.newListByLocationPager.get(req) + if newListByLocationPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/giVersions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resp := g.srv.NewListByLocationPager(locationParam, nil) + newListByLocationPager = &resp + g.newListByLocationPager.add(req, newListByLocationPager) + server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armoracledatabase.GiVersionsClientListByLocationResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByLocationPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + g.newListByLocationPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByLocationPager) { + g.newListByLocationPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/internal.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/internal.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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/operations_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/operations_server.go new file mode 100644 index 000000000000..4921fd567d63 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" +) + +// OperationsServer is a fake server for instances of the armoracledatabase.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armoracledatabase.OperationsClientListOptions) (resp azfake.PagerResponder[armoracledatabase.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armoracledatabase.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armoracledatabase.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armoracledatabase.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armoracledatabase.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.NewListPager": + resp, err = o.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armoracledatabase.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/oraclesubscriptions_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/oraclesubscriptions_server.go new file mode 100644 index 000000000000..712077d00f40 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/oraclesubscriptions_server.go @@ -0,0 +1,407 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "regexp" +) + +// OracleSubscriptionsServer is a fake server for instances of the armoracledatabase.OracleSubscriptionsClient type. +type OracleSubscriptionsServer struct { + // BeginCreateOrUpdate is the fake for method OracleSubscriptionsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resource armoracledatabase.OracleSubscription, options *armoracledatabase.OracleSubscriptionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method OracleSubscriptionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, options *armoracledatabase.OracleSubscriptionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method OracleSubscriptionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, options *armoracledatabase.OracleSubscriptionsClientGetOptions) (resp azfake.Responder[armoracledatabase.OracleSubscriptionsClientGetResponse], errResp azfake.ErrorResponder) + + // BeginListActivationLinks is the fake for method OracleSubscriptionsClient.BeginListActivationLinks + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginListActivationLinks func(ctx context.Context, options *armoracledatabase.OracleSubscriptionsClientBeginListActivationLinksOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListActivationLinksResponse], errResp azfake.ErrorResponder) + + // NewListBySubscriptionPager is the fake for method OracleSubscriptionsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armoracledatabase.OracleSubscriptionsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armoracledatabase.OracleSubscriptionsClientListBySubscriptionResponse]) + + // BeginListCloudAccountDetails is the fake for method OracleSubscriptionsClient.BeginListCloudAccountDetails + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginListCloudAccountDetails func(ctx context.Context, options *armoracledatabase.OracleSubscriptionsClientBeginListCloudAccountDetailsOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListCloudAccountDetailsResponse], errResp azfake.ErrorResponder) + + // BeginListSaasSubscriptionDetails is the fake for method OracleSubscriptionsClient.BeginListSaasSubscriptionDetails + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginListSaasSubscriptionDetails func(ctx context.Context, options *armoracledatabase.OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListSaasSubscriptionDetailsResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method OracleSubscriptionsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, properties armoracledatabase.OracleSubscriptionUpdate, options *armoracledatabase.OracleSubscriptionsClientBeginUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewOracleSubscriptionsServerTransport creates a new instance of OracleSubscriptionsServerTransport with the provided implementation. +// The returned OracleSubscriptionsServerTransport instance is connected to an instance of armoracledatabase.OracleSubscriptionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOracleSubscriptionsServerTransport(srv *OracleSubscriptionsServer) *OracleSubscriptionsServerTransport { + return &OracleSubscriptionsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientDeleteResponse]](), + beginListActivationLinks: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListActivationLinksResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armoracledatabase.OracleSubscriptionsClientListBySubscriptionResponse]](), + beginListCloudAccountDetails: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListCloudAccountDetailsResponse]](), + beginListSaasSubscriptionDetails: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListSaasSubscriptionDetailsResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientUpdateResponse]](), + } +} + +// OracleSubscriptionsServerTransport connects instances of armoracledatabase.OracleSubscriptionsClient to instances of OracleSubscriptionsServer. +// Don't use this type directly, use NewOracleSubscriptionsServerTransport instead. +type OracleSubscriptionsServerTransport struct { + srv *OracleSubscriptionsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientDeleteResponse]] + beginListActivationLinks *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListActivationLinksResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armoracledatabase.OracleSubscriptionsClientListBySubscriptionResponse]] + beginListCloudAccountDetails *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListCloudAccountDetailsResponse]] + beginListSaasSubscriptionDetails *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListSaasSubscriptionDetailsResponse]] + beginUpdate *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for OracleSubscriptionsServerTransport. +func (o *OracleSubscriptionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "OracleSubscriptionsClient.BeginCreateOrUpdate": + resp, err = o.dispatchBeginCreateOrUpdate(req) + case "OracleSubscriptionsClient.BeginDelete": + resp, err = o.dispatchBeginDelete(req) + case "OracleSubscriptionsClient.Get": + resp, err = o.dispatchGet(req) + case "OracleSubscriptionsClient.BeginListActivationLinks": + resp, err = o.dispatchBeginListActivationLinks(req) + case "OracleSubscriptionsClient.NewListBySubscriptionPager": + resp, err = o.dispatchNewListBySubscriptionPager(req) + case "OracleSubscriptionsClient.BeginListCloudAccountDetails": + resp, err = o.dispatchBeginListCloudAccountDetails(req) + case "OracleSubscriptionsClient.BeginListSaasSubscriptionDetails": + resp, err = o.dispatchBeginListSaasSubscriptionDetails(req) + case "OracleSubscriptionsClient.BeginUpdate": + resp, err = o.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (o *OracleSubscriptionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if o.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := o.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.OracleSubscription](req) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginCreateOrUpdate(req.Context(), body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + o.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + o.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + o.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (o *OracleSubscriptionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if o.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := o.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + respr, errRespr := o.srv.BeginDelete(req.Context(), nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + o.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + o.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + o.beginDelete.remove(req) + } + + return resp, nil +} + +func (o *OracleSubscriptionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if o.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + respr, errRespr := o.srv.Get(req.Context(), nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OracleSubscription, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (o *OracleSubscriptionsServerTransport) dispatchBeginListActivationLinks(req *http.Request) (*http.Response, error) { + if o.srv.BeginListActivationLinks == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginListActivationLinks not implemented")} + } + beginListActivationLinks := o.beginListActivationLinks.get(req) + if beginListActivationLinks == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default/listActivationLinks` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + respr, errRespr := o.srv.BeginListActivationLinks(req.Context(), nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginListActivationLinks = &respr + o.beginListActivationLinks.add(req, beginListActivationLinks) + } + + resp, err := server.PollerResponderNext(beginListActivationLinks, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + o.beginListActivationLinks.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginListActivationLinks) { + o.beginListActivationLinks.remove(req) + } + + return resp, nil +} + +func (o *OracleSubscriptionsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := o.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := o.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + o.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armoracledatabase.OracleSubscriptionsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + o.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (o *OracleSubscriptionsServerTransport) dispatchBeginListCloudAccountDetails(req *http.Request) (*http.Response, error) { + if o.srv.BeginListCloudAccountDetails == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginListCloudAccountDetails not implemented")} + } + beginListCloudAccountDetails := o.beginListCloudAccountDetails.get(req) + if beginListCloudAccountDetails == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default/listCloudAccountDetails` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + respr, errRespr := o.srv.BeginListCloudAccountDetails(req.Context(), nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginListCloudAccountDetails = &respr + o.beginListCloudAccountDetails.add(req, beginListCloudAccountDetails) + } + + resp, err := server.PollerResponderNext(beginListCloudAccountDetails, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + o.beginListCloudAccountDetails.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginListCloudAccountDetails) { + o.beginListCloudAccountDetails.remove(req) + } + + return resp, nil +} + +func (o *OracleSubscriptionsServerTransport) dispatchBeginListSaasSubscriptionDetails(req *http.Request) (*http.Response, error) { + if o.srv.BeginListSaasSubscriptionDetails == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginListSaasSubscriptionDetails not implemented")} + } + beginListSaasSubscriptionDetails := o.beginListSaasSubscriptionDetails.get(req) + if beginListSaasSubscriptionDetails == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default/listSaasSubscriptionDetails` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + respr, errRespr := o.srv.BeginListSaasSubscriptionDetails(req.Context(), nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginListSaasSubscriptionDetails = &respr + o.beginListSaasSubscriptionDetails.add(req, beginListSaasSubscriptionDetails) + } + + resp, err := server.PollerResponderNext(beginListSaasSubscriptionDetails, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + o.beginListSaasSubscriptionDetails.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginListSaasSubscriptionDetails) { + o.beginListSaasSubscriptionDetails.remove(req) + } + + return resp, nil +} + +func (o *OracleSubscriptionsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if o.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := o.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.OracleSubscriptionUpdate](req) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginUpdate(req.Context(), body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + o.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + o.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + o.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/server_factory.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/server_factory.go new file mode 100644 index 000000000000..2edce3e51756 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/server_factory.go @@ -0,0 +1,174 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armoracledatabase.ClientFactory type. +type ServerFactory struct { + AutonomousDatabaseBackupsServer AutonomousDatabaseBackupsServer + AutonomousDatabaseCharacterSetsServer AutonomousDatabaseCharacterSetsServer + AutonomousDatabaseNationalCharacterSetsServer AutonomousDatabaseNationalCharacterSetsServer + AutonomousDatabaseVersionsServer AutonomousDatabaseVersionsServer + AutonomousDatabasesServer AutonomousDatabasesServer + CloudExadataInfrastructuresServer CloudExadataInfrastructuresServer + CloudVMClustersServer CloudVMClustersServer + DNSPrivateViewsServer DNSPrivateViewsServer + DNSPrivateZonesServer DNSPrivateZonesServer + DbNodesServer DbNodesServer + DbServersServer DbServersServer + DbSystemShapesServer DbSystemShapesServer + GiVersionsServer GiVersionsServer + OperationsServer OperationsServer + OracleSubscriptionsServer OracleSubscriptionsServer + VirtualNetworkAddressesServer VirtualNetworkAddressesServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armoracledatabase.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armoracledatabase.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trAutonomousDatabaseBackupsServer *AutonomousDatabaseBackupsServerTransport + trAutonomousDatabaseCharacterSetsServer *AutonomousDatabaseCharacterSetsServerTransport + trAutonomousDatabaseNationalCharacterSetsServer *AutonomousDatabaseNationalCharacterSetsServerTransport + trAutonomousDatabaseVersionsServer *AutonomousDatabaseVersionsServerTransport + trAutonomousDatabasesServer *AutonomousDatabasesServerTransport + trCloudExadataInfrastructuresServer *CloudExadataInfrastructuresServerTransport + trCloudVMClustersServer *CloudVMClustersServerTransport + trDNSPrivateViewsServer *DNSPrivateViewsServerTransport + trDNSPrivateZonesServer *DNSPrivateZonesServerTransport + trDbNodesServer *DbNodesServerTransport + trDbServersServer *DbServersServerTransport + trDbSystemShapesServer *DbSystemShapesServerTransport + trGiVersionsServer *GiVersionsServerTransport + trOperationsServer *OperationsServerTransport + trOracleSubscriptionsServer *OracleSubscriptionsServerTransport + trVirtualNetworkAddressesServer *VirtualNetworkAddressesServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "AutonomousDatabaseBackupsClient": + initServer(s, &s.trAutonomousDatabaseBackupsServer, func() *AutonomousDatabaseBackupsServerTransport { + return NewAutonomousDatabaseBackupsServerTransport(&s.srv.AutonomousDatabaseBackupsServer) + }) + resp, err = s.trAutonomousDatabaseBackupsServer.Do(req) + case "AutonomousDatabaseCharacterSetsClient": + initServer(s, &s.trAutonomousDatabaseCharacterSetsServer, func() *AutonomousDatabaseCharacterSetsServerTransport { + return NewAutonomousDatabaseCharacterSetsServerTransport(&s.srv.AutonomousDatabaseCharacterSetsServer) + }) + resp, err = s.trAutonomousDatabaseCharacterSetsServer.Do(req) + case "AutonomousDatabaseNationalCharacterSetsClient": + initServer(s, &s.trAutonomousDatabaseNationalCharacterSetsServer, func() *AutonomousDatabaseNationalCharacterSetsServerTransport { + return NewAutonomousDatabaseNationalCharacterSetsServerTransport(&s.srv.AutonomousDatabaseNationalCharacterSetsServer) + }) + resp, err = s.trAutonomousDatabaseNationalCharacterSetsServer.Do(req) + case "AutonomousDatabaseVersionsClient": + initServer(s, &s.trAutonomousDatabaseVersionsServer, func() *AutonomousDatabaseVersionsServerTransport { + return NewAutonomousDatabaseVersionsServerTransport(&s.srv.AutonomousDatabaseVersionsServer) + }) + resp, err = s.trAutonomousDatabaseVersionsServer.Do(req) + case "AutonomousDatabasesClient": + initServer(s, &s.trAutonomousDatabasesServer, func() *AutonomousDatabasesServerTransport { + return NewAutonomousDatabasesServerTransport(&s.srv.AutonomousDatabasesServer) + }) + resp, err = s.trAutonomousDatabasesServer.Do(req) + case "CloudExadataInfrastructuresClient": + initServer(s, &s.trCloudExadataInfrastructuresServer, func() *CloudExadataInfrastructuresServerTransport { + return NewCloudExadataInfrastructuresServerTransport(&s.srv.CloudExadataInfrastructuresServer) + }) + resp, err = s.trCloudExadataInfrastructuresServer.Do(req) + case "CloudVMClustersClient": + initServer(s, &s.trCloudVMClustersServer, func() *CloudVMClustersServerTransport { + return NewCloudVMClustersServerTransport(&s.srv.CloudVMClustersServer) + }) + resp, err = s.trCloudVMClustersServer.Do(req) + case "DNSPrivateViewsClient": + initServer(s, &s.trDNSPrivateViewsServer, func() *DNSPrivateViewsServerTransport { + return NewDNSPrivateViewsServerTransport(&s.srv.DNSPrivateViewsServer) + }) + resp, err = s.trDNSPrivateViewsServer.Do(req) + case "DNSPrivateZonesClient": + initServer(s, &s.trDNSPrivateZonesServer, func() *DNSPrivateZonesServerTransport { + return NewDNSPrivateZonesServerTransport(&s.srv.DNSPrivateZonesServer) + }) + resp, err = s.trDNSPrivateZonesServer.Do(req) + case "DbNodesClient": + initServer(s, &s.trDbNodesServer, func() *DbNodesServerTransport { return NewDbNodesServerTransport(&s.srv.DbNodesServer) }) + resp, err = s.trDbNodesServer.Do(req) + case "DbServersClient": + initServer(s, &s.trDbServersServer, func() *DbServersServerTransport { return NewDbServersServerTransport(&s.srv.DbServersServer) }) + resp, err = s.trDbServersServer.Do(req) + case "DbSystemShapesClient": + initServer(s, &s.trDbSystemShapesServer, func() *DbSystemShapesServerTransport { + return NewDbSystemShapesServerTransport(&s.srv.DbSystemShapesServer) + }) + resp, err = s.trDbSystemShapesServer.Do(req) + case "GiVersionsClient": + initServer(s, &s.trGiVersionsServer, func() *GiVersionsServerTransport { return NewGiVersionsServerTransport(&s.srv.GiVersionsServer) }) + resp, err = s.trGiVersionsServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "OracleSubscriptionsClient": + initServer(s, &s.trOracleSubscriptionsServer, func() *OracleSubscriptionsServerTransport { + return NewOracleSubscriptionsServerTransport(&s.srv.OracleSubscriptionsServer) + }) + resp, err = s.trOracleSubscriptionsServer.Do(req) + case "VirtualNetworkAddressesClient": + initServer(s, &s.trVirtualNetworkAddressesServer, func() *VirtualNetworkAddressesServerTransport { + return NewVirtualNetworkAddressesServerTransport(&s.srv.VirtualNetworkAddressesServer) + }) + resp, err = s.trVirtualNetworkAddressesServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/time_rfc3339.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/virtualnetworkaddresses_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/virtualnetworkaddresses_server.go new file mode 100644 index 000000000000..55ab35329e8a --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/virtualnetworkaddresses_server.go @@ -0,0 +1,272 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "net/http" + "net/url" + "regexp" +) + +// VirtualNetworkAddressesServer is a fake server for instances of the armoracledatabase.VirtualNetworkAddressesClient type. +type VirtualNetworkAddressesServer struct { + // BeginCreateOrUpdate is the fake for method VirtualNetworkAddressesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, resource armoracledatabase.VirtualNetworkAddress, options *armoracledatabase.VirtualNetworkAddressesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method VirtualNetworkAddressesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, options *armoracledatabase.VirtualNetworkAddressesClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method VirtualNetworkAddressesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, options *armoracledatabase.VirtualNetworkAddressesClientGetOptions) (resp azfake.Responder[armoracledatabase.VirtualNetworkAddressesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByCloudVMClusterPager is the fake for method VirtualNetworkAddressesClient.NewListByCloudVMClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByCloudVMClusterPager func(resourceGroupName string, cloudvmclustername string, options *armoracledatabase.VirtualNetworkAddressesClientListByCloudVMClusterOptions) (resp azfake.PagerResponder[armoracledatabase.VirtualNetworkAddressesClientListByCloudVMClusterResponse]) +} + +// NewVirtualNetworkAddressesServerTransport creates a new instance of VirtualNetworkAddressesServerTransport with the provided implementation. +// The returned VirtualNetworkAddressesServerTransport instance is connected to an instance of armoracledatabase.VirtualNetworkAddressesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewVirtualNetworkAddressesServerTransport(srv *VirtualNetworkAddressesServer) *VirtualNetworkAddressesServerTransport { + return &VirtualNetworkAddressesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientDeleteResponse]](), + newListByCloudVMClusterPager: newTracker[azfake.PagerResponder[armoracledatabase.VirtualNetworkAddressesClientListByCloudVMClusterResponse]](), + } +} + +// VirtualNetworkAddressesServerTransport connects instances of armoracledatabase.VirtualNetworkAddressesClient to instances of VirtualNetworkAddressesServer. +// Don't use this type directly, use NewVirtualNetworkAddressesServerTransport instead. +type VirtualNetworkAddressesServerTransport struct { + srv *VirtualNetworkAddressesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientDeleteResponse]] + newListByCloudVMClusterPager *tracker[azfake.PagerResponder[armoracledatabase.VirtualNetworkAddressesClientListByCloudVMClusterResponse]] +} + +// Do implements the policy.Transporter interface for VirtualNetworkAddressesServerTransport. +func (v *VirtualNetworkAddressesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "VirtualNetworkAddressesClient.BeginCreateOrUpdate": + resp, err = v.dispatchBeginCreateOrUpdate(req) + case "VirtualNetworkAddressesClient.BeginDelete": + resp, err = v.dispatchBeginDelete(req) + case "VirtualNetworkAddressesClient.Get": + resp, err = v.dispatchGet(req) + case "VirtualNetworkAddressesClient.NewListByCloudVMClusterPager": + resp, err = v.dispatchNewListByCloudVMClusterPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (v *VirtualNetworkAddressesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if v.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := v.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualNetworkAddresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.VirtualNetworkAddress](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + virtualnetworkaddressnameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualnetworkaddressname")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, cloudvmclusternameParam, virtualnetworkaddressnameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + v.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + v.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + v.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (v *VirtualNetworkAddressesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if v.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := v.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualNetworkAddresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + virtualnetworkaddressnameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualnetworkaddressname")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginDelete(req.Context(), resourceGroupNameParam, cloudvmclusternameParam, virtualnetworkaddressnameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + v.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + v.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + v.beginDelete.remove(req) + } + + return resp, nil +} + +func (v *VirtualNetworkAddressesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if v.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualNetworkAddresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + virtualnetworkaddressnameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualnetworkaddressname")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.Get(req.Context(), resourceGroupNameParam, cloudvmclusternameParam, virtualnetworkaddressnameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VirtualNetworkAddress, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (v *VirtualNetworkAddressesServerTransport) dispatchNewListByCloudVMClusterPager(req *http.Request) (*http.Response, error) { + if v.srv.NewListByCloudVMClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByCloudVMClusterPager not implemented")} + } + newListByCloudVMClusterPager := v.newListByCloudVMClusterPager.get(req) + if newListByCloudVMClusterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualNetworkAddresses` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + cloudvmclusternameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cloudvmclustername")]) + if err != nil { + return nil, err + } + resp := v.srv.NewListByCloudVMClusterPager(resourceGroupNameParam, cloudvmclusternameParam, nil) + newListByCloudVMClusterPager = &resp + v.newListByCloudVMClusterPager.add(req, newListByCloudVMClusterPager) + server.PagerResponderInjectNextLinks(newListByCloudVMClusterPager, req, func(page *armoracledatabase.VirtualNetworkAddressesClientListByCloudVMClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByCloudVMClusterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + v.newListByCloudVMClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByCloudVMClusterPager) { + v.newListByCloudVMClusterPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client.go new file mode 100644 index 000000000000..05c7d50067fe --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client.go @@ -0,0 +1,168 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// GiVersionsClient contains the methods for the GiVersions group. +// Don't use this type directly, use NewGiVersionsClient() instead. +type GiVersionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewGiVersionsClient creates a new instance of GiVersionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGiVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GiVersionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GiVersionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a GiVersion +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - giversionname - GiVersion name +// - options - GiVersionsClientGetOptions contains the optional parameters for the GiVersionsClient.Get method. +func (client *GiVersionsClient) Get(ctx context.Context, location string, giversionname string, options *GiVersionsClientGetOptions) (GiVersionsClientGetResponse, error) { + var err error + const operationName = "GiVersionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, giversionname, options) + if err != nil { + return GiVersionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GiVersionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GiVersionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *GiVersionsClient) getCreateRequest(ctx context.Context, location string, giversionname string, options *GiVersionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/giVersions/{giversionname}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if giversionname == "" { + return nil, errors.New("parameter giversionname cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{giversionname}", url.PathEscape(giversionname)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GiVersionsClient) getHandleResponse(resp *http.Response) (GiVersionsClientGetResponse, error) { + result := GiVersionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GiVersion); err != nil { + return GiVersionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByLocationPager - List GiVersion resources by Location +// +// Generated from API version 2023-09-01-preview +// - location - The name of the Azure region. +// - options - GiVersionsClientListByLocationOptions contains the optional parameters for the GiVersionsClient.NewListByLocationPager +// method. +func (client *GiVersionsClient) NewListByLocationPager(location string, options *GiVersionsClientListByLocationOptions) *runtime.Pager[GiVersionsClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[GiVersionsClientListByLocationResponse]{ + More: func(page GiVersionsClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GiVersionsClientListByLocationResponse) (GiVersionsClientListByLocationResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GiVersionsClient.NewListByLocationPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByLocationCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return GiVersionsClientListByLocationResponse{}, err + } + return client.listByLocationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *GiVersionsClient) listByLocationCreateRequest(ctx context.Context, location string, options *GiVersionsClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/giVersions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *GiVersionsClient) listByLocationHandleResponse(resp *http.Response) (GiVersionsClientListByLocationResponse, error) { + result := GiVersionsClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GiVersionListResult); err != nil { + return GiVersionsClientListByLocationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/go.mod b/sdk/resourcemanager/oracledatabase/armoracledatabase/go.mod new file mode 100644 index 000000000000..7b214dd33542 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/go.sum b/sdk/resourcemanager/oracledatabase/armoracledatabase/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/interfaces.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/interfaces.go new file mode 100644 index 000000000000..17c4012b7ecb --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/interfaces.go @@ -0,0 +1,18 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +// AutonomousDatabaseBasePropertiesClassification provides polymorphic access to related types. +// Call the interface's GetAutonomousDatabaseBaseProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AutonomousDatabaseBaseProperties, *AutonomousDatabaseCloneProperties, *AutonomousDatabaseProperties +type AutonomousDatabaseBasePropertiesClassification interface { + // GetAutonomousDatabaseBaseProperties returns the AutonomousDatabaseBaseProperties content of the underlying type. + GetAutonomousDatabaseBaseProperties() *AutonomousDatabaseBaseProperties +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/models.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/models.go new file mode 100644 index 000000000000..401d1aeb77e8 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/models.go @@ -0,0 +1,2718 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import "time" + +// ActivationLinks - Activation Links model +type ActivationLinks struct { + // READ-ONLY; Existing Cloud Account Activation Link + ExistingCloudAccountActivationLink *string + + // READ-ONLY; New Cloud Account Activation Link + NewCloudAccountActivationLink *string +} + +// AddRemoveDbNode - Add/Remove (Virtual Machine) DbNode model +type AddRemoveDbNode struct { + // REQUIRED; Db servers ocids + DbServers []*string +} + +// AllConnectionStringType - The connection string profile to allow clients to group, filter and select connection string +// values based on structured metadata. +type AllConnectionStringType struct { + // The High database service provides the highest level of resources to each SQL statement resulting in the highest performance, + // but supports the fewest number of concurrent SQL statements. + High *string + + // The Low database service provides the least level of resources to each SQL statement, but supports the most number of concurrent + // SQL statements. + Low *string + + // The Medium database service provides a lower level of resources to each SQL statement potentially resulting a lower level + // of performance, but supports more concurrent SQL statements. + Medium *string +} + +// ApexDetailsType - Information about Oracle APEX Application Development. +type ApexDetailsType struct { + // The Oracle APEX Application Development version. + ApexVersion *string + + // The Oracle REST Data Services (ORDS) version. + OrdsVersion *string +} + +// AutonomousDatabase - Autonomous Database resource model. +type AutonomousDatabase struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties AutonomousDatabaseBasePropertiesClassification + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AutonomousDatabaseBackup resource definition +type AutonomousDatabaseBackup struct { + // The resource-specific properties for this resource. + Properties *AutonomousDatabaseBackupProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AutonomousDatabaseBackupListResult - The response of a AutonomousDatabaseBackup list operation. +type AutonomousDatabaseBackupListResult struct { + // REQUIRED; The AutonomousDatabaseBackup items on this page + Value []*AutonomousDatabaseBackup + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// AutonomousDatabaseBackupProperties - AutonomousDatabaseBackup resource model +type AutonomousDatabaseBackupProperties struct { + // The user-friendly name for the backup. The name does not have to be unique. + DisplayName *string + + // Retention period, in days, for long-term backups. + RetentionPeriodInDays *int32 + + // READ-ONLY; The OCID of the Autonomous Database. + AutonomousDatabaseID *string + + // READ-ONLY; The size of the database in terabytes at the time the backup was taken. + DatabaseSizeInTBs *int32 + + // READ-ONLY; A valid Oracle Database version for Autonomous Database. + DbVersion *string + + // READ-ONLY; Indicates whether the backup is user-initiated or automatic. + IsAutomatic *bool + + // READ-ONLY; Indicates whether the backup can be used to restore the associated Autonomous Database. + IsRestorable *bool + + // READ-ONLY; Additional information about the current lifecycle state. + LifecycleDetails *string + + // READ-ONLY; The current state of the backup. + LifecycleState *AutonomousDatabaseBackupLifecycleState + + // READ-ONLY; The OCID of the Autonomous Database backup. + Ocid *string + + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *AzureResourceProvisioningState + + // READ-ONLY; The backup size in terabytes (TB). + SizeInTBs *int32 + + // READ-ONLY; Timestamp until when the backup will be available. + TimeAvailableTil *time.Time + + // READ-ONLY; The date and time the backup completed. + TimeEnded *string + + // READ-ONLY; The type of backup. + Type *AutonomousDatabaseBackupType +} + +// AutonomousDatabaseBackupUpdate - The type used for update operations of the AutonomousDatabaseBackup. +type AutonomousDatabaseBackupUpdate struct { + // The updatable properties of the AutonomousDatabaseBackup. + Properties *AutonomousDatabaseBackupUpdateProperties +} + +// AutonomousDatabaseBackupUpdateProperties - The updatable properties of the AutonomousDatabaseBackup. +type AutonomousDatabaseBackupUpdateProperties struct { + // Retention period, in days, for long-term backups. + RetentionPeriodInDays *int32 +} + +// AutonomousDatabaseBaseProperties - Autonomous Database base resource model. +type AutonomousDatabaseBaseProperties struct { + // REQUIRED; Database type to be created. + DataBaseType *DataBaseType + + // Admin password. + AdminPassword *string + + // Autonomous Database ID + AutonomousDatabaseID *string + + // The maintenance schedule type of the Autonomous Database Serverless. + AutonomousMaintenanceScheduleType *AutonomousMaintenanceScheduleType + + // Retention period, in days, for long-term backups + BackupRetentionPeriodInDays *int32 + + // The number of CPU cores to be made available to the database. + CPUCoreCount *int32 + + // The character set for the autonomous database. + CharacterSet *string + + // The compute amount (CPUs) available to the database. + ComputeCount *float32 + + // The compute model of the Autonomous Database. + ComputeModel *ComputeModel + + // Customer Contacts. + CustomerContacts []*CustomerContact + + // The size, in gigabytes, of the data volume that will be created and attached to the database. + DataStorageSizeInGbs *int32 + + // The quantity of data in the database, in terabytes. + DataStorageSizeInTbs *int32 + + // The Oracle Database Edition that applies to the Autonomous databases. + DatabaseEdition *DatabaseEditionType + + // A valid Oracle Database version for Autonomous Database. + DbVersion *string + + // The Autonomous Database workload type + DbWorkload *WorkloadType + + // The user-friendly name for the Autonomous Database. + DisplayName *string + + // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. + IsAutoScalingEnabled *bool + + // Indicates if auto scaling is enabled for the Autonomous Database storage. + IsAutoScalingForStorageEnabled *bool + + // Indicates whether the Autonomous Database has local or called in-region Data Guard enabled. + IsLocalDataGuardEnabled *bool + + // Specifies if the Autonomous Database requires mTLS connections. + IsMtlsConnectionRequired *bool + + // Specifies if the Autonomous Database preview version is being provisioned. + IsPreviewVersionWithServiceTermsAccepted *bool + + // The Oracle license model that applies to the Oracle Autonomous Database. The default is LICENSE_INCLUDED. + LicenseModel *LicenseModel + + // Parameter that allows users to select an acceptable maximum data loss limit in seconds, up to which Automatic Failover + // will be triggered when necessary for a Local Autonomous Data Guard + LocalAdgAutoFailoverMaxDataLossLimit *int32 + + // The character set for the Autonomous Database. + NcharacterSet *string + + // Indicates the Autonomous Database mode. + OpenMode *OpenModeType + + // The database OCID of the Disaster Recovery peer database, which is located in a different region from the current peer + // database. + PeerDbID *string + + // The Autonomous Database permission level. + PermissionLevel *PermissionLevelType + + // The private endpoint Ip address for the resource. + PrivateEndpointIP *string + + // The resource's private endpoint label. + PrivateEndpointLabel *string + + // The Data Guard role of the Autonomous Container Database or Autonomous Database, if Autonomous Data Guard is enabled. + Role *RoleType + + // The list of scheduled operations. + ScheduledOperations *ScheduledOperationsType + + // Client subnet + SubnetID *string + + // VNET for network connectivity + VnetID *string + + // The client IP access control list (ACL). This is an array of CIDR notations and/or IP addresses. Values should be separate + // strings, separated by commas. Example: ['1.1.1.1','1.1.1.0/24','1.1.2.25'] + WhitelistedIPs []*string + + // READ-ONLY; The current amount of storage in use for user and system data, in terabytes (TB). + ActualUsedDataStorageSizeInTbs *float64 + + // READ-ONLY; The amount of storage currently allocated for the database tables and billed for, rounded up. + AllocatedStorageSizeInTbs *float64 + + // READ-ONLY; Information about Oracle APEX Application Development. + ApexDetails *ApexDetailsType + + // READ-ONLY; List of Oracle Database versions available for a database upgrade. If there are no version upgrades available, + // this list is empty. + AvailableUpgradeVersions []*string + + // READ-ONLY; The connection string used to connect to the Autonomous Database. + ConnectionStrings *ConnectionStringType + + // READ-ONLY; The URLs for accessing Oracle Application Express (APEX) and SQL Developer Web with a browser from a Compute + // instance within your VCN or that has a direct connection to your VCN. + ConnectionUrls *ConnectionURLType + + // READ-ONLY; Status of the Data Safe registration for this Autonomous Database. + DataSafeStatus *DataSafeStatusType + + // READ-ONLY; Indicates the number of seconds of data loss for a Data Guard failover. + FailedDataRecoveryInSeconds *int32 + + // READ-ONLY; The area assigned to In-Memory tables in Autonomous Database. + InMemoryAreaInGbs *int32 + + // READ-ONLY; Indicates if the Autonomous Database version is a preview version. + IsPreview *bool + + // READ-ONLY; Indicates whether the Autonomous Database has Cross Region Data Guard enabled. + IsRemoteDataGuardEnabled *bool + + // READ-ONLY; Additional information about the current lifecycle state. + LifecycleDetails *string + + // READ-ONLY; Views lifecycleState + LifecycleState *AutonomousDatabaseLifecycleState + + // READ-ONLY; Indicates the local disaster recovery (DR) type of the Autonomous Database Serverless instance.Autonomous Data + // Guard (ADG) DR type provides business critical DR with a faster recovery time objective + // (RTO) during failover or switchover.Backup-based DR type provides lower cost DR with a slower RTO during failover or switchover. + LocalDisasterRecoveryType *DisasterRecoveryType + + // READ-ONLY; Local Autonomous Disaster Recovery standby database details. + LocalStandbyDb *AutonomousDatabaseStandbySummary + + // READ-ONLY; The amount of memory (in GBs) enabled per ECPU or OCPU. + MemoryPerOracleComputeUnitInGbs *int32 + + // READ-ONLY; HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + OciURL *string + + // READ-ONLY; Database ocid + Ocid *string + + // READ-ONLY; Status of Operations Insights for this Autonomous Database. + OperationsInsightsStatus *OperationsInsightsStatusType + + // READ-ONLY; The list of OCIDs [https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm] of standby databases + // located in Autonomous Data Guard remote regions that are associated with the source + // database. Note that for Autonomous Database Serverless instances, standby databases located in the same region as the source + // primary database do not have OCIDs. + PeerDbIDs []*string + + // READ-ONLY; The private endpoint for the resource. + PrivateEndpoint *string + + // READ-ONLY; An array of CPU values that an Autonomous Database can be scaled to. + ProvisionableCpus []*int32 + + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *AzureResourceProvisioningState + + // READ-ONLY; The SQL Web Developer URL for the Oracle Autonomous Database. + SQLWebDeveloperURL *string + + // READ-ONLY; The URL of the Service Console for the Autonomous Database. + ServiceConsoleURL *string + + // READ-ONLY; The list of regions that support the creation of an Autonomous Database clone or an Autonomous Data Guard standby + // database. + SupportedRegionsToCloneTo []*string + + // READ-ONLY; The date and time that the database was created. + TimeCreated *time.Time + + // READ-ONLY; The date and time the Autonomous Data Guard role was switched for the Autonomous Database. + TimeDataGuardRoleChanged *string + + // READ-ONLY; The date and time the Always Free database will be automatically deleted because of inactivity. + TimeDeletionOfFreeAutonomousDatabase *string + + // READ-ONLY; The date and time that Autonomous Data Guard was enabled for an Autonomous Database where the standby was provisioned + // in the same region as the primary database. + TimeLocalDataGuardEnabled *string + + // READ-ONLY; The date and time when maintenance will begin. + TimeMaintenanceBegin *time.Time + + // READ-ONLY; The date and time when maintenance will end. + TimeMaintenanceEnd *time.Time + + // READ-ONLY; The timestamp of the last failover operation. + TimeOfLastFailover *string + + // READ-ONLY; The date and time when last refresh happened. + TimeOfLastRefresh *string + + // READ-ONLY; The refresh point timestamp (UTC). + TimeOfLastRefreshPoint *string + + // READ-ONLY; The timestamp of the last switchover operation for the Autonomous Database. + TimeOfLastSwitchover *string + + // READ-ONLY; The date and time the Always Free database will be stopped because of inactivity. + TimeReclamationOfFreeAutonomousDatabase *string + + // READ-ONLY; The storage space consumed by Autonomous Database in GBs. + UsedDataStorageSizeInGbs *int32 + + // READ-ONLY; The amount of storage that has been used, in terabytes. + UsedDataStorageSizeInTbs *int32 +} + +// GetAutonomousDatabaseBaseProperties implements the AutonomousDatabaseBasePropertiesClassification interface for type AutonomousDatabaseBaseProperties. +func (a *AutonomousDatabaseBaseProperties) GetAutonomousDatabaseBaseProperties() *AutonomousDatabaseBaseProperties { + return a +} + +// AutonomousDatabaseCharacterSets resource definition +type AutonomousDatabaseCharacterSet struct { + // The resource-specific properties for this resource. + Properties *AutonomousDatabaseCharacterSetProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AutonomousDatabaseCharacterSetListResult - The response of a AutonomousDatabaseCharacterSet list operation. +type AutonomousDatabaseCharacterSetListResult struct { + // REQUIRED; The AutonomousDatabaseCharacterSet items on this page + Value []*AutonomousDatabaseCharacterSet + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// AutonomousDatabaseCharacterSetProperties - AutonomousDatabaseCharacterSet resource model +type AutonomousDatabaseCharacterSetProperties struct { + // READ-ONLY; The Oracle Autonomous Database supported character sets. + CharacterSet *string +} + +// AutonomousDatabaseCloneProperties - Autonomous Database clone resource model. +type AutonomousDatabaseCloneProperties struct { + // REQUIRED; The Autonomous Database clone type. + CloneType *CloneType + + // REQUIRED; Database type to be created. + DataBaseType *DataBaseType + + // REQUIRED; The Azure ID of the Autonomous Database that was cloned to create the current Autonomous Database. + SourceID *string + + // Admin password. + AdminPassword *string + + // Autonomous Database ID + AutonomousDatabaseID *string + + // The maintenance schedule type of the Autonomous Database Serverless. + AutonomousMaintenanceScheduleType *AutonomousMaintenanceScheduleType + + // Retention period, in days, for long-term backups + BackupRetentionPeriodInDays *int32 + + // The number of CPU cores to be made available to the database. + CPUCoreCount *int32 + + // The character set for the autonomous database. + CharacterSet *string + + // The compute amount (CPUs) available to the database. + ComputeCount *float32 + + // The compute model of the Autonomous Database. + ComputeModel *ComputeModel + + // Customer Contacts. + CustomerContacts []*CustomerContact + + // The size, in gigabytes, of the data volume that will be created and attached to the database. + DataStorageSizeInGbs *int32 + + // The quantity of data in the database, in terabytes. + DataStorageSizeInTbs *int32 + + // The Oracle Database Edition that applies to the Autonomous databases. + DatabaseEdition *DatabaseEditionType + + // A valid Oracle Database version for Autonomous Database. + DbVersion *string + + // The Autonomous Database workload type + DbWorkload *WorkloadType + + // The user-friendly name for the Autonomous Database. + DisplayName *string + + // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. + IsAutoScalingEnabled *bool + + // Indicates if auto scaling is enabled for the Autonomous Database storage. + IsAutoScalingForStorageEnabled *bool + + // Indicates whether the Autonomous Database has local or called in-region Data Guard enabled. + IsLocalDataGuardEnabled *bool + + // Specifies if the Autonomous Database requires mTLS connections. + IsMtlsConnectionRequired *bool + + // Specifies if the Autonomous Database preview version is being provisioned. + IsPreviewVersionWithServiceTermsAccepted *bool + + // The Oracle license model that applies to the Oracle Autonomous Database. The default is LICENSE_INCLUDED. + LicenseModel *LicenseModel + + // Parameter that allows users to select an acceptable maximum data loss limit in seconds, up to which Automatic Failover + // will be triggered when necessary for a Local Autonomous Data Guard + LocalAdgAutoFailoverMaxDataLossLimit *int32 + + // The character set for the Autonomous Database. + NcharacterSet *string + + // Indicates the Autonomous Database mode. + OpenMode *OpenModeType + + // The database OCID of the Disaster Recovery peer database, which is located in a different region from the current peer + // database. + PeerDbID *string + + // The Autonomous Database permission level. + PermissionLevel *PermissionLevelType + + // The private endpoint Ip address for the resource. + PrivateEndpointIP *string + + // The resource's private endpoint label. + PrivateEndpointLabel *string + + // The refresh mode of the clone. + RefreshableModel *RefreshableModelType + + // The Data Guard role of the Autonomous Container Database or Autonomous Database, if Autonomous Data Guard is enabled. + Role *RoleType + + // The list of scheduled operations. + ScheduledOperations *ScheduledOperationsType + + // The source of the database. + Source *SourceType + + // Client subnet + SubnetID *string + + // The time and date as an RFC3339 formatted string, e.g., 2022-01-01T12:00:00.000Z, to set the limit for a refreshable clone + // to be reconnected to its source database. + TimeUntilReconnectCloneEnabled *string + + // VNET for network connectivity + VnetID *string + + // The client IP access control list (ACL). This is an array of CIDR notations and/or IP addresses. Values should be separate + // strings, separated by commas. Example: ['1.1.1.1','1.1.1.0/24','1.1.2.25'] + WhitelistedIPs []*string + + // READ-ONLY; The current amount of storage in use for user and system data, in terabytes (TB). + ActualUsedDataStorageSizeInTbs *float64 + + // READ-ONLY; The amount of storage currently allocated for the database tables and billed for, rounded up. + AllocatedStorageSizeInTbs *float64 + + // READ-ONLY; Information about Oracle APEX Application Development. + ApexDetails *ApexDetailsType + + // READ-ONLY; List of Oracle Database versions available for a database upgrade. If there are no version upgrades available, + // this list is empty. + AvailableUpgradeVersions []*string + + // READ-ONLY; The connection string used to connect to the Autonomous Database. + ConnectionStrings *ConnectionStringType + + // READ-ONLY; The URLs for accessing Oracle Application Express (APEX) and SQL Developer Web with a browser from a Compute + // instance within your VCN or that has a direct connection to your VCN. + ConnectionUrls *ConnectionURLType + + // READ-ONLY; Status of the Data Safe registration for this Autonomous Database. + DataSafeStatus *DataSafeStatusType + + // READ-ONLY; Indicates the number of seconds of data loss for a Data Guard failover. + FailedDataRecoveryInSeconds *int32 + + // READ-ONLY; The area assigned to In-Memory tables in Autonomous Database. + InMemoryAreaInGbs *int32 + + // READ-ONLY; Indicates if the Autonomous Database version is a preview version. + IsPreview *bool + + // READ-ONLY; Indicates if the refreshable clone can be reconnected to its source database. + IsReconnectCloneEnabled *bool + + // READ-ONLY; Indicates if the Autonomous Database is a refreshable clone. + IsRefreshableClone *bool + + // READ-ONLY; Indicates whether the Autonomous Database has Cross Region Data Guard enabled. + IsRemoteDataGuardEnabled *bool + + // READ-ONLY; Additional information about the current lifecycle state. + LifecycleDetails *string + + // READ-ONLY; Views lifecycleState + LifecycleState *AutonomousDatabaseLifecycleState + + // READ-ONLY; Indicates the local disaster recovery (DR) type of the Autonomous Database Serverless instance.Autonomous Data + // Guard (ADG) DR type provides business critical DR with a faster recovery time objective + // (RTO) during failover or switchover.Backup-based DR type provides lower cost DR with a slower RTO during failover or switchover. + LocalDisasterRecoveryType *DisasterRecoveryType + + // READ-ONLY; Local Autonomous Disaster Recovery standby database details. + LocalStandbyDb *AutonomousDatabaseStandbySummary + + // READ-ONLY; The amount of memory (in GBs) enabled per ECPU or OCPU. + MemoryPerOracleComputeUnitInGbs *int32 + + // READ-ONLY; HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + OciURL *string + + // READ-ONLY; Database ocid + Ocid *string + + // READ-ONLY; Status of Operations Insights for this Autonomous Database. + OperationsInsightsStatus *OperationsInsightsStatusType + + // READ-ONLY; The list of OCIDs [https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm] of standby databases + // located in Autonomous Data Guard remote regions that are associated with the source + // database. Note that for Autonomous Database Serverless instances, standby databases located in the same region as the source + // primary database do not have OCIDs. + PeerDbIDs []*string + + // READ-ONLY; The private endpoint for the resource. + PrivateEndpoint *string + + // READ-ONLY; An array of CPU values that an Autonomous Database can be scaled to. + ProvisionableCpus []*int32 + + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *AzureResourceProvisioningState + + // READ-ONLY; The refresh status of the clone. + RefreshableStatus *RefreshableStatusType + + // READ-ONLY; The SQL Web Developer URL for the Oracle Autonomous Database. + SQLWebDeveloperURL *string + + // READ-ONLY; The URL of the Service Console for the Autonomous Database. + ServiceConsoleURL *string + + // READ-ONLY; The list of regions that support the creation of an Autonomous Database clone or an Autonomous Data Guard standby + // database. + SupportedRegionsToCloneTo []*string + + // READ-ONLY; The date and time that the database was created. + TimeCreated *time.Time + + // READ-ONLY; The date and time the Autonomous Data Guard role was switched for the Autonomous Database. + TimeDataGuardRoleChanged *string + + // READ-ONLY; The date and time the Always Free database will be automatically deleted because of inactivity. + TimeDeletionOfFreeAutonomousDatabase *string + + // READ-ONLY; The date and time that Autonomous Data Guard was enabled for an Autonomous Database where the standby was provisioned + // in the same region as the primary database. + TimeLocalDataGuardEnabled *string + + // READ-ONLY; The date and time when maintenance will begin. + TimeMaintenanceBegin *time.Time + + // READ-ONLY; The date and time when maintenance will end. + TimeMaintenanceEnd *time.Time + + // READ-ONLY; The timestamp of the last failover operation. + TimeOfLastFailover *string + + // READ-ONLY; The date and time when last refresh happened. + TimeOfLastRefresh *string + + // READ-ONLY; The refresh point timestamp (UTC). + TimeOfLastRefreshPoint *string + + // READ-ONLY; The timestamp of the last switchover operation for the Autonomous Database. + TimeOfLastSwitchover *string + + // READ-ONLY; The date and time the Always Free database will be stopped because of inactivity. + TimeReclamationOfFreeAutonomousDatabase *string + + // READ-ONLY; The storage space consumed by Autonomous Database in GBs. + UsedDataStorageSizeInGbs *int32 + + // READ-ONLY; The amount of storage that has been used, in terabytes. + UsedDataStorageSizeInTbs *int32 +} + +// GetAutonomousDatabaseBaseProperties implements the AutonomousDatabaseBasePropertiesClassification interface for type AutonomousDatabaseCloneProperties. +func (a *AutonomousDatabaseCloneProperties) GetAutonomousDatabaseBaseProperties() *AutonomousDatabaseBaseProperties { + return &AutonomousDatabaseBaseProperties{ + ActualUsedDataStorageSizeInTbs: a.ActualUsedDataStorageSizeInTbs, + AdminPassword: a.AdminPassword, + AllocatedStorageSizeInTbs: a.AllocatedStorageSizeInTbs, + ApexDetails: a.ApexDetails, + AutonomousDatabaseID: a.AutonomousDatabaseID, + AutonomousMaintenanceScheduleType: a.AutonomousMaintenanceScheduleType, + AvailableUpgradeVersions: a.AvailableUpgradeVersions, + BackupRetentionPeriodInDays: a.BackupRetentionPeriodInDays, + CPUCoreCount: a.CPUCoreCount, + CharacterSet: a.CharacterSet, + ComputeCount: a.ComputeCount, + ComputeModel: a.ComputeModel, + ConnectionStrings: a.ConnectionStrings, + ConnectionUrls: a.ConnectionUrls, + CustomerContacts: a.CustomerContacts, + DataBaseType: a.DataBaseType, + DataSafeStatus: a.DataSafeStatus, + DataStorageSizeInGbs: a.DataStorageSizeInGbs, + DataStorageSizeInTbs: a.DataStorageSizeInTbs, + DatabaseEdition: a.DatabaseEdition, + DbVersion: a.DbVersion, + DbWorkload: a.DbWorkload, + DisplayName: a.DisplayName, + FailedDataRecoveryInSeconds: a.FailedDataRecoveryInSeconds, + InMemoryAreaInGbs: a.InMemoryAreaInGbs, + IsAutoScalingEnabled: a.IsAutoScalingEnabled, + IsAutoScalingForStorageEnabled: a.IsAutoScalingForStorageEnabled, + IsLocalDataGuardEnabled: a.IsLocalDataGuardEnabled, + IsMtlsConnectionRequired: a.IsMtlsConnectionRequired, + IsPreview: a.IsPreview, + IsPreviewVersionWithServiceTermsAccepted: a.IsPreviewVersionWithServiceTermsAccepted, + IsRemoteDataGuardEnabled: a.IsRemoteDataGuardEnabled, + LicenseModel: a.LicenseModel, + LifecycleDetails: a.LifecycleDetails, + LifecycleState: a.LifecycleState, + LocalAdgAutoFailoverMaxDataLossLimit: a.LocalAdgAutoFailoverMaxDataLossLimit, + LocalDisasterRecoveryType: a.LocalDisasterRecoveryType, + LocalStandbyDb: a.LocalStandbyDb, + MemoryPerOracleComputeUnitInGbs: a.MemoryPerOracleComputeUnitInGbs, + NcharacterSet: a.NcharacterSet, + OciURL: a.OciURL, + Ocid: a.Ocid, + OpenMode: a.OpenMode, + OperationsInsightsStatus: a.OperationsInsightsStatus, + PeerDbID: a.PeerDbID, + PeerDbIDs: a.PeerDbIDs, + PermissionLevel: a.PermissionLevel, + PrivateEndpoint: a.PrivateEndpoint, + PrivateEndpointIP: a.PrivateEndpointIP, + PrivateEndpointLabel: a.PrivateEndpointLabel, + ProvisionableCpus: a.ProvisionableCpus, + ProvisioningState: a.ProvisioningState, + Role: a.Role, + SQLWebDeveloperURL: a.SQLWebDeveloperURL, + ScheduledOperations: a.ScheduledOperations, + ServiceConsoleURL: a.ServiceConsoleURL, + SubnetID: a.SubnetID, + SupportedRegionsToCloneTo: a.SupportedRegionsToCloneTo, + TimeCreated: a.TimeCreated, + TimeDataGuardRoleChanged: a.TimeDataGuardRoleChanged, + TimeDeletionOfFreeAutonomousDatabase: a.TimeDeletionOfFreeAutonomousDatabase, + TimeLocalDataGuardEnabled: a.TimeLocalDataGuardEnabled, + TimeMaintenanceBegin: a.TimeMaintenanceBegin, + TimeMaintenanceEnd: a.TimeMaintenanceEnd, + TimeOfLastFailover: a.TimeOfLastFailover, + TimeOfLastRefresh: a.TimeOfLastRefresh, + TimeOfLastRefreshPoint: a.TimeOfLastRefreshPoint, + TimeOfLastSwitchover: a.TimeOfLastSwitchover, + TimeReclamationOfFreeAutonomousDatabase: a.TimeReclamationOfFreeAutonomousDatabase, + UsedDataStorageSizeInGbs: a.UsedDataStorageSizeInGbs, + UsedDataStorageSizeInTbs: a.UsedDataStorageSizeInTbs, + VnetID: a.VnetID, + WhitelistedIPs: a.WhitelistedIPs, + } +} + +// AutonomousDatabaseListResult - The response of a AutonomousDatabase list operation. +type AutonomousDatabaseListResult struct { + // REQUIRED; The AutonomousDatabase items on this page + Value []*AutonomousDatabase + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// AutonomousDatabaseNationalCharacterSets resource definition +type AutonomousDatabaseNationalCharacterSet struct { + // The resource-specific properties for this resource. + Properties *AutonomousDatabaseNationalCharacterSetProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AutonomousDatabaseNationalCharacterSetListResult - The response of a AutonomousDatabaseNationalCharacterSet list operation. +type AutonomousDatabaseNationalCharacterSetListResult struct { + // REQUIRED; The AutonomousDatabaseNationalCharacterSet items on this page + Value []*AutonomousDatabaseNationalCharacterSet + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// AutonomousDatabaseNationalCharacterSetProperties - AutonomousDatabaseNationalCharacterSet resource model +type AutonomousDatabaseNationalCharacterSetProperties struct { + // READ-ONLY; The Oracle Autonomous Database supported national character sets. + CharacterSet *string +} + +// AutonomousDatabaseProperties - Autonomous Database resource model. +type AutonomousDatabaseProperties struct { + // REQUIRED; Database type to be created. + DataBaseType *DataBaseType + + // Admin password. + AdminPassword *string + + // Autonomous Database ID + AutonomousDatabaseID *string + + // The maintenance schedule type of the Autonomous Database Serverless. + AutonomousMaintenanceScheduleType *AutonomousMaintenanceScheduleType + + // Retention period, in days, for long-term backups + BackupRetentionPeriodInDays *int32 + + // The number of CPU cores to be made available to the database. + CPUCoreCount *int32 + + // The character set for the autonomous database. + CharacterSet *string + + // The compute amount (CPUs) available to the database. + ComputeCount *float32 + + // The compute model of the Autonomous Database. + ComputeModel *ComputeModel + + // Customer Contacts. + CustomerContacts []*CustomerContact + + // The size, in gigabytes, of the data volume that will be created and attached to the database. + DataStorageSizeInGbs *int32 + + // The quantity of data in the database, in terabytes. + DataStorageSizeInTbs *int32 + + // The Oracle Database Edition that applies to the Autonomous databases. + DatabaseEdition *DatabaseEditionType + + // A valid Oracle Database version for Autonomous Database. + DbVersion *string + + // The Autonomous Database workload type + DbWorkload *WorkloadType + + // The user-friendly name for the Autonomous Database. + DisplayName *string + + // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. + IsAutoScalingEnabled *bool + + // Indicates if auto scaling is enabled for the Autonomous Database storage. + IsAutoScalingForStorageEnabled *bool + + // Indicates whether the Autonomous Database has local or called in-region Data Guard enabled. + IsLocalDataGuardEnabled *bool + + // Specifies if the Autonomous Database requires mTLS connections. + IsMtlsConnectionRequired *bool + + // Specifies if the Autonomous Database preview version is being provisioned. + IsPreviewVersionWithServiceTermsAccepted *bool + + // The Oracle license model that applies to the Oracle Autonomous Database. The default is LICENSE_INCLUDED. + LicenseModel *LicenseModel + + // Parameter that allows users to select an acceptable maximum data loss limit in seconds, up to which Automatic Failover + // will be triggered when necessary for a Local Autonomous Data Guard + LocalAdgAutoFailoverMaxDataLossLimit *int32 + + // The character set for the Autonomous Database. + NcharacterSet *string + + // Indicates the Autonomous Database mode. + OpenMode *OpenModeType + + // The database OCID of the Disaster Recovery peer database, which is located in a different region from the current peer + // database. + PeerDbID *string + + // The Autonomous Database permission level. + PermissionLevel *PermissionLevelType + + // The private endpoint Ip address for the resource. + PrivateEndpointIP *string + + // The resource's private endpoint label. + PrivateEndpointLabel *string + + // The Data Guard role of the Autonomous Container Database or Autonomous Database, if Autonomous Data Guard is enabled. + Role *RoleType + + // The list of scheduled operations. + ScheduledOperations *ScheduledOperationsType + + // Client subnet + SubnetID *string + + // VNET for network connectivity + VnetID *string + + // The client IP access control list (ACL). This is an array of CIDR notations and/or IP addresses. Values should be separate + // strings, separated by commas. Example: ['1.1.1.1','1.1.1.0/24','1.1.2.25'] + WhitelistedIPs []*string + + // READ-ONLY; The current amount of storage in use for user and system data, in terabytes (TB). + ActualUsedDataStorageSizeInTbs *float64 + + // READ-ONLY; The amount of storage currently allocated for the database tables and billed for, rounded up. + AllocatedStorageSizeInTbs *float64 + + // READ-ONLY; Information about Oracle APEX Application Development. + ApexDetails *ApexDetailsType + + // READ-ONLY; List of Oracle Database versions available for a database upgrade. If there are no version upgrades available, + // this list is empty. + AvailableUpgradeVersions []*string + + // READ-ONLY; The connection string used to connect to the Autonomous Database. + ConnectionStrings *ConnectionStringType + + // READ-ONLY; The URLs for accessing Oracle Application Express (APEX) and SQL Developer Web with a browser from a Compute + // instance within your VCN or that has a direct connection to your VCN. + ConnectionUrls *ConnectionURLType + + // READ-ONLY; Status of the Data Safe registration for this Autonomous Database. + DataSafeStatus *DataSafeStatusType + + // READ-ONLY; Indicates the number of seconds of data loss for a Data Guard failover. + FailedDataRecoveryInSeconds *int32 + + // READ-ONLY; The area assigned to In-Memory tables in Autonomous Database. + InMemoryAreaInGbs *int32 + + // READ-ONLY; Indicates if the Autonomous Database version is a preview version. + IsPreview *bool + + // READ-ONLY; Indicates whether the Autonomous Database has Cross Region Data Guard enabled. + IsRemoteDataGuardEnabled *bool + + // READ-ONLY; Additional information about the current lifecycle state. + LifecycleDetails *string + + // READ-ONLY; Views lifecycleState + LifecycleState *AutonomousDatabaseLifecycleState + + // READ-ONLY; Indicates the local disaster recovery (DR) type of the Autonomous Database Serverless instance.Autonomous Data + // Guard (ADG) DR type provides business critical DR with a faster recovery time objective + // (RTO) during failover or switchover.Backup-based DR type provides lower cost DR with a slower RTO during failover or switchover. + LocalDisasterRecoveryType *DisasterRecoveryType + + // READ-ONLY; Local Autonomous Disaster Recovery standby database details. + LocalStandbyDb *AutonomousDatabaseStandbySummary + + // READ-ONLY; The amount of memory (in GBs) enabled per ECPU or OCPU. + MemoryPerOracleComputeUnitInGbs *int32 + + // READ-ONLY; HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + OciURL *string + + // READ-ONLY; Database ocid + Ocid *string + + // READ-ONLY; Status of Operations Insights for this Autonomous Database. + OperationsInsightsStatus *OperationsInsightsStatusType + + // READ-ONLY; The list of OCIDs [https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm] of standby databases + // located in Autonomous Data Guard remote regions that are associated with the source + // database. Note that for Autonomous Database Serverless instances, standby databases located in the same region as the source + // primary database do not have OCIDs. + PeerDbIDs []*string + + // READ-ONLY; The private endpoint for the resource. + PrivateEndpoint *string + + // READ-ONLY; An array of CPU values that an Autonomous Database can be scaled to. + ProvisionableCpus []*int32 + + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *AzureResourceProvisioningState + + // READ-ONLY; The SQL Web Developer URL for the Oracle Autonomous Database. + SQLWebDeveloperURL *string + + // READ-ONLY; The URL of the Service Console for the Autonomous Database. + ServiceConsoleURL *string + + // READ-ONLY; The list of regions that support the creation of an Autonomous Database clone or an Autonomous Data Guard standby + // database. + SupportedRegionsToCloneTo []*string + + // READ-ONLY; The date and time that the database was created. + TimeCreated *time.Time + + // READ-ONLY; The date and time the Autonomous Data Guard role was switched for the Autonomous Database. + TimeDataGuardRoleChanged *string + + // READ-ONLY; The date and time the Always Free database will be automatically deleted because of inactivity. + TimeDeletionOfFreeAutonomousDatabase *string + + // READ-ONLY; The date and time that Autonomous Data Guard was enabled for an Autonomous Database where the standby was provisioned + // in the same region as the primary database. + TimeLocalDataGuardEnabled *string + + // READ-ONLY; The date and time when maintenance will begin. + TimeMaintenanceBegin *time.Time + + // READ-ONLY; The date and time when maintenance will end. + TimeMaintenanceEnd *time.Time + + // READ-ONLY; The timestamp of the last failover operation. + TimeOfLastFailover *string + + // READ-ONLY; The date and time when last refresh happened. + TimeOfLastRefresh *string + + // READ-ONLY; The refresh point timestamp (UTC). + TimeOfLastRefreshPoint *string + + // READ-ONLY; The timestamp of the last switchover operation for the Autonomous Database. + TimeOfLastSwitchover *string + + // READ-ONLY; The date and time the Always Free database will be stopped because of inactivity. + TimeReclamationOfFreeAutonomousDatabase *string + + // READ-ONLY; The storage space consumed by Autonomous Database in GBs. + UsedDataStorageSizeInGbs *int32 + + // READ-ONLY; The amount of storage that has been used, in terabytes. + UsedDataStorageSizeInTbs *int32 +} + +// GetAutonomousDatabaseBaseProperties implements the AutonomousDatabaseBasePropertiesClassification interface for type AutonomousDatabaseProperties. +func (a *AutonomousDatabaseProperties) GetAutonomousDatabaseBaseProperties() *AutonomousDatabaseBaseProperties { + return &AutonomousDatabaseBaseProperties{ + ActualUsedDataStorageSizeInTbs: a.ActualUsedDataStorageSizeInTbs, + AdminPassword: a.AdminPassword, + AllocatedStorageSizeInTbs: a.AllocatedStorageSizeInTbs, + ApexDetails: a.ApexDetails, + AutonomousDatabaseID: a.AutonomousDatabaseID, + AutonomousMaintenanceScheduleType: a.AutonomousMaintenanceScheduleType, + AvailableUpgradeVersions: a.AvailableUpgradeVersions, + BackupRetentionPeriodInDays: a.BackupRetentionPeriodInDays, + CPUCoreCount: a.CPUCoreCount, + CharacterSet: a.CharacterSet, + ComputeCount: a.ComputeCount, + ComputeModel: a.ComputeModel, + ConnectionStrings: a.ConnectionStrings, + ConnectionUrls: a.ConnectionUrls, + CustomerContacts: a.CustomerContacts, + DataBaseType: a.DataBaseType, + DataSafeStatus: a.DataSafeStatus, + DataStorageSizeInGbs: a.DataStorageSizeInGbs, + DataStorageSizeInTbs: a.DataStorageSizeInTbs, + DatabaseEdition: a.DatabaseEdition, + DbVersion: a.DbVersion, + DbWorkload: a.DbWorkload, + DisplayName: a.DisplayName, + FailedDataRecoveryInSeconds: a.FailedDataRecoveryInSeconds, + InMemoryAreaInGbs: a.InMemoryAreaInGbs, + IsAutoScalingEnabled: a.IsAutoScalingEnabled, + IsAutoScalingForStorageEnabled: a.IsAutoScalingForStorageEnabled, + IsLocalDataGuardEnabled: a.IsLocalDataGuardEnabled, + IsMtlsConnectionRequired: a.IsMtlsConnectionRequired, + IsPreview: a.IsPreview, + IsPreviewVersionWithServiceTermsAccepted: a.IsPreviewVersionWithServiceTermsAccepted, + IsRemoteDataGuardEnabled: a.IsRemoteDataGuardEnabled, + LicenseModel: a.LicenseModel, + LifecycleDetails: a.LifecycleDetails, + LifecycleState: a.LifecycleState, + LocalAdgAutoFailoverMaxDataLossLimit: a.LocalAdgAutoFailoverMaxDataLossLimit, + LocalDisasterRecoveryType: a.LocalDisasterRecoveryType, + LocalStandbyDb: a.LocalStandbyDb, + MemoryPerOracleComputeUnitInGbs: a.MemoryPerOracleComputeUnitInGbs, + NcharacterSet: a.NcharacterSet, + OciURL: a.OciURL, + Ocid: a.Ocid, + OpenMode: a.OpenMode, + OperationsInsightsStatus: a.OperationsInsightsStatus, + PeerDbID: a.PeerDbID, + PeerDbIDs: a.PeerDbIDs, + PermissionLevel: a.PermissionLevel, + PrivateEndpoint: a.PrivateEndpoint, + PrivateEndpointIP: a.PrivateEndpointIP, + PrivateEndpointLabel: a.PrivateEndpointLabel, + ProvisionableCpus: a.ProvisionableCpus, + ProvisioningState: a.ProvisioningState, + Role: a.Role, + SQLWebDeveloperURL: a.SQLWebDeveloperURL, + ScheduledOperations: a.ScheduledOperations, + ServiceConsoleURL: a.ServiceConsoleURL, + SubnetID: a.SubnetID, + SupportedRegionsToCloneTo: a.SupportedRegionsToCloneTo, + TimeCreated: a.TimeCreated, + TimeDataGuardRoleChanged: a.TimeDataGuardRoleChanged, + TimeDeletionOfFreeAutonomousDatabase: a.TimeDeletionOfFreeAutonomousDatabase, + TimeLocalDataGuardEnabled: a.TimeLocalDataGuardEnabled, + TimeMaintenanceBegin: a.TimeMaintenanceBegin, + TimeMaintenanceEnd: a.TimeMaintenanceEnd, + TimeOfLastFailover: a.TimeOfLastFailover, + TimeOfLastRefresh: a.TimeOfLastRefresh, + TimeOfLastRefreshPoint: a.TimeOfLastRefreshPoint, + TimeOfLastSwitchover: a.TimeOfLastSwitchover, + TimeReclamationOfFreeAutonomousDatabase: a.TimeReclamationOfFreeAutonomousDatabase, + UsedDataStorageSizeInGbs: a.UsedDataStorageSizeInGbs, + UsedDataStorageSizeInTbs: a.UsedDataStorageSizeInTbs, + VnetID: a.VnetID, + WhitelistedIPs: a.WhitelistedIPs, + } +} + +// AutonomousDatabaseStandbySummary - Autonomous Disaster Recovery standby database details. +type AutonomousDatabaseStandbySummary struct { + // The amount of time, in seconds, that the data of the standby database lags the data of the primary database. Can be used + // to determine the potential data loss in the event of a failover. + LagTimeInSeconds *int32 + + // Additional information about the current lifecycle state. + LifecycleDetails *string + + // The current state of the Autonomous Database. + LifecycleState *AutonomousDatabaseLifecycleState + + // The date and time the Autonomous Data Guard role was switched for the standby Autonomous Database. + TimeDataGuardRoleChanged *string + + // The date and time the Disaster Recovery role was switched for the standby Autonomous Database. + TimeDisasterRecoveryRoleChanged *string +} + +// AutonomousDatabaseUpdate - The type used for update operations of the AutonomousDatabase. +type AutonomousDatabaseUpdate struct { + // The updatable properties of the AutonomousDatabase. + Properties *AutonomousDatabaseUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// AutonomousDatabaseUpdateProperties - The updatable properties of the AutonomousDatabase. +type AutonomousDatabaseUpdateProperties struct { + // Admin password. + AdminPassword *string + + // The maintenance schedule type of the Autonomous Database Serverless. + AutonomousMaintenanceScheduleType *AutonomousMaintenanceScheduleType + + // Retention period, in days, for long-term backups + BackupRetentionPeriodInDays *int32 + + // The number of CPU cores to be made available to the database. + CPUCoreCount *int32 + + // The compute amount (CPUs) available to the database. + ComputeCount *float32 + + // Customer Contacts. + CustomerContacts []*CustomerContact + + // The size, in gigabytes, of the data volume that will be created and attached to the database. + DataStorageSizeInGbs *int32 + + // The quantity of data in the database, in terabytes. + DataStorageSizeInTbs *int32 + + // The Oracle Database Edition that applies to the Autonomous databases. + DatabaseEdition *DatabaseEditionType + + // The user-friendly name for the Autonomous Database. + DisplayName *string + + // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. + IsAutoScalingEnabled *bool + + // Indicates if auto scaling is enabled for the Autonomous Database storage. + IsAutoScalingForStorageEnabled *bool + + // Indicates whether the Autonomous Database has local or called in-region Data Guard enabled. + IsLocalDataGuardEnabled *bool + + // Specifies if the Autonomous Database requires mTLS connections. + IsMtlsConnectionRequired *bool + + // The Oracle license model that applies to the Oracle Autonomous Database. The default is LICENSE_INCLUDED. + LicenseModel *LicenseModel + + // Parameter that allows users to select an acceptable maximum data loss limit in seconds, up to which Automatic Failover + // will be triggered when necessary for a Local Autonomous Data Guard + LocalAdgAutoFailoverMaxDataLossLimit *int32 + + // Indicates the Autonomous Database mode. + OpenMode *OpenModeType + + // The database OCID of the Disaster Recovery peer database, which is located in a different region from the current peer + // database. + PeerDbID *string + + // The Autonomous Database permission level. + PermissionLevel *PermissionLevelType + + // The Data Guard role of the Autonomous Container Database or Autonomous Database, if Autonomous Data Guard is enabled. + Role *RoleType + + // The list of scheduled operations. + ScheduledOperations *ScheduledOperationsTypeUpdate + + // The client IP access control list (ACL). This is an array of CIDR notations and/or IP addresses. Values should be separate + // strings, separated by commas. Example: ['1.1.1.1','1.1.1.0/24','1.1.2.25'] + WhitelistedIPs []*string +} + +// AutonomousDatabaseWalletFile - Autonomous Database Wallet File resource model. +type AutonomousDatabaseWalletFile struct { + // REQUIRED; The base64 encoded wallet files + WalletFiles *string +} + +// AutonomousDbVersion resource definition +type AutonomousDbVersion struct { + // The resource-specific properties for this resource. + Properties *AutonomousDbVersionProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AutonomousDbVersionListResult - The response of a AutonomousDbVersion list operation. +type AutonomousDbVersionListResult struct { + // REQUIRED; The AutonomousDbVersion items on this page + Value []*AutonomousDbVersion + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// AutonomousDbVersionProperties - AutonomousDbVersion resource model +type AutonomousDbVersionProperties struct { + // READ-ONLY; Supported Autonomous Db versions. + Version *string + + // READ-ONLY; The Autonomous Database workload type + DbWorkload *WorkloadType + + // READ-ONLY; True if this version of the Oracle Database software's default is free. + IsDefaultForFree *bool + + // READ-ONLY; True if this version of the Oracle Database software's default is paid. + IsDefaultForPaid *bool + + // READ-ONLY; True if this version of the Oracle Database software can be used for Always-Free Autonomous Databases. + IsFreeTierEnabled *bool + + // READ-ONLY; True if this version of the Oracle Database software has payments enabled. + IsPaidEnabled *bool +} + +// CloudAccountDetails - Cloud Account Details model +type CloudAccountDetails struct { + // READ-ONLY; Cloud Account Home region + CloudAccountHomeRegion *string + + // READ-ONLY; Cloud Account name + CloudAccountName *string +} + +// CloudExadataInfrastructure resource definition +type CloudExadataInfrastructure struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // REQUIRED; CloudExadataInfrastructure zones + Zones []*string + + // The resource-specific properties for this resource. + Properties *CloudExadataInfrastructureProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// CloudExadataInfrastructureListResult - The response of a CloudExadataInfrastructure list operation. +type CloudExadataInfrastructureListResult struct { + // REQUIRED; The CloudExadataInfrastructure items on this page + Value []*CloudExadataInfrastructure + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// CloudExadataInfrastructureProperties - CloudExadataInfrastructure resource model +type CloudExadataInfrastructureProperties struct { + // REQUIRED; The name for the Exadata infrastructure. + DisplayName *string + + // REQUIRED; The model name of the cloud Exadata infrastructure resource. + Shape *string + + // The number of compute servers for the cloud Exadata infrastructure. + ComputeCount *int32 + + // The list of customer email addresses that receive information from Oracle about the specified OCI Database service resource. + // Oracle uses these email addresses to send notifications about planned and + // unplanned software maintenance updates, information about system hardware, and other information needed by administrators. + // Up to 10 email addresses can be added to the customer contacts for a cloud + // Exadata infrastructure instance. + CustomerContacts []*CustomerContact + + // maintenanceWindow property + MaintenanceWindow *MaintenanceWindow + + // The number of storage servers for the cloud Exadata infrastructure. + StorageCount *int32 + + // READ-ONLY; The requested number of additional storage servers activated for the Exadata infrastructure. + ActivatedStorageCount *int32 + + // READ-ONLY; The requested number of additional storage servers for the Exadata infrastructure. + AdditionalStorageCount *int32 + + // READ-ONLY; The available storage can be allocated to the cloud Exadata infrastructure resource, in gigabytes (GB). + AvailableStorageSizeInGbs *int32 + + // READ-ONLY; The total number of CPU cores allocated. + CPUCount *int32 + + // READ-ONLY; The quantity of data in the database, in terabytes. + DataStorageSizeInTbs *int32 + + // READ-ONLY; The local node storage to be allocated in GBs. + DbNodeStorageSizeInGbs *int32 + + // READ-ONLY; The software version of the database servers (dom0) in the Exadata infrastructure. + DbServerVersion *string + + // READ-ONLY; The estimated total time required in minutes for all patching operations (database server, storage server, and + // network switch patching). + EstimatedPatchingTime *EstimatedPatchingTime + + // READ-ONLY; The OCID of the last maintenance run. + LastMaintenanceRunID *string + + // READ-ONLY; Additional information about the current lifecycle state. + LifecycleDetails *string + + // READ-ONLY; CloudExadataInfrastructure lifecycle state + LifecycleState *CloudExadataInfrastructureLifecycleState + + // READ-ONLY; The total number of CPU cores available. + MaxCPUCount *int32 + + // READ-ONLY; The total available DATA disk group size. + MaxDataStorageInTbs *float64 + + // READ-ONLY; The total local node storage available in GBs. + MaxDbNodeStorageSizeInGbs *int32 + + // READ-ONLY; The total memory available in GBs. + MaxMemoryInGbs *int32 + + // READ-ONLY; The memory allocated in GBs. + MemorySizeInGbs *int32 + + // READ-ONLY; Monthly Db Server version + MonthlyDbServerVersion *string + + // READ-ONLY; Monthly Storage Server version + MonthlyStorageServerVersion *string + + // READ-ONLY; The OCID of the next maintenance run. + NextMaintenanceRunID *string + + // READ-ONLY; HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + OciURL *string + + // READ-ONLY; Exadata infra ocid + Ocid *string + + // READ-ONLY; CloudExadataInfrastructure provisioning state + ProvisioningState *AzureResourceProvisioningState + + // READ-ONLY; The software version of the storage servers (cells) in the Exadata infrastructure. + StorageServerVersion *string + + // READ-ONLY; The date and time the cloud Exadata infrastructure resource was created. + TimeCreated *string + + // READ-ONLY; The total storage allocated to the cloud Exadata infrastructure resource, in gigabytes (GB). + TotalStorageSizeInGbs *int32 +} + +// CloudExadataInfrastructureUpdate - The type used for update operations of the CloudExadataInfrastructure. +type CloudExadataInfrastructureUpdate struct { + // The updatable properties of the CloudExadataInfrastructure. + Properties *CloudExadataInfrastructureUpdateProperties + + // Resource tags. + Tags map[string]*string + + // CloudExadataInfrastructure zones + Zones []*string +} + +// CloudExadataInfrastructureUpdateProperties - The updatable properties of the CloudExadataInfrastructure. +type CloudExadataInfrastructureUpdateProperties struct { + // The number of compute servers for the cloud Exadata infrastructure. + ComputeCount *int32 + + // The list of customer email addresses that receive information from Oracle about the specified OCI Database service resource. + // Oracle uses these email addresses to send notifications about planned and + // unplanned software maintenance updates, information about system hardware, and other information needed by administrators. + // Up to 10 email addresses can be added to the customer contacts for a cloud + // Exadata infrastructure instance. + CustomerContacts []*CustomerContact + + // The name for the Exadata infrastructure. + DisplayName *string + + // maintenanceWindow property + MaintenanceWindow *MaintenanceWindow + + // The number of storage servers for the cloud Exadata infrastructure. + StorageCount *int32 +} + +// CloudVMCluster - CloudVmCluster resource definition +type CloudVMCluster struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CloudVMClusterProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// CloudVMClusterListResult - The response of a CloudVmCluster list operation. +type CloudVMClusterListResult struct { + // REQUIRED; The CloudVmCluster items on this page + Value []*CloudVMCluster + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// CloudVMClusterProperties - CloudVmCluster resource model +type CloudVMClusterProperties struct { + // REQUIRED; The number of CPU cores enabled on the cloud VM cluster. + CPUCoreCount *int32 + + // REQUIRED; Cloud Exadata Infrastructure ID + CloudExadataInfrastructureID *string + + // REQUIRED; Display Name + DisplayName *string + + // REQUIRED; Oracle Grid Infrastructure (GI) software version + GiVersion *string + + // REQUIRED; The hostname for the cloud VM cluster. + Hostname *string + + // REQUIRED; The public key portion of one or more key pairs used for SSH access to the cloud VM cluster. + SSHPublicKeys []*string + + // REQUIRED; Client subnet + SubnetID *string + + // REQUIRED; VNET for network connectivity + VnetID *string + + // Client OCI backup subnet CIDR, default is 192.168.252.0/22 + BackupSubnetCidr *string + + // The cluster name for cloud VM cluster. The cluster name must begin with an alphabetic character, and may contain hyphens + // (-). Underscores (_) are not permitted. The cluster name can be no longer than + // 11 characters and is not case sensitive. + ClusterName *string + + // The list of compute servers to be added to the cloud VM cluster. + ComputeNodes []*string + + // Indicates user preferences for the various diagnostic collection options for the VM cluster/Cloud VM cluster/VMBM DBCS. + DataCollectionOptions *DataCollectionOptions + + // The percentage assigned to DATA storage (user data and database files). The remaining percentage is assigned to RECO storage + // (database redo logs, archive logs, and recovery manager backups). Accepted + // values are 35, 40, 60 and 80. The default is 80 percent assigned to DATA storage. See Storage Configuration [/Content/Database/Concepts/exaoverview.htm#Exadata] + // in the Exadata documentation for + // details on the impact of the configuration settings on storage. + DataStoragePercentage *int32 + + // The data disk group size to be allocated in TBs. + DataStorageSizeInTbs *float64 + + // The local node storage to be allocated in GBs. + DbNodeStorageSizeInGbs *int32 + + // The list of DB servers. + DbServers []*string + + // The domain name for the cloud VM cluster. + Domain *string + + // If true, database backup on local Exadata storage is configured for the cloud VM cluster. If false, database backup on + // local Exadata storage is not available in the cloud VM cluster. + IsLocalBackupEnabled *bool + + // If true, sparse disk group is configured for the cloud VM cluster. If false, sparse disk group is not created. + IsSparseDiskgroupEnabled *bool + + // The Oracle license model that applies to the cloud VM cluster. The default is LICENSE_INCLUDED. + LicenseModel *LicenseModel + + // The memory to be allocated in GBs. + MemorySizeInGbs *int32 + + // CIDR blocks for additional NSG ingress rules. The VNET CIDRs used to provision the VM Cluster will be added by default. + NsgCidrs []*NSGCidr + + // The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal place is allowed for the fractional part. + OcpuCount *float32 + + // The TCP Single Client Access Name (SCAN) port. The default port is 1521. + ScanListenerPortTCP *int32 + + // The TCPS Single Client Access Name (SCAN) port. The default port is 2484. + ScanListenerPortTCPSSL *int32 + + // The data disk group size to be allocated in GBs per VM. + StorageSizeInGbs *int32 + + // The time zone of the cloud VM cluster. For details, see Exadata Infrastructure Time Zones [/Content/Database/References/timezones.htm]. + TimeZone *string + + // The OCID of the zone the cloud VM cluster is associated with. + ZoneID *string + + // READ-ONLY; Cluster compartmentId + CompartmentID *string + + // READ-ONLY; The type of redundancy configured for the cloud Vm cluster. NORMAL is 2-way redundancy. HIGH is 3-way redundancy. + DiskRedundancy *DiskRedundancy + + // READ-ONLY; iormConfigCache details for cloud VM cluster. + IormConfigCache *ExadataIormConfig + + // READ-ONLY; The OCID of the last maintenance update history entry. + LastUpdateHistoryEntryID *string + + // READ-ONLY; Additional information about the current lifecycle state. + LifecycleDetails *string + + // READ-ONLY; CloudVmCluster lifecycle state + LifecycleState *CloudVMClusterLifecycleState + + // READ-ONLY; The port number configured for the listener on the cloud VM cluster. + ListenerPort *int64 + + // READ-ONLY; The number of nodes in the cloud VM cluster. + NodeCount *int32 + + // READ-ONLY; HTTPS link to OCI Network Security Group exposed to Azure Customer via the Azure Interface. + NsgURL *string + + // READ-ONLY; HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + OciURL *string + + // READ-ONLY; Cloud VM Cluster ocid + Ocid *string + + // READ-ONLY; CloudVmCluster provisioning state + ProvisioningState *AzureResourceProvisioningState + + // READ-ONLY; The FQDN of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster. + ScanDNSName *string + + // READ-ONLY; The OCID of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster. + ScanDNSRecordID *string + + // READ-ONLY; The Single Client Access Name (SCAN) IP addresses associated with the cloud VM cluster. SCAN IP addresses are + // typically used for load balancing and are not assigned to any interface. Oracle + // Clusterware directs the requests to the appropriate nodes in the cluster. Note: For a single-node DB system, this list + // is empty. + ScanIPIDs []*string + + // READ-ONLY; The model name of the Exadata hardware running the cloud VM cluster. + Shape *string + + // READ-ONLY; Cluster subnet ocid + SubnetOcid *string + + // READ-ONLY; Operating system version of the image. + SystemVersion *string + + // READ-ONLY; The date and time that the cloud VM cluster was created. + TimeCreated *time.Time + + // READ-ONLY; The virtual IP (VIP) addresses associated with the cloud VM cluster. The Cluster Ready Services (CRS) creates + // and maintains one VIP address for each node in the Exadata Cloud Service instance to + // enable failover. If one node fails, the VIP is reassigned to another active node in the cluster. Note: For a single-node + // DB system, this list is empty. + VipIDs []*string +} + +// CloudVMClusterUpdate - The type used for update operations of the CloudVmCluster. +type CloudVMClusterUpdate struct { + // The updatable properties of the CloudVmCluster. + Properties *CloudVMClusterUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// CloudVMClusterUpdateProperties - The updatable properties of the CloudVmCluster. +type CloudVMClusterUpdateProperties struct { + // The number of CPU cores enabled on the cloud VM cluster. + CPUCoreCount *int32 + + // The list of compute servers to be added to the cloud VM cluster. + ComputeNodes []*string + + // Indicates user preferences for the various diagnostic collection options for the VM cluster/Cloud VM cluster/VMBM DBCS. + DataCollectionOptions *DataCollectionOptions + + // The data disk group size to be allocated in TBs. + DataStorageSizeInTbs *float64 + + // The local node storage to be allocated in GBs. + DbNodeStorageSizeInGbs *int32 + + // Display Name + DisplayName *string + + // The Oracle license model that applies to the cloud VM cluster. The default is LICENSE_INCLUDED. + LicenseModel *LicenseModel + + // The memory to be allocated in GBs. + MemorySizeInGbs *int32 + + // The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal place is allowed for the fractional part. + OcpuCount *float32 + + // The public key portion of one or more key pairs used for SSH access to the cloud VM cluster. + SSHPublicKeys []*string + + // The data disk group size to be allocated in GBs per VM. + StorageSizeInGbs *int32 +} + +// ConnectionStringType - Connection strings to connect to an Oracle Autonomous Database. +type ConnectionStringType struct { + // Returns all connection strings that can be used to connect to the Autonomous Database. + AllConnectionStrings *AllConnectionStringType + + // The database service provides the least level of resources to each SQL statement, but supports the most number of concurrent + // SQL statements. + Dedicated *string + + // The High database service provides the highest level of resources to each SQL statement resulting in the highest performance, + // but supports the fewest number of concurrent SQL statements. + High *string + + // The Low database service provides the least level of resources to each SQL statement, but supports the most number of concurrent + // SQL statements. + Low *string + + // The Medium database service provides a lower level of resources to each SQL statement potentially resulting a lower level + // of performance, but supports more concurrent SQL statements. + Medium *string + + // A list of connection string profiles to allow clients to group, filter and select connection string values based on structured + // metadata. + Profiles []*ProfileType +} + +// ConnectionURLType - The URLs for accessing Oracle Application Express (APEX) and SQL Developer Web with a browser from +// a Compute instance within your VCN or that has a direct connection to your VCN. +type ConnectionURLType struct { + // Oracle Application Express (APEX) URL. + ApexURL *string + + // The URL of the Database Transforms for the Autonomous Database. + DatabaseTransformsURL *string + + // The URL of the Graph Studio for the Autonomous Database. + GraphStudioURL *string + + // The URL of the Oracle Machine Learning (OML) Notebook for the Autonomous Database. + MachineLearningNotebookURL *string + + // The URL of the MongoDB API for the Autonomous Database. + MongoDbURL *string + + // The Oracle REST Data Services (ORDS) URL of the Web Access for the Autonomous Database. + OrdsURL *string + + // Oracle SQL Developer Web URL. + SQLDevWebURL *string +} + +// CustomerContact resource properties +type CustomerContact struct { + // REQUIRED; The email address used by Oracle to send notifications regarding databases and infrastructure. + Email *string +} + +// DNSPrivateView - DnsPrivateView resource definition +type DNSPrivateView struct { + // The resource-specific properties for this resource. + Properties *DNSPrivateViewProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// DNSPrivateViewListResult - The response of a DnsPrivateView list operation. +type DNSPrivateViewListResult struct { + // REQUIRED; The DnsPrivateView items on this page + Value []*DNSPrivateView + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// DNSPrivateViewProperties - Views resource model +type DNSPrivateViewProperties struct { + // READ-ONLY; A Boolean flag indicating whether or not parts of the resource are unable to be explicitly managed. + IsProtected *bool + + // READ-ONLY; The OCID of the view + Ocid *string + + // READ-ONLY; The canonical absolute URL of the resource. + Self *string + + // READ-ONLY; views timeCreated + TimeCreated *time.Time + + // READ-ONLY; views timeCreated + TimeUpdated *time.Time + + // READ-ONLY; The display name of the view resource + DisplayName *string + + // READ-ONLY; Views lifecycleState + LifecycleState *DNSPrivateViewsLifecycleState + + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *ResourceProvisioningState +} + +// DNSPrivateZone - DnsPrivateZone resource definition +type DNSPrivateZone struct { + // The resource-specific properties for this resource. + Properties *DNSPrivateZoneProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// DNSPrivateZoneListResult - The response of a DnsPrivateZone list operation. +type DNSPrivateZoneListResult struct { + // REQUIRED; The DnsPrivateZone items on this page + Value []*DNSPrivateZone + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// DNSPrivateZoneProperties - Zones resource model +type DNSPrivateZoneProperties struct { + // READ-ONLY; A Boolean flag indicating whether or not parts of the resource are unable to be explicitly managed. + IsProtected *bool + + // READ-ONLY; The OCID of the Zone + Ocid *string + + // READ-ONLY; The canonical absolute URL of the resource. + Self *string + + // READ-ONLY; The current serial of the zone. As seen in the zone's SOA record. + Serial *int32 + + // READ-ONLY; Zones timeCreated + TimeCreated *time.Time + + // READ-ONLY; Version is the never-repeating, totally-orderable, version of the zone, from which the serial field of the zone's + // SOA record is derived. + Version *string + + // READ-ONLY; The type of the zone. Must be either PRIMARY or SECONDARY. SECONDARY is only supported for GLOBAL zones. + ZoneType *ZoneType + + // READ-ONLY; Zones lifecycleState + LifecycleState *DNSPrivateZonesLifecycleState + + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *ResourceProvisioningState + + // READ-ONLY; The OCID of the private view containing the zone. This value will be null for zones in the global DNS, which + // are publicly resolvable and not part of a private view. + ViewID *string +} + +// DataCollectionOptions resource properties +type DataCollectionOptions struct { + // Indicates whether diagnostic collection is enabled for the VM cluster/Cloud VM cluster/VMBM DBCS. + IsDiagnosticsEventsEnabled *bool + + // Indicates whether health monitoring is enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. + IsHealthMonitoringEnabled *bool + + // Indicates whether incident logs and trace collection are enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. + IsIncidentLogsEnabled *bool +} + +// DayOfWeek resource properties +type DayOfWeek struct { + // REQUIRED; Name of the day of the week. + Name *DayOfWeekName +} + +// DayOfWeekUpdate - DayOfWeek resource properties +type DayOfWeekUpdate struct { + // Name of the day of the week. + Name *DayOfWeekName +} + +// DbIormConfig for cloud vm cluster +type DbIormConfig struct { + // The database name. For the default DbPlan, the dbName is default. + DbName *string + + // The flash cache limit for this database. This value is internally configured based on the share value assigned to the database. + FlashCacheLimit *string + + // The relative priority of this database. + Share *int32 +} + +// DbNode - The DbNode resource belonging to vmCluster +type DbNode struct { + // The resource-specific properties for this resource. + Properties *DbNodeProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// DbNodeAction - DbNode action object +type DbNodeAction struct { + // REQUIRED; Db action + Action *DbNodeActionEnum +} + +// DbNodeListResult - The response of a DbNode list operation. +type DbNodeListResult struct { + // REQUIRED; The DbNode items on this page + Value []*DbNode + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// DbNodeProperties - The properties of DbNodeResource +type DbNodeProperties struct { + // READ-ONLY; The OCID of the DB system. + DbSystemID *string + + // READ-ONLY; DbNode OCID + Ocid *string + + // READ-ONLY; Additional information about the planned maintenance. + AdditionalDetails *string + + // READ-ONLY; The OCID of the backup IP address associated with the database node. + BackupIPID *string + + // READ-ONLY; The OCID of the second backup VNIC. + BackupVnic2ID *string + + // READ-ONLY; The OCID of the backup VNIC. + BackupVnicID *string + + // READ-ONLY; The number of CPU cores enabled on the Db node. + CPUCoreCount *int32 + + // READ-ONLY; The allocated local node storage in GBs on the Db node. + DbNodeStorageSizeInGbs *int32 + + // READ-ONLY; The OCID of the Exacc Db server associated with the database node. + DbServerID *string + + // READ-ONLY; The name of the Fault Domain the instance is contained in. + FaultDomain *string + + // READ-ONLY; The OCID of the host IP address associated with the database node. + HostIPID *string + + // READ-ONLY; The host name for the database node. + Hostname *string + + // READ-ONLY; Lifecycle details of Db Node. + LifecycleDetails *string + + // READ-ONLY; The current state of the database node. + LifecycleState *DbNodeProvisioningState + + // READ-ONLY; The type of database node maintenance. + MaintenanceType *DbNodeMaintenanceType + + // READ-ONLY; The allocated memory in GBs on the Db node. + MemorySizeInGbs *int32 + + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *ResourceProvisioningState + + // READ-ONLY; The size (in GB) of the block storage volume allocation for the DB system. This attribute applies only for virtual + // machine DB systems. + SoftwareStorageSizeInGb *int32 + + // READ-ONLY; The date and time that the database node was created. + TimeCreated *time.Time + + // READ-ONLY; End date and time of maintenance window. + TimeMaintenanceWindowEnd *time.Time + + // READ-ONLY; Start date and time of maintenance window. + TimeMaintenanceWindowStart *time.Time + + // READ-ONLY; The OCID of the second VNIC. + Vnic2ID *string + + // READ-ONLY; The OCID of the VNIC. + VnicID *string +} + +// DbServer resource model +type DbServer struct { + // The resource-specific properties for this resource. + Properties *DbServerProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// DbServerListResult - The response of a DbServer list operation. +type DbServerListResult struct { + // REQUIRED; The DbServer items on this page + Value []*DbServer + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// DbServerPatchingDetails - DbServer Patching Properties +type DbServerPatchingDetails struct { + // READ-ONLY; Estimated Patch Duration + EstimatedPatchDuration *int32 + + // READ-ONLY; Patching Status + PatchingStatus *DbServerPatchingStatus + + // READ-ONLY; Time Patching Ended + TimePatchingEnded *time.Time + + // READ-ONLY; Time Patching Started + TimePatchingStarted *time.Time +} + +// DbServerProperties - DbServer resource properties +type DbServerProperties struct { + // READ-ONLY; The list of OCIDs of the Autonomous VM Clusters associated with the Db server. + AutonomousVMClusterIDs []*string + + // READ-ONLY; The list of OCIDs of the Autonomous Virtual Machines associated with the Db server. + AutonomousVirtualMachineIDs []*string + + // READ-ONLY; The number of CPU cores enabled on the Db server. + CPUCoreCount *int32 + + // READ-ONLY; The OCID of the compartment. + CompartmentID *string + + // READ-ONLY; The OCID of the Db nodes associated with the Db server. + DbNodeIDs []*string + + // READ-ONLY; The allocated local node storage in GBs on the Db server. + DbNodeStorageSizeInGbs *int32 + + // READ-ONLY; dbServerPatching details of the Db server. + DbServerPatchingDetails *DbServerPatchingDetails + + // READ-ONLY; The name for the Db Server. + DisplayName *string + + // READ-ONLY; The OCID of the Exadata infrastructure. + ExadataInfrastructureID *string + + // READ-ONLY; Lifecycle details of dbServer. + LifecycleDetails *string + + // READ-ONLY; DbServer provisioning state. + LifecycleState *DbServerProvisioningState + + // READ-ONLY; The total number of CPU cores available. + MaxCPUCount *int32 + + // READ-ONLY; The total max dbNode storage in GBs. + MaxDbNodeStorageInGbs *int32 + + // READ-ONLY; The total memory available in GBs. + MaxMemoryInGbs *int32 + + // READ-ONLY; The total memory size in GBs. + MemorySizeInGbs *int32 + + // READ-ONLY; Db server name. + Ocid *string + + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *ResourceProvisioningState + + // READ-ONLY; The shape of the Db server. The shape determines the amount of CPU, storage, and memory resources available. + Shape *string + + // READ-ONLY; The date and time that the Db Server was created. + TimeCreated *time.Time + + // READ-ONLY; The OCID of the VM Clusters associated with the Db server. + VMClusterIDs []*string +} + +// DbSystemShape resource definition +type DbSystemShape struct { + // The resource-specific properties for this resource. + Properties *DbSystemShapeProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// DbSystemShapeListResult - The response of a DbSystemShape list operation. +type DbSystemShapeListResult struct { + // REQUIRED; The DbSystemShape items on this page + Value []*DbSystemShape + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// DbSystemShapeProperties - DbSystemShape resource model +type DbSystemShapeProperties struct { + // READ-ONLY; The maximum number of CPU cores that can be enabled on the DB system for this shape. + AvailableCoreCount *int32 + + // READ-ONLY; The maximum number of CPU cores per database node that can be enabled for this shape. Only applicable to the + // flex Exadata shape and ExaCC Elastic shapes. + AvailableCoreCountPerNode *int32 + + // READ-ONLY; The maximum DATA storage that can be enabled for this shape. + AvailableDataStorageInTbs *int32 + + // READ-ONLY; The maximum data storage available per storage server for this shape. Only applicable to ExaCC Elastic shapes. + AvailableDataStoragePerServerInTbs *float64 + + // READ-ONLY; The maximum Db Node storage available per database node for this shape. Only applicable to ExaCC Elastic shapes. + AvailableDbNodePerNodeInGbs *int32 + + // READ-ONLY; The maximum Db Node storage that can be enabled for this shape. + AvailableDbNodeStorageInGbs *int32 + + // READ-ONLY; The maximum memory that can be enabled for this shape. + AvailableMemoryInGbs *int32 + + // READ-ONLY; The maximum memory available per database node for this shape. Only applicable to ExaCC Elastic shapes. + AvailableMemoryPerNodeInGbs *int32 + + // READ-ONLY; The discrete number by which the CPU core count for this shape can be increased or decreased. + CoreCountIncrement *int32 + + // READ-ONLY; The maximum number of Exadata storage servers available for the Exadata infrastructure. + MaxStorageCount *int32 + + // READ-ONLY; The maximum number of database nodes available for this shape. + MaximumNodeCount *int32 + + // READ-ONLY; The minimum number of CPU cores that can be enabled per node for this shape. + MinCoreCountPerNode *int32 + + // READ-ONLY; The minimum data storage that need be allocated for this shape. + MinDataStorageInTbs *int32 + + // READ-ONLY; The minimum Db Node storage that need be allocated per node for this shape. + MinDbNodeStoragePerNodeInGbs *int32 + + // READ-ONLY; The minimum memory that need be allocated per node for this shape. + MinMemoryPerNodeInGbs *int32 + + // READ-ONLY; The minimum number of Exadata storage servers available for the Exadata infrastructure. + MinStorageCount *int32 + + // READ-ONLY; The minimum number of CPU cores that can be enabled on the DB system for this shape. + MinimumCoreCount *int32 + + // READ-ONLY; The minimum number of database nodes available for this shape. + MinimumNodeCount *int32 + + // READ-ONLY; The runtime minimum number of CPU cores that can be enabled on the DB system for this shape. + RuntimeMinimumCoreCount *int32 + + // READ-ONLY; The family of the shape used for the DB system. + ShapeFamily *string +} + +// EstimatedPatchingTime - The estimated total time required in minutes for all patching operations (database server, storage +// server, and network switch patching). +type EstimatedPatchingTime struct { + // READ-ONLY; The estimated time required in minutes for database server patching. + EstimatedDbServerPatchingTime *int32 + + // READ-ONLY; The estimated time required in minutes for network switch patching. + EstimatedNetworkSwitchesPatchingTime *int32 + + // READ-ONLY; The estimated time required in minutes for storage server patching. + EstimatedStorageServerPatchingTime *int32 + + // READ-ONLY; The estimated total time required in minutes for all patching operations. + TotalEstimatedPatchingTime *int32 +} + +// ExadataIormConfig for cloud vm cluster +type ExadataIormConfig struct { + // An array of IORM settings for all the database in the Exadata DB system. + DbPlans []*DbIormConfig + + // Additional information about the current lifecycleState. + LifecycleDetails *string + + // The current state of IORM configuration for the Exadata DB system. + LifecycleState *IormLifecycleState + + // The current value for the IORM objective. The default is AUTO. + Objective *Objective +} + +// GenerateAutonomousDatabaseWalletDetails - Autonomous Database Generate Wallet resource model. +type GenerateAutonomousDatabaseWalletDetails struct { + // REQUIRED; The password to encrypt the keys inside the wallet + Password *string + + // The type of wallet to generate. + GenerateType *GenerateType + + // True when requesting regional connection strings in PDB connect info, applicable to cross-region DG only. + IsRegional *bool +} + +// GiVersion resource definition +type GiVersion struct { + // The resource-specific properties for this resource. + Properties *GiVersionProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// GiVersionListResult - The response of a GiVersion list operation. +type GiVersionListResult struct { + // REQUIRED; The GiVersion items on this page + Value []*GiVersion + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// GiVersionProperties - GiVersion resource model +type GiVersionProperties struct { + // READ-ONLY; A valid Oracle Grid Infrastructure (GI) software version. + Version *string +} + +// MaintenanceWindow resource properties +type MaintenanceWindow struct { + // Determines the amount of time the system will wait before the start of each database server patching operation. Custom + // action timeout is in minutes and valid value is between 15 to 120 (inclusive). + CustomActionTimeoutInMins *int32 + + // Days during the week when maintenance should be performed. + DaysOfWeek []*DayOfWeek + + // The window of hours during the day when maintenance should be performed. The window is a 4 hour slot. Valid values are + // - 0 - represents time slot 0:00 - 3:59 UTC - 4 - represents time slot 4:00 - 7:59 + // UTC - 8 - represents time slot 8:00 - 11:59 UTC - 12 - represents time slot 12:00 - 15:59 UTC - 16 - represents time slot + // 16:00 - 19:59 UTC - 20 - represents time slot 20:00 - 23:59 UTC + HoursOfDay []*int32 + + // If true, enables the configuration of a custom action timeout (waiting period) between database server patching operations. + IsCustomActionTimeoutEnabled *bool + + // is Monthly Patching Enabled + IsMonthlyPatchingEnabled *bool + + // Lead time window allows user to set a lead time to prepare for a down time. The lead time is in weeks and valid value is + // between 1 to 4. + LeadTimeInWeeks *int32 + + // Months during the year when maintenance should be performed. + Months []*Month + + // Cloud Exadata infrastructure node patching method. + PatchingMode *PatchingMode + + // The maintenance window scheduling preference. + Preference *Preference + + // Weeks during the month when maintenance should be performed. Weeks start on the 1st, 8th, 15th, and 22nd days of the month, + // and have a duration of 7 days. Weeks start and end based on calendar dates, + // not days of the week. For example, to allow maintenance during the 2nd week of the month (from the 8th day to the 14th + // day of the month), use the value 2. Maintenance cannot be scheduled for the fifth + // week of months that contain more than 28 days. Note that this parameter works in conjunction with the daysOfWeek and hoursOfDay + // parameters to allow you to specify specific days of the week and hours + // that maintenance will be performed. + WeeksOfMonth []*int32 +} + +// Month resource properties +type Month struct { + // REQUIRED; Name of the month of the year. + Name *MonthName +} + +// NSGCidr - A rule for allowing inbound (INGRESS) IP packets +type NSGCidr struct { + // REQUIRED; Conceptually, this is the range of IP addresses that a packet coming into the instance can come from. + Source *string + + // Destination port range to specify particular destination ports for TCP rules. + DestinationPortRange *PortRange +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// OracleSubscription resource definition +type OracleSubscription struct { + // Details of the resource plan. + Plan *Plan + + // The resource-specific properties for this resource. + Properties *OracleSubscriptionProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// OracleSubscriptionListResult - The response of a OracleSubscription list operation. +type OracleSubscriptionListResult struct { + // REQUIRED; The OracleSubscription items on this page + Value []*OracleSubscription + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// OracleSubscriptionProperties - Oracle Subscription resource model +type OracleSubscriptionProperties struct { + // Intent for the update operation + Intent *Intent + + // Product code for the term unit + ProductCode *string + + // Term Unit. P1Y, P3Y, etc, see Durations https://en.wikipedia.org/wiki/ISO_8601 + TermUnit *string + + // READ-ONLY; Cloud Account Id + CloudAccountID *string + + // READ-ONLY; Cloud Account provisioning state. + CloudAccountState *CloudAccountProvisioningState + + // READ-ONLY; OracleSubscriptionProvisioningState provisioning state + ProvisioningState *OracleSubscriptionProvisioningState + + // READ-ONLY; SAAS subscription ID generated by Marketplace + SaasSubscriptionID *string +} + +// OracleSubscriptionUpdate - The type used for update operations of the OracleSubscription. +type OracleSubscriptionUpdate struct { + // Details of the resource plan. + Plan *ResourcePlanTypeUpdate + + // The updatable properties of the OracleSubscription. + Properties *OracleSubscriptionUpdateProperties +} + +// OracleSubscriptionUpdateProperties - The updatable properties of the OracleSubscription. +type OracleSubscriptionUpdateProperties struct { + // Intent for the update operation + Intent *Intent + + // Product code for the term unit + ProductCode *string +} + +// PeerDbDetails - PeerDb Details +type PeerDbDetails struct { + // The database OCID of the Disaster Recovery peer database, which is located in a different region from the current peer + // database. + PeerDbID *string +} + +// Plan for the resource. +type Plan struct { + // REQUIRED; A user defined name of the 3rd Party Artifact that is being procured. + Name *string + + // REQUIRED; The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact + // at the time of Data Market onboarding. + Product *string + + // REQUIRED; The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string + + // A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string + + // The version of the desired product/artifact. + Version *string +} + +// PortRange - Port Range to specify particular destination ports for TCP rules. +type PortRange struct { + // REQUIRED; The maximum port number, which must not be less than the minimum port number. To specify a single port number, + // set both the min and max to the same value. + Max *int32 + + // REQUIRED; The minimum port number, which must not be greater than the maximum port number. + Min *int32 +} + +// PrivateIPAddressProperties - PrivateIpAddress resource properties +type PrivateIPAddressProperties struct { + // REQUIRED; PrivateIpAddresses displayName + DisplayName *string + + // REQUIRED; PrivateIpAddresses hostnameLabel + HostnameLabel *string + + // REQUIRED; PrivateIpAddresses ipAddress + IPAddress *string + + // REQUIRED; PrivateIpAddresses Id + Ocid *string + + // REQUIRED; PrivateIpAddresses subnetId + SubnetID *string +} + +// PrivateIPAddressesFilter - Private Ip Addresses filter +type PrivateIPAddressesFilter struct { + // REQUIRED; Subnet OCID + SubnetID *string + + // REQUIRED; VCN OCID + VnicID *string +} + +// ProfileType - The connection string profile to allow clients to group, filter and select connection string values based +// on structured metadata. +type ProfileType struct { + // REQUIRED; A user-friendly name for the connection. + DisplayName *string + + // REQUIRED; Host format used in connection string. + HostFormat *HostFormatType + + // REQUIRED; Protocol used by the connection. + Protocol *ProtocolType + + // REQUIRED; Specifies whether the listener performs a direct hand-off of the session, or redirects the session. + SessionMode *SessionModeType + + // REQUIRED; Specifies whether the connection string is using the long (LONG), Easy Connect (EZCONNECT), or Easy Connect Plus + // (EZCONNECTPLUS) format. + SyntaxFormat *SyntaxFormatType + + // REQUIRED; Connection string value. + Value *string + + // Consumer group used by the connection. + ConsumerGroup *ConsumerGroup + + // True for a regional connection string, applicable to cross-region DG only. + IsRegional *bool + + // Specifies whether the TLS handshake is using one-way (SERVER) or mutual (MUTUAL) authentication. + TLSAuthentication *TLSAuthenticationType +} + +// ResourcePlanTypeUpdate model definition +type ResourcePlanTypeUpdate struct { + // A user defined name of the 3rd Party Artifact that is being procured. + Name *string + + // The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at + // the time of Data Market onboarding. + Product *string + + // A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string + + // The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string + + // The version of the desired product/artifact. + Version *string +} + +// SaasSubscriptionDetails - SaaS Subscription Details model +type SaasSubscriptionDetails struct { + // READ-ONLY; Purchased SaaS subscription ID + ID *string + + // READ-ONLY; AutoRenew flag + IsAutoRenew *bool + + // READ-ONLY; FreeTrial flag + IsFreeTrial *bool + + // READ-ONLY; Purchased offer ID + OfferID *string + + // READ-ONLY; Purchased offer's plan ID + PlanID *string + + // READ-ONLY; Publisher ID + PublisherID *string + + // READ-ONLY; Purchaser Email ID + PurchaserEmailID *string + + // READ-ONLY; Purchaser Tenant ID + PurchaserTenantID *string + + // READ-ONLY; Indicates the status of the Subscription. + SaasSubscriptionStatus *string + + // READ-ONLY; SaaS subscription name + SubscriptionName *string + + // READ-ONLY; Purchase Term Unit + TermUnit *string + + // READ-ONLY; Creation Date and Time + TimeCreated *time.Time +} + +// ScheduledOperationsType - The list of scheduled operations. +type ScheduledOperationsType struct { + // REQUIRED; Day of week + DayOfWeek *DayOfWeek + + // auto start time. value must be of ISO-8601 format HH:mm + ScheduledStartTime *string + + // auto stop time. value must be of ISO-8601 format HH:mm + ScheduledStopTime *string +} + +// ScheduledOperationsTypeUpdate - The list of scheduled operations. +type ScheduledOperationsTypeUpdate struct { + // Day of week + DayOfWeek *DayOfWeekUpdate + + // auto start time. value must be of ISO-8601 format HH:mm + ScheduledStartTime *string + + // auto stop time. value must be of ISO-8601 format HH:mm + ScheduledStopTime *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// VirtualNetworkAddress - Virtual IP resource belonging to a vm cluster resource. +type VirtualNetworkAddress struct { + // The resource-specific properties for this resource. + Properties *VirtualNetworkAddressProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// VirtualNetworkAddressListResult - The response of a VirtualNetworkAddress list operation. +type VirtualNetworkAddressListResult struct { + // REQUIRED; The VirtualNetworkAddress items on this page + Value []*VirtualNetworkAddress + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// VirtualNetworkAddressProperties - virtualNetworkAddress resource properties +type VirtualNetworkAddressProperties struct { + // Virtual network Address address. + IPAddress *string + + // Virtual Machine OCID. + VMOcid *string + + // READ-ONLY; Virtual network address fully qualified domain name. + Domain *string + + // READ-ONLY; Additional information about the current lifecycle state of the application virtual IP (VIP) address. + LifecycleDetails *string + + // READ-ONLY; virtual network address lifecycle state. + LifecycleState *VirtualNetworkAddressLifecycleState + + // READ-ONLY; Application VIP OCID. + Ocid *string + + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *AzureResourceProvisioningState + + // READ-ONLY; The date and time when the create operation for the application virtual IP (VIP) address completed. + TimeAssigned *time.Time +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/models_serde.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/models_serde.go new file mode 100644 index 000000000000..f0c0bbd6c343 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/models_serde.go @@ -0,0 +1,5059 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type ActivationLinks. +func (a ActivationLinks) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "existingCloudAccountActivationLink", a.ExistingCloudAccountActivationLink) + populate(objectMap, "newCloudAccountActivationLink", a.NewCloudAccountActivationLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActivationLinks. +func (a *ActivationLinks) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "existingCloudAccountActivationLink": + err = unpopulate(val, "ExistingCloudAccountActivationLink", &a.ExistingCloudAccountActivationLink) + delete(rawMsg, key) + case "newCloudAccountActivationLink": + err = unpopulate(val, "NewCloudAccountActivationLink", &a.NewCloudAccountActivationLink) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddRemoveDbNode. +func (a AddRemoveDbNode) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dbServers", a.DbServers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddRemoveDbNode. +func (a *AddRemoveDbNode) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dbServers": + err = unpopulate(val, "DbServers", &a.DbServers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AllConnectionStringType. +func (a AllConnectionStringType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "high", a.High) + populate(objectMap, "low", a.Low) + populate(objectMap, "medium", a.Medium) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AllConnectionStringType. +func (a *AllConnectionStringType) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "high": + err = unpopulate(val, "High", &a.High) + delete(rawMsg, key) + case "low": + err = unpopulate(val, "Low", &a.Low) + delete(rawMsg, key) + case "medium": + err = unpopulate(val, "Medium", &a.Medium) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApexDetailsType. +func (a ApexDetailsType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apexVersion", a.ApexVersion) + populate(objectMap, "ordsVersion", a.OrdsVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApexDetailsType. +func (a *ApexDetailsType) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apexVersion": + err = unpopulate(val, "ApexVersion", &a.ApexVersion) + delete(rawMsg, key) + case "ordsVersion": + err = unpopulate(val, "OrdsVersion", &a.OrdsVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabase. +func (a AutonomousDatabase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabase. +func (a *AutonomousDatabase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + a.Properties, err = unmarshalAutonomousDatabaseBasePropertiesClassification(val) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseBackup. +func (a AutonomousDatabaseBackup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseBackup. +func (a *AutonomousDatabaseBackup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseBackupListResult. +func (a AutonomousDatabaseBackupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseBackupListResult. +func (a *AutonomousDatabaseBackupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseBackupProperties. +func (a AutonomousDatabaseBackupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "autonomousDatabaseId", a.AutonomousDatabaseID) + populate(objectMap, "databaseSizeInTBs", a.DatabaseSizeInTBs) + populate(objectMap, "dbVersion", a.DbVersion) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "isAutomatic", a.IsAutomatic) + populate(objectMap, "isRestorable", a.IsRestorable) + populate(objectMap, "lifecycleDetails", a.LifecycleDetails) + populate(objectMap, "lifecycleState", a.LifecycleState) + populate(objectMap, "ocid", a.Ocid) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "retentionPeriodInDays", a.RetentionPeriodInDays) + populate(objectMap, "sizeInTBs", a.SizeInTBs) + populateDateTimeRFC3339(objectMap, "timeAvailableTil", a.TimeAvailableTil) + populate(objectMap, "timeEnded", a.TimeEnded) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseBackupProperties. +func (a *AutonomousDatabaseBackupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autonomousDatabaseId": + err = unpopulate(val, "AutonomousDatabaseID", &a.AutonomousDatabaseID) + delete(rawMsg, key) + case "databaseSizeInTBs": + err = unpopulate(val, "DatabaseSizeInTBs", &a.DatabaseSizeInTBs) + delete(rawMsg, key) + case "dbVersion": + err = unpopulate(val, "DbVersion", &a.DbVersion) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "isAutomatic": + err = unpopulate(val, "IsAutomatic", &a.IsAutomatic) + delete(rawMsg, key) + case "isRestorable": + err = unpopulate(val, "IsRestorable", &a.IsRestorable) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &a.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &a.LifecycleState) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &a.Ocid) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "retentionPeriodInDays": + err = unpopulate(val, "RetentionPeriodInDays", &a.RetentionPeriodInDays) + delete(rawMsg, key) + case "sizeInTBs": + err = unpopulate(val, "SizeInTBs", &a.SizeInTBs) + delete(rawMsg, key) + case "timeAvailableTil": + err = unpopulateDateTimeRFC3339(val, "TimeAvailableTil", &a.TimeAvailableTil) + delete(rawMsg, key) + case "timeEnded": + err = unpopulate(val, "TimeEnded", &a.TimeEnded) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseBackupUpdate. +func (a AutonomousDatabaseBackupUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseBackupUpdate. +func (a *AutonomousDatabaseBackupUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseBackupUpdateProperties. +func (a AutonomousDatabaseBackupUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "retentionPeriodInDays", a.RetentionPeriodInDays) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseBackupUpdateProperties. +func (a *AutonomousDatabaseBackupUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "retentionPeriodInDays": + err = unpopulate(val, "RetentionPeriodInDays", &a.RetentionPeriodInDays) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseBaseProperties. +func (a AutonomousDatabaseBaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actualUsedDataStorageSizeInTbs", a.ActualUsedDataStorageSizeInTbs) + populate(objectMap, "adminPassword", a.AdminPassword) + populate(objectMap, "allocatedStorageSizeInTbs", a.AllocatedStorageSizeInTbs) + populate(objectMap, "apexDetails", a.ApexDetails) + populate(objectMap, "autonomousDatabaseId", a.AutonomousDatabaseID) + populate(objectMap, "autonomousMaintenanceScheduleType", a.AutonomousMaintenanceScheduleType) + populate(objectMap, "availableUpgradeVersions", a.AvailableUpgradeVersions) + populate(objectMap, "backupRetentionPeriodInDays", a.BackupRetentionPeriodInDays) + populate(objectMap, "cpuCoreCount", a.CPUCoreCount) + populate(objectMap, "characterSet", a.CharacterSet) + populate(objectMap, "computeCount", a.ComputeCount) + populate(objectMap, "computeModel", a.ComputeModel) + populate(objectMap, "connectionStrings", a.ConnectionStrings) + populate(objectMap, "connectionUrls", a.ConnectionUrls) + populate(objectMap, "customerContacts", a.CustomerContacts) + objectMap["dataBaseType"] = a.DataBaseType + populate(objectMap, "dataSafeStatus", a.DataSafeStatus) + populate(objectMap, "dataStorageSizeInGbs", a.DataStorageSizeInGbs) + populate(objectMap, "dataStorageSizeInTbs", a.DataStorageSizeInTbs) + populate(objectMap, "databaseEdition", a.DatabaseEdition) + populate(objectMap, "dbVersion", a.DbVersion) + populate(objectMap, "dbWorkload", a.DbWorkload) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "failedDataRecoveryInSeconds", a.FailedDataRecoveryInSeconds) + populate(objectMap, "inMemoryAreaInGbs", a.InMemoryAreaInGbs) + populate(objectMap, "isAutoScalingEnabled", a.IsAutoScalingEnabled) + populate(objectMap, "isAutoScalingForStorageEnabled", a.IsAutoScalingForStorageEnabled) + populate(objectMap, "isLocalDataGuardEnabled", a.IsLocalDataGuardEnabled) + populate(objectMap, "isMtlsConnectionRequired", a.IsMtlsConnectionRequired) + populate(objectMap, "isPreview", a.IsPreview) + populate(objectMap, "isPreviewVersionWithServiceTermsAccepted", a.IsPreviewVersionWithServiceTermsAccepted) + populate(objectMap, "isRemoteDataGuardEnabled", a.IsRemoteDataGuardEnabled) + populate(objectMap, "licenseModel", a.LicenseModel) + populate(objectMap, "lifecycleDetails", a.LifecycleDetails) + populate(objectMap, "lifecycleState", a.LifecycleState) + populate(objectMap, "localAdgAutoFailoverMaxDataLossLimit", a.LocalAdgAutoFailoverMaxDataLossLimit) + populate(objectMap, "localDisasterRecoveryType", a.LocalDisasterRecoveryType) + populate(objectMap, "localStandbyDb", a.LocalStandbyDb) + populate(objectMap, "memoryPerOracleComputeUnitInGbs", a.MemoryPerOracleComputeUnitInGbs) + populate(objectMap, "ncharacterSet", a.NcharacterSet) + populate(objectMap, "ociUrl", a.OciURL) + populate(objectMap, "ocid", a.Ocid) + populate(objectMap, "openMode", a.OpenMode) + populate(objectMap, "operationsInsightsStatus", a.OperationsInsightsStatus) + populate(objectMap, "peerDbId", a.PeerDbID) + populate(objectMap, "peerDbIds", a.PeerDbIDs) + populate(objectMap, "permissionLevel", a.PermissionLevel) + populate(objectMap, "privateEndpoint", a.PrivateEndpoint) + populate(objectMap, "privateEndpointIp", a.PrivateEndpointIP) + populate(objectMap, "privateEndpointLabel", a.PrivateEndpointLabel) + populate(objectMap, "provisionableCpus", a.ProvisionableCpus) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "role", a.Role) + populate(objectMap, "sqlWebDeveloperUrl", a.SQLWebDeveloperURL) + populate(objectMap, "scheduledOperations", a.ScheduledOperations) + populate(objectMap, "serviceConsoleUrl", a.ServiceConsoleURL) + populate(objectMap, "subnetId", a.SubnetID) + populate(objectMap, "supportedRegionsToCloneTo", a.SupportedRegionsToCloneTo) + populateDateTimeRFC3339(objectMap, "timeCreated", a.TimeCreated) + populate(objectMap, "timeDataGuardRoleChanged", a.TimeDataGuardRoleChanged) + populate(objectMap, "timeDeletionOfFreeAutonomousDatabase", a.TimeDeletionOfFreeAutonomousDatabase) + populate(objectMap, "timeLocalDataGuardEnabled", a.TimeLocalDataGuardEnabled) + populateDateTimeRFC3339(objectMap, "timeMaintenanceBegin", a.TimeMaintenanceBegin) + populateDateTimeRFC3339(objectMap, "timeMaintenanceEnd", a.TimeMaintenanceEnd) + populate(objectMap, "timeOfLastFailover", a.TimeOfLastFailover) + populate(objectMap, "timeOfLastRefresh", a.TimeOfLastRefresh) + populate(objectMap, "timeOfLastRefreshPoint", a.TimeOfLastRefreshPoint) + populate(objectMap, "timeOfLastSwitchover", a.TimeOfLastSwitchover) + populate(objectMap, "timeReclamationOfFreeAutonomousDatabase", a.TimeReclamationOfFreeAutonomousDatabase) + populate(objectMap, "usedDataStorageSizeInGbs", a.UsedDataStorageSizeInGbs) + populate(objectMap, "usedDataStorageSizeInTbs", a.UsedDataStorageSizeInTbs) + populate(objectMap, "vnetId", a.VnetID) + populate(objectMap, "whitelistedIps", a.WhitelistedIPs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseBaseProperties. +func (a *AutonomousDatabaseBaseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actualUsedDataStorageSizeInTbs": + err = unpopulate(val, "ActualUsedDataStorageSizeInTbs", &a.ActualUsedDataStorageSizeInTbs) + delete(rawMsg, key) + case "adminPassword": + err = unpopulate(val, "AdminPassword", &a.AdminPassword) + delete(rawMsg, key) + case "allocatedStorageSizeInTbs": + err = unpopulate(val, "AllocatedStorageSizeInTbs", &a.AllocatedStorageSizeInTbs) + delete(rawMsg, key) + case "apexDetails": + err = unpopulate(val, "ApexDetails", &a.ApexDetails) + delete(rawMsg, key) + case "autonomousDatabaseId": + err = unpopulate(val, "AutonomousDatabaseID", &a.AutonomousDatabaseID) + delete(rawMsg, key) + case "autonomousMaintenanceScheduleType": + err = unpopulate(val, "AutonomousMaintenanceScheduleType", &a.AutonomousMaintenanceScheduleType) + delete(rawMsg, key) + case "availableUpgradeVersions": + err = unpopulate(val, "AvailableUpgradeVersions", &a.AvailableUpgradeVersions) + delete(rawMsg, key) + case "backupRetentionPeriodInDays": + err = unpopulate(val, "BackupRetentionPeriodInDays", &a.BackupRetentionPeriodInDays) + delete(rawMsg, key) + case "cpuCoreCount": + err = unpopulate(val, "CPUCoreCount", &a.CPUCoreCount) + delete(rawMsg, key) + case "characterSet": + err = unpopulate(val, "CharacterSet", &a.CharacterSet) + delete(rawMsg, key) + case "computeCount": + err = unpopulate(val, "ComputeCount", &a.ComputeCount) + delete(rawMsg, key) + case "computeModel": + err = unpopulate(val, "ComputeModel", &a.ComputeModel) + delete(rawMsg, key) + case "connectionStrings": + err = unpopulate(val, "ConnectionStrings", &a.ConnectionStrings) + delete(rawMsg, key) + case "connectionUrls": + err = unpopulate(val, "ConnectionUrls", &a.ConnectionUrls) + delete(rawMsg, key) + case "customerContacts": + err = unpopulate(val, "CustomerContacts", &a.CustomerContacts) + delete(rawMsg, key) + case "dataBaseType": + err = unpopulate(val, "DataBaseType", &a.DataBaseType) + delete(rawMsg, key) + case "dataSafeStatus": + err = unpopulate(val, "DataSafeStatus", &a.DataSafeStatus) + delete(rawMsg, key) + case "dataStorageSizeInGbs": + err = unpopulate(val, "DataStorageSizeInGbs", &a.DataStorageSizeInGbs) + delete(rawMsg, key) + case "dataStorageSizeInTbs": + err = unpopulate(val, "DataStorageSizeInTbs", &a.DataStorageSizeInTbs) + delete(rawMsg, key) + case "databaseEdition": + err = unpopulate(val, "DatabaseEdition", &a.DatabaseEdition) + delete(rawMsg, key) + case "dbVersion": + err = unpopulate(val, "DbVersion", &a.DbVersion) + delete(rawMsg, key) + case "dbWorkload": + err = unpopulate(val, "DbWorkload", &a.DbWorkload) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "failedDataRecoveryInSeconds": + err = unpopulate(val, "FailedDataRecoveryInSeconds", &a.FailedDataRecoveryInSeconds) + delete(rawMsg, key) + case "inMemoryAreaInGbs": + err = unpopulate(val, "InMemoryAreaInGbs", &a.InMemoryAreaInGbs) + delete(rawMsg, key) + case "isAutoScalingEnabled": + err = unpopulate(val, "IsAutoScalingEnabled", &a.IsAutoScalingEnabled) + delete(rawMsg, key) + case "isAutoScalingForStorageEnabled": + err = unpopulate(val, "IsAutoScalingForStorageEnabled", &a.IsAutoScalingForStorageEnabled) + delete(rawMsg, key) + case "isLocalDataGuardEnabled": + err = unpopulate(val, "IsLocalDataGuardEnabled", &a.IsLocalDataGuardEnabled) + delete(rawMsg, key) + case "isMtlsConnectionRequired": + err = unpopulate(val, "IsMtlsConnectionRequired", &a.IsMtlsConnectionRequired) + delete(rawMsg, key) + case "isPreview": + err = unpopulate(val, "IsPreview", &a.IsPreview) + delete(rawMsg, key) + case "isPreviewVersionWithServiceTermsAccepted": + err = unpopulate(val, "IsPreviewVersionWithServiceTermsAccepted", &a.IsPreviewVersionWithServiceTermsAccepted) + delete(rawMsg, key) + case "isRemoteDataGuardEnabled": + err = unpopulate(val, "IsRemoteDataGuardEnabled", &a.IsRemoteDataGuardEnabled) + delete(rawMsg, key) + case "licenseModel": + err = unpopulate(val, "LicenseModel", &a.LicenseModel) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &a.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &a.LifecycleState) + delete(rawMsg, key) + case "localAdgAutoFailoverMaxDataLossLimit": + err = unpopulate(val, "LocalAdgAutoFailoverMaxDataLossLimit", &a.LocalAdgAutoFailoverMaxDataLossLimit) + delete(rawMsg, key) + case "localDisasterRecoveryType": + err = unpopulate(val, "LocalDisasterRecoveryType", &a.LocalDisasterRecoveryType) + delete(rawMsg, key) + case "localStandbyDb": + err = unpopulate(val, "LocalStandbyDb", &a.LocalStandbyDb) + delete(rawMsg, key) + case "memoryPerOracleComputeUnitInGbs": + err = unpopulate(val, "MemoryPerOracleComputeUnitInGbs", &a.MemoryPerOracleComputeUnitInGbs) + delete(rawMsg, key) + case "ncharacterSet": + err = unpopulate(val, "NcharacterSet", &a.NcharacterSet) + delete(rawMsg, key) + case "ociUrl": + err = unpopulate(val, "OciURL", &a.OciURL) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &a.Ocid) + delete(rawMsg, key) + case "openMode": + err = unpopulate(val, "OpenMode", &a.OpenMode) + delete(rawMsg, key) + case "operationsInsightsStatus": + err = unpopulate(val, "OperationsInsightsStatus", &a.OperationsInsightsStatus) + delete(rawMsg, key) + case "peerDbId": + err = unpopulate(val, "PeerDbID", &a.PeerDbID) + delete(rawMsg, key) + case "peerDbIds": + err = unpopulate(val, "PeerDbIDs", &a.PeerDbIDs) + delete(rawMsg, key) + case "permissionLevel": + err = unpopulate(val, "PermissionLevel", &a.PermissionLevel) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &a.PrivateEndpoint) + delete(rawMsg, key) + case "privateEndpointIp": + err = unpopulate(val, "PrivateEndpointIP", &a.PrivateEndpointIP) + delete(rawMsg, key) + case "privateEndpointLabel": + err = unpopulate(val, "PrivateEndpointLabel", &a.PrivateEndpointLabel) + delete(rawMsg, key) + case "provisionableCpus": + err = unpopulate(val, "ProvisionableCpus", &a.ProvisionableCpus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &a.Role) + delete(rawMsg, key) + case "sqlWebDeveloperUrl": + err = unpopulate(val, "SQLWebDeveloperURL", &a.SQLWebDeveloperURL) + delete(rawMsg, key) + case "scheduledOperations": + err = unpopulate(val, "ScheduledOperations", &a.ScheduledOperations) + delete(rawMsg, key) + case "serviceConsoleUrl": + err = unpopulate(val, "ServiceConsoleURL", &a.ServiceConsoleURL) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &a.SubnetID) + delete(rawMsg, key) + case "supportedRegionsToCloneTo": + err = unpopulate(val, "SupportedRegionsToCloneTo", &a.SupportedRegionsToCloneTo) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &a.TimeCreated) + delete(rawMsg, key) + case "timeDataGuardRoleChanged": + err = unpopulate(val, "TimeDataGuardRoleChanged", &a.TimeDataGuardRoleChanged) + delete(rawMsg, key) + case "timeDeletionOfFreeAutonomousDatabase": + err = unpopulate(val, "TimeDeletionOfFreeAutonomousDatabase", &a.TimeDeletionOfFreeAutonomousDatabase) + delete(rawMsg, key) + case "timeLocalDataGuardEnabled": + err = unpopulate(val, "TimeLocalDataGuardEnabled", &a.TimeLocalDataGuardEnabled) + delete(rawMsg, key) + case "timeMaintenanceBegin": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceBegin", &a.TimeMaintenanceBegin) + delete(rawMsg, key) + case "timeMaintenanceEnd": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceEnd", &a.TimeMaintenanceEnd) + delete(rawMsg, key) + case "timeOfLastFailover": + err = unpopulate(val, "TimeOfLastFailover", &a.TimeOfLastFailover) + delete(rawMsg, key) + case "timeOfLastRefresh": + err = unpopulate(val, "TimeOfLastRefresh", &a.TimeOfLastRefresh) + delete(rawMsg, key) + case "timeOfLastRefreshPoint": + err = unpopulate(val, "TimeOfLastRefreshPoint", &a.TimeOfLastRefreshPoint) + delete(rawMsg, key) + case "timeOfLastSwitchover": + err = unpopulate(val, "TimeOfLastSwitchover", &a.TimeOfLastSwitchover) + delete(rawMsg, key) + case "timeReclamationOfFreeAutonomousDatabase": + err = unpopulate(val, "TimeReclamationOfFreeAutonomousDatabase", &a.TimeReclamationOfFreeAutonomousDatabase) + delete(rawMsg, key) + case "usedDataStorageSizeInGbs": + err = unpopulate(val, "UsedDataStorageSizeInGbs", &a.UsedDataStorageSizeInGbs) + delete(rawMsg, key) + case "usedDataStorageSizeInTbs": + err = unpopulate(val, "UsedDataStorageSizeInTbs", &a.UsedDataStorageSizeInTbs) + delete(rawMsg, key) + case "vnetId": + err = unpopulate(val, "VnetID", &a.VnetID) + delete(rawMsg, key) + case "whitelistedIps": + err = unpopulate(val, "WhitelistedIPs", &a.WhitelistedIPs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseCharacterSet. +func (a AutonomousDatabaseCharacterSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseCharacterSet. +func (a *AutonomousDatabaseCharacterSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseCharacterSetListResult. +func (a AutonomousDatabaseCharacterSetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseCharacterSetListResult. +func (a *AutonomousDatabaseCharacterSetListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseCharacterSetProperties. +func (a AutonomousDatabaseCharacterSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "characterSet", a.CharacterSet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseCharacterSetProperties. +func (a *AutonomousDatabaseCharacterSetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "characterSet": + err = unpopulate(val, "CharacterSet", &a.CharacterSet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseCloneProperties. +func (a AutonomousDatabaseCloneProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actualUsedDataStorageSizeInTbs", a.ActualUsedDataStorageSizeInTbs) + populate(objectMap, "adminPassword", a.AdminPassword) + populate(objectMap, "allocatedStorageSizeInTbs", a.AllocatedStorageSizeInTbs) + populate(objectMap, "apexDetails", a.ApexDetails) + populate(objectMap, "autonomousDatabaseId", a.AutonomousDatabaseID) + populate(objectMap, "autonomousMaintenanceScheduleType", a.AutonomousMaintenanceScheduleType) + populate(objectMap, "availableUpgradeVersions", a.AvailableUpgradeVersions) + populate(objectMap, "backupRetentionPeriodInDays", a.BackupRetentionPeriodInDays) + populate(objectMap, "cpuCoreCount", a.CPUCoreCount) + populate(objectMap, "characterSet", a.CharacterSet) + populate(objectMap, "cloneType", a.CloneType) + populate(objectMap, "computeCount", a.ComputeCount) + populate(objectMap, "computeModel", a.ComputeModel) + populate(objectMap, "connectionStrings", a.ConnectionStrings) + populate(objectMap, "connectionUrls", a.ConnectionUrls) + populate(objectMap, "customerContacts", a.CustomerContacts) + objectMap["dataBaseType"] = DataBaseTypeClone + populate(objectMap, "dataSafeStatus", a.DataSafeStatus) + populate(objectMap, "dataStorageSizeInGbs", a.DataStorageSizeInGbs) + populate(objectMap, "dataStorageSizeInTbs", a.DataStorageSizeInTbs) + populate(objectMap, "databaseEdition", a.DatabaseEdition) + populate(objectMap, "dbVersion", a.DbVersion) + populate(objectMap, "dbWorkload", a.DbWorkload) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "failedDataRecoveryInSeconds", a.FailedDataRecoveryInSeconds) + populate(objectMap, "inMemoryAreaInGbs", a.InMemoryAreaInGbs) + populate(objectMap, "isAutoScalingEnabled", a.IsAutoScalingEnabled) + populate(objectMap, "isAutoScalingForStorageEnabled", a.IsAutoScalingForStorageEnabled) + populate(objectMap, "isLocalDataGuardEnabled", a.IsLocalDataGuardEnabled) + populate(objectMap, "isMtlsConnectionRequired", a.IsMtlsConnectionRequired) + populate(objectMap, "isPreview", a.IsPreview) + populate(objectMap, "isPreviewVersionWithServiceTermsAccepted", a.IsPreviewVersionWithServiceTermsAccepted) + populate(objectMap, "isReconnectCloneEnabled", a.IsReconnectCloneEnabled) + populate(objectMap, "isRefreshableClone", a.IsRefreshableClone) + populate(objectMap, "isRemoteDataGuardEnabled", a.IsRemoteDataGuardEnabled) + populate(objectMap, "licenseModel", a.LicenseModel) + populate(objectMap, "lifecycleDetails", a.LifecycleDetails) + populate(objectMap, "lifecycleState", a.LifecycleState) + populate(objectMap, "localAdgAutoFailoverMaxDataLossLimit", a.LocalAdgAutoFailoverMaxDataLossLimit) + populate(objectMap, "localDisasterRecoveryType", a.LocalDisasterRecoveryType) + populate(objectMap, "localStandbyDb", a.LocalStandbyDb) + populate(objectMap, "memoryPerOracleComputeUnitInGbs", a.MemoryPerOracleComputeUnitInGbs) + populate(objectMap, "ncharacterSet", a.NcharacterSet) + populate(objectMap, "ociUrl", a.OciURL) + populate(objectMap, "ocid", a.Ocid) + populate(objectMap, "openMode", a.OpenMode) + populate(objectMap, "operationsInsightsStatus", a.OperationsInsightsStatus) + populate(objectMap, "peerDbId", a.PeerDbID) + populate(objectMap, "peerDbIds", a.PeerDbIDs) + populate(objectMap, "permissionLevel", a.PermissionLevel) + populate(objectMap, "privateEndpoint", a.PrivateEndpoint) + populate(objectMap, "privateEndpointIp", a.PrivateEndpointIP) + populate(objectMap, "privateEndpointLabel", a.PrivateEndpointLabel) + populate(objectMap, "provisionableCpus", a.ProvisionableCpus) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "refreshableModel", a.RefreshableModel) + populate(objectMap, "refreshableStatus", a.RefreshableStatus) + populate(objectMap, "role", a.Role) + populate(objectMap, "sqlWebDeveloperUrl", a.SQLWebDeveloperURL) + populate(objectMap, "scheduledOperations", a.ScheduledOperations) + populate(objectMap, "serviceConsoleUrl", a.ServiceConsoleURL) + populate(objectMap, "source", a.Source) + populate(objectMap, "sourceId", a.SourceID) + populate(objectMap, "subnetId", a.SubnetID) + populate(objectMap, "supportedRegionsToCloneTo", a.SupportedRegionsToCloneTo) + populateDateTimeRFC3339(objectMap, "timeCreated", a.TimeCreated) + populate(objectMap, "timeDataGuardRoleChanged", a.TimeDataGuardRoleChanged) + populate(objectMap, "timeDeletionOfFreeAutonomousDatabase", a.TimeDeletionOfFreeAutonomousDatabase) + populate(objectMap, "timeLocalDataGuardEnabled", a.TimeLocalDataGuardEnabled) + populateDateTimeRFC3339(objectMap, "timeMaintenanceBegin", a.TimeMaintenanceBegin) + populateDateTimeRFC3339(objectMap, "timeMaintenanceEnd", a.TimeMaintenanceEnd) + populate(objectMap, "timeOfLastFailover", a.TimeOfLastFailover) + populate(objectMap, "timeOfLastRefresh", a.TimeOfLastRefresh) + populate(objectMap, "timeOfLastRefreshPoint", a.TimeOfLastRefreshPoint) + populate(objectMap, "timeOfLastSwitchover", a.TimeOfLastSwitchover) + populate(objectMap, "timeReclamationOfFreeAutonomousDatabase", a.TimeReclamationOfFreeAutonomousDatabase) + populate(objectMap, "timeUntilReconnectCloneEnabled", a.TimeUntilReconnectCloneEnabled) + populate(objectMap, "usedDataStorageSizeInGbs", a.UsedDataStorageSizeInGbs) + populate(objectMap, "usedDataStorageSizeInTbs", a.UsedDataStorageSizeInTbs) + populate(objectMap, "vnetId", a.VnetID) + populate(objectMap, "whitelistedIps", a.WhitelistedIPs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseCloneProperties. +func (a *AutonomousDatabaseCloneProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actualUsedDataStorageSizeInTbs": + err = unpopulate(val, "ActualUsedDataStorageSizeInTbs", &a.ActualUsedDataStorageSizeInTbs) + delete(rawMsg, key) + case "adminPassword": + err = unpopulate(val, "AdminPassword", &a.AdminPassword) + delete(rawMsg, key) + case "allocatedStorageSizeInTbs": + err = unpopulate(val, "AllocatedStorageSizeInTbs", &a.AllocatedStorageSizeInTbs) + delete(rawMsg, key) + case "apexDetails": + err = unpopulate(val, "ApexDetails", &a.ApexDetails) + delete(rawMsg, key) + case "autonomousDatabaseId": + err = unpopulate(val, "AutonomousDatabaseID", &a.AutonomousDatabaseID) + delete(rawMsg, key) + case "autonomousMaintenanceScheduleType": + err = unpopulate(val, "AutonomousMaintenanceScheduleType", &a.AutonomousMaintenanceScheduleType) + delete(rawMsg, key) + case "availableUpgradeVersions": + err = unpopulate(val, "AvailableUpgradeVersions", &a.AvailableUpgradeVersions) + delete(rawMsg, key) + case "backupRetentionPeriodInDays": + err = unpopulate(val, "BackupRetentionPeriodInDays", &a.BackupRetentionPeriodInDays) + delete(rawMsg, key) + case "cpuCoreCount": + err = unpopulate(val, "CPUCoreCount", &a.CPUCoreCount) + delete(rawMsg, key) + case "characterSet": + err = unpopulate(val, "CharacterSet", &a.CharacterSet) + delete(rawMsg, key) + case "cloneType": + err = unpopulate(val, "CloneType", &a.CloneType) + delete(rawMsg, key) + case "computeCount": + err = unpopulate(val, "ComputeCount", &a.ComputeCount) + delete(rawMsg, key) + case "computeModel": + err = unpopulate(val, "ComputeModel", &a.ComputeModel) + delete(rawMsg, key) + case "connectionStrings": + err = unpopulate(val, "ConnectionStrings", &a.ConnectionStrings) + delete(rawMsg, key) + case "connectionUrls": + err = unpopulate(val, "ConnectionUrls", &a.ConnectionUrls) + delete(rawMsg, key) + case "customerContacts": + err = unpopulate(val, "CustomerContacts", &a.CustomerContacts) + delete(rawMsg, key) + case "dataBaseType": + err = unpopulate(val, "DataBaseType", &a.DataBaseType) + delete(rawMsg, key) + case "dataSafeStatus": + err = unpopulate(val, "DataSafeStatus", &a.DataSafeStatus) + delete(rawMsg, key) + case "dataStorageSizeInGbs": + err = unpopulate(val, "DataStorageSizeInGbs", &a.DataStorageSizeInGbs) + delete(rawMsg, key) + case "dataStorageSizeInTbs": + err = unpopulate(val, "DataStorageSizeInTbs", &a.DataStorageSizeInTbs) + delete(rawMsg, key) + case "databaseEdition": + err = unpopulate(val, "DatabaseEdition", &a.DatabaseEdition) + delete(rawMsg, key) + case "dbVersion": + err = unpopulate(val, "DbVersion", &a.DbVersion) + delete(rawMsg, key) + case "dbWorkload": + err = unpopulate(val, "DbWorkload", &a.DbWorkload) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "failedDataRecoveryInSeconds": + err = unpopulate(val, "FailedDataRecoveryInSeconds", &a.FailedDataRecoveryInSeconds) + delete(rawMsg, key) + case "inMemoryAreaInGbs": + err = unpopulate(val, "InMemoryAreaInGbs", &a.InMemoryAreaInGbs) + delete(rawMsg, key) + case "isAutoScalingEnabled": + err = unpopulate(val, "IsAutoScalingEnabled", &a.IsAutoScalingEnabled) + delete(rawMsg, key) + case "isAutoScalingForStorageEnabled": + err = unpopulate(val, "IsAutoScalingForStorageEnabled", &a.IsAutoScalingForStorageEnabled) + delete(rawMsg, key) + case "isLocalDataGuardEnabled": + err = unpopulate(val, "IsLocalDataGuardEnabled", &a.IsLocalDataGuardEnabled) + delete(rawMsg, key) + case "isMtlsConnectionRequired": + err = unpopulate(val, "IsMtlsConnectionRequired", &a.IsMtlsConnectionRequired) + delete(rawMsg, key) + case "isPreview": + err = unpopulate(val, "IsPreview", &a.IsPreview) + delete(rawMsg, key) + case "isPreviewVersionWithServiceTermsAccepted": + err = unpopulate(val, "IsPreviewVersionWithServiceTermsAccepted", &a.IsPreviewVersionWithServiceTermsAccepted) + delete(rawMsg, key) + case "isReconnectCloneEnabled": + err = unpopulate(val, "IsReconnectCloneEnabled", &a.IsReconnectCloneEnabled) + delete(rawMsg, key) + case "isRefreshableClone": + err = unpopulate(val, "IsRefreshableClone", &a.IsRefreshableClone) + delete(rawMsg, key) + case "isRemoteDataGuardEnabled": + err = unpopulate(val, "IsRemoteDataGuardEnabled", &a.IsRemoteDataGuardEnabled) + delete(rawMsg, key) + case "licenseModel": + err = unpopulate(val, "LicenseModel", &a.LicenseModel) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &a.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &a.LifecycleState) + delete(rawMsg, key) + case "localAdgAutoFailoverMaxDataLossLimit": + err = unpopulate(val, "LocalAdgAutoFailoverMaxDataLossLimit", &a.LocalAdgAutoFailoverMaxDataLossLimit) + delete(rawMsg, key) + case "localDisasterRecoveryType": + err = unpopulate(val, "LocalDisasterRecoveryType", &a.LocalDisasterRecoveryType) + delete(rawMsg, key) + case "localStandbyDb": + err = unpopulate(val, "LocalStandbyDb", &a.LocalStandbyDb) + delete(rawMsg, key) + case "memoryPerOracleComputeUnitInGbs": + err = unpopulate(val, "MemoryPerOracleComputeUnitInGbs", &a.MemoryPerOracleComputeUnitInGbs) + delete(rawMsg, key) + case "ncharacterSet": + err = unpopulate(val, "NcharacterSet", &a.NcharacterSet) + delete(rawMsg, key) + case "ociUrl": + err = unpopulate(val, "OciURL", &a.OciURL) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &a.Ocid) + delete(rawMsg, key) + case "openMode": + err = unpopulate(val, "OpenMode", &a.OpenMode) + delete(rawMsg, key) + case "operationsInsightsStatus": + err = unpopulate(val, "OperationsInsightsStatus", &a.OperationsInsightsStatus) + delete(rawMsg, key) + case "peerDbId": + err = unpopulate(val, "PeerDbID", &a.PeerDbID) + delete(rawMsg, key) + case "peerDbIds": + err = unpopulate(val, "PeerDbIDs", &a.PeerDbIDs) + delete(rawMsg, key) + case "permissionLevel": + err = unpopulate(val, "PermissionLevel", &a.PermissionLevel) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &a.PrivateEndpoint) + delete(rawMsg, key) + case "privateEndpointIp": + err = unpopulate(val, "PrivateEndpointIP", &a.PrivateEndpointIP) + delete(rawMsg, key) + case "privateEndpointLabel": + err = unpopulate(val, "PrivateEndpointLabel", &a.PrivateEndpointLabel) + delete(rawMsg, key) + case "provisionableCpus": + err = unpopulate(val, "ProvisionableCpus", &a.ProvisionableCpus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "refreshableModel": + err = unpopulate(val, "RefreshableModel", &a.RefreshableModel) + delete(rawMsg, key) + case "refreshableStatus": + err = unpopulate(val, "RefreshableStatus", &a.RefreshableStatus) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &a.Role) + delete(rawMsg, key) + case "sqlWebDeveloperUrl": + err = unpopulate(val, "SQLWebDeveloperURL", &a.SQLWebDeveloperURL) + delete(rawMsg, key) + case "scheduledOperations": + err = unpopulate(val, "ScheduledOperations", &a.ScheduledOperations) + delete(rawMsg, key) + case "serviceConsoleUrl": + err = unpopulate(val, "ServiceConsoleURL", &a.ServiceConsoleURL) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &a.Source) + delete(rawMsg, key) + case "sourceId": + err = unpopulate(val, "SourceID", &a.SourceID) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &a.SubnetID) + delete(rawMsg, key) + case "supportedRegionsToCloneTo": + err = unpopulate(val, "SupportedRegionsToCloneTo", &a.SupportedRegionsToCloneTo) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &a.TimeCreated) + delete(rawMsg, key) + case "timeDataGuardRoleChanged": + err = unpopulate(val, "TimeDataGuardRoleChanged", &a.TimeDataGuardRoleChanged) + delete(rawMsg, key) + case "timeDeletionOfFreeAutonomousDatabase": + err = unpopulate(val, "TimeDeletionOfFreeAutonomousDatabase", &a.TimeDeletionOfFreeAutonomousDatabase) + delete(rawMsg, key) + case "timeLocalDataGuardEnabled": + err = unpopulate(val, "TimeLocalDataGuardEnabled", &a.TimeLocalDataGuardEnabled) + delete(rawMsg, key) + case "timeMaintenanceBegin": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceBegin", &a.TimeMaintenanceBegin) + delete(rawMsg, key) + case "timeMaintenanceEnd": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceEnd", &a.TimeMaintenanceEnd) + delete(rawMsg, key) + case "timeOfLastFailover": + err = unpopulate(val, "TimeOfLastFailover", &a.TimeOfLastFailover) + delete(rawMsg, key) + case "timeOfLastRefresh": + err = unpopulate(val, "TimeOfLastRefresh", &a.TimeOfLastRefresh) + delete(rawMsg, key) + case "timeOfLastRefreshPoint": + err = unpopulate(val, "TimeOfLastRefreshPoint", &a.TimeOfLastRefreshPoint) + delete(rawMsg, key) + case "timeOfLastSwitchover": + err = unpopulate(val, "TimeOfLastSwitchover", &a.TimeOfLastSwitchover) + delete(rawMsg, key) + case "timeReclamationOfFreeAutonomousDatabase": + err = unpopulate(val, "TimeReclamationOfFreeAutonomousDatabase", &a.TimeReclamationOfFreeAutonomousDatabase) + delete(rawMsg, key) + case "timeUntilReconnectCloneEnabled": + err = unpopulate(val, "TimeUntilReconnectCloneEnabled", &a.TimeUntilReconnectCloneEnabled) + delete(rawMsg, key) + case "usedDataStorageSizeInGbs": + err = unpopulate(val, "UsedDataStorageSizeInGbs", &a.UsedDataStorageSizeInGbs) + delete(rawMsg, key) + case "usedDataStorageSizeInTbs": + err = unpopulate(val, "UsedDataStorageSizeInTbs", &a.UsedDataStorageSizeInTbs) + delete(rawMsg, key) + case "vnetId": + err = unpopulate(val, "VnetID", &a.VnetID) + delete(rawMsg, key) + case "whitelistedIps": + err = unpopulate(val, "WhitelistedIPs", &a.WhitelistedIPs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseListResult. +func (a AutonomousDatabaseListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseListResult. +func (a *AutonomousDatabaseListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseNationalCharacterSet. +func (a AutonomousDatabaseNationalCharacterSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseNationalCharacterSet. +func (a *AutonomousDatabaseNationalCharacterSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseNationalCharacterSetListResult. +func (a AutonomousDatabaseNationalCharacterSetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseNationalCharacterSetListResult. +func (a *AutonomousDatabaseNationalCharacterSetListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseNationalCharacterSetProperties. +func (a AutonomousDatabaseNationalCharacterSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "characterSet", a.CharacterSet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseNationalCharacterSetProperties. +func (a *AutonomousDatabaseNationalCharacterSetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "characterSet": + err = unpopulate(val, "CharacterSet", &a.CharacterSet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseProperties. +func (a AutonomousDatabaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actualUsedDataStorageSizeInTbs", a.ActualUsedDataStorageSizeInTbs) + populate(objectMap, "adminPassword", a.AdminPassword) + populate(objectMap, "allocatedStorageSizeInTbs", a.AllocatedStorageSizeInTbs) + populate(objectMap, "apexDetails", a.ApexDetails) + populate(objectMap, "autonomousDatabaseId", a.AutonomousDatabaseID) + populate(objectMap, "autonomousMaintenanceScheduleType", a.AutonomousMaintenanceScheduleType) + populate(objectMap, "availableUpgradeVersions", a.AvailableUpgradeVersions) + populate(objectMap, "backupRetentionPeriodInDays", a.BackupRetentionPeriodInDays) + populate(objectMap, "cpuCoreCount", a.CPUCoreCount) + populate(objectMap, "characterSet", a.CharacterSet) + populate(objectMap, "computeCount", a.ComputeCount) + populate(objectMap, "computeModel", a.ComputeModel) + populate(objectMap, "connectionStrings", a.ConnectionStrings) + populate(objectMap, "connectionUrls", a.ConnectionUrls) + populate(objectMap, "customerContacts", a.CustomerContacts) + objectMap["dataBaseType"] = DataBaseTypeRegular + populate(objectMap, "dataSafeStatus", a.DataSafeStatus) + populate(objectMap, "dataStorageSizeInGbs", a.DataStorageSizeInGbs) + populate(objectMap, "dataStorageSizeInTbs", a.DataStorageSizeInTbs) + populate(objectMap, "databaseEdition", a.DatabaseEdition) + populate(objectMap, "dbVersion", a.DbVersion) + populate(objectMap, "dbWorkload", a.DbWorkload) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "failedDataRecoveryInSeconds", a.FailedDataRecoveryInSeconds) + populate(objectMap, "inMemoryAreaInGbs", a.InMemoryAreaInGbs) + populate(objectMap, "isAutoScalingEnabled", a.IsAutoScalingEnabled) + populate(objectMap, "isAutoScalingForStorageEnabled", a.IsAutoScalingForStorageEnabled) + populate(objectMap, "isLocalDataGuardEnabled", a.IsLocalDataGuardEnabled) + populate(objectMap, "isMtlsConnectionRequired", a.IsMtlsConnectionRequired) + populate(objectMap, "isPreview", a.IsPreview) + populate(objectMap, "isPreviewVersionWithServiceTermsAccepted", a.IsPreviewVersionWithServiceTermsAccepted) + populate(objectMap, "isRemoteDataGuardEnabled", a.IsRemoteDataGuardEnabled) + populate(objectMap, "licenseModel", a.LicenseModel) + populate(objectMap, "lifecycleDetails", a.LifecycleDetails) + populate(objectMap, "lifecycleState", a.LifecycleState) + populate(objectMap, "localAdgAutoFailoverMaxDataLossLimit", a.LocalAdgAutoFailoverMaxDataLossLimit) + populate(objectMap, "localDisasterRecoveryType", a.LocalDisasterRecoveryType) + populate(objectMap, "localStandbyDb", a.LocalStandbyDb) + populate(objectMap, "memoryPerOracleComputeUnitInGbs", a.MemoryPerOracleComputeUnitInGbs) + populate(objectMap, "ncharacterSet", a.NcharacterSet) + populate(objectMap, "ociUrl", a.OciURL) + populate(objectMap, "ocid", a.Ocid) + populate(objectMap, "openMode", a.OpenMode) + populate(objectMap, "operationsInsightsStatus", a.OperationsInsightsStatus) + populate(objectMap, "peerDbId", a.PeerDbID) + populate(objectMap, "peerDbIds", a.PeerDbIDs) + populate(objectMap, "permissionLevel", a.PermissionLevel) + populate(objectMap, "privateEndpoint", a.PrivateEndpoint) + populate(objectMap, "privateEndpointIp", a.PrivateEndpointIP) + populate(objectMap, "privateEndpointLabel", a.PrivateEndpointLabel) + populate(objectMap, "provisionableCpus", a.ProvisionableCpus) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "role", a.Role) + populate(objectMap, "sqlWebDeveloperUrl", a.SQLWebDeveloperURL) + populate(objectMap, "scheduledOperations", a.ScheduledOperations) + populate(objectMap, "serviceConsoleUrl", a.ServiceConsoleURL) + populate(objectMap, "subnetId", a.SubnetID) + populate(objectMap, "supportedRegionsToCloneTo", a.SupportedRegionsToCloneTo) + populateDateTimeRFC3339(objectMap, "timeCreated", a.TimeCreated) + populate(objectMap, "timeDataGuardRoleChanged", a.TimeDataGuardRoleChanged) + populate(objectMap, "timeDeletionOfFreeAutonomousDatabase", a.TimeDeletionOfFreeAutonomousDatabase) + populate(objectMap, "timeLocalDataGuardEnabled", a.TimeLocalDataGuardEnabled) + populateDateTimeRFC3339(objectMap, "timeMaintenanceBegin", a.TimeMaintenanceBegin) + populateDateTimeRFC3339(objectMap, "timeMaintenanceEnd", a.TimeMaintenanceEnd) + populate(objectMap, "timeOfLastFailover", a.TimeOfLastFailover) + populate(objectMap, "timeOfLastRefresh", a.TimeOfLastRefresh) + populate(objectMap, "timeOfLastRefreshPoint", a.TimeOfLastRefreshPoint) + populate(objectMap, "timeOfLastSwitchover", a.TimeOfLastSwitchover) + populate(objectMap, "timeReclamationOfFreeAutonomousDatabase", a.TimeReclamationOfFreeAutonomousDatabase) + populate(objectMap, "usedDataStorageSizeInGbs", a.UsedDataStorageSizeInGbs) + populate(objectMap, "usedDataStorageSizeInTbs", a.UsedDataStorageSizeInTbs) + populate(objectMap, "vnetId", a.VnetID) + populate(objectMap, "whitelistedIps", a.WhitelistedIPs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseProperties. +func (a *AutonomousDatabaseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actualUsedDataStorageSizeInTbs": + err = unpopulate(val, "ActualUsedDataStorageSizeInTbs", &a.ActualUsedDataStorageSizeInTbs) + delete(rawMsg, key) + case "adminPassword": + err = unpopulate(val, "AdminPassword", &a.AdminPassword) + delete(rawMsg, key) + case "allocatedStorageSizeInTbs": + err = unpopulate(val, "AllocatedStorageSizeInTbs", &a.AllocatedStorageSizeInTbs) + delete(rawMsg, key) + case "apexDetails": + err = unpopulate(val, "ApexDetails", &a.ApexDetails) + delete(rawMsg, key) + case "autonomousDatabaseId": + err = unpopulate(val, "AutonomousDatabaseID", &a.AutonomousDatabaseID) + delete(rawMsg, key) + case "autonomousMaintenanceScheduleType": + err = unpopulate(val, "AutonomousMaintenanceScheduleType", &a.AutonomousMaintenanceScheduleType) + delete(rawMsg, key) + case "availableUpgradeVersions": + err = unpopulate(val, "AvailableUpgradeVersions", &a.AvailableUpgradeVersions) + delete(rawMsg, key) + case "backupRetentionPeriodInDays": + err = unpopulate(val, "BackupRetentionPeriodInDays", &a.BackupRetentionPeriodInDays) + delete(rawMsg, key) + case "cpuCoreCount": + err = unpopulate(val, "CPUCoreCount", &a.CPUCoreCount) + delete(rawMsg, key) + case "characterSet": + err = unpopulate(val, "CharacterSet", &a.CharacterSet) + delete(rawMsg, key) + case "computeCount": + err = unpopulate(val, "ComputeCount", &a.ComputeCount) + delete(rawMsg, key) + case "computeModel": + err = unpopulate(val, "ComputeModel", &a.ComputeModel) + delete(rawMsg, key) + case "connectionStrings": + err = unpopulate(val, "ConnectionStrings", &a.ConnectionStrings) + delete(rawMsg, key) + case "connectionUrls": + err = unpopulate(val, "ConnectionUrls", &a.ConnectionUrls) + delete(rawMsg, key) + case "customerContacts": + err = unpopulate(val, "CustomerContacts", &a.CustomerContacts) + delete(rawMsg, key) + case "dataBaseType": + err = unpopulate(val, "DataBaseType", &a.DataBaseType) + delete(rawMsg, key) + case "dataSafeStatus": + err = unpopulate(val, "DataSafeStatus", &a.DataSafeStatus) + delete(rawMsg, key) + case "dataStorageSizeInGbs": + err = unpopulate(val, "DataStorageSizeInGbs", &a.DataStorageSizeInGbs) + delete(rawMsg, key) + case "dataStorageSizeInTbs": + err = unpopulate(val, "DataStorageSizeInTbs", &a.DataStorageSizeInTbs) + delete(rawMsg, key) + case "databaseEdition": + err = unpopulate(val, "DatabaseEdition", &a.DatabaseEdition) + delete(rawMsg, key) + case "dbVersion": + err = unpopulate(val, "DbVersion", &a.DbVersion) + delete(rawMsg, key) + case "dbWorkload": + err = unpopulate(val, "DbWorkload", &a.DbWorkload) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "failedDataRecoveryInSeconds": + err = unpopulate(val, "FailedDataRecoveryInSeconds", &a.FailedDataRecoveryInSeconds) + delete(rawMsg, key) + case "inMemoryAreaInGbs": + err = unpopulate(val, "InMemoryAreaInGbs", &a.InMemoryAreaInGbs) + delete(rawMsg, key) + case "isAutoScalingEnabled": + err = unpopulate(val, "IsAutoScalingEnabled", &a.IsAutoScalingEnabled) + delete(rawMsg, key) + case "isAutoScalingForStorageEnabled": + err = unpopulate(val, "IsAutoScalingForStorageEnabled", &a.IsAutoScalingForStorageEnabled) + delete(rawMsg, key) + case "isLocalDataGuardEnabled": + err = unpopulate(val, "IsLocalDataGuardEnabled", &a.IsLocalDataGuardEnabled) + delete(rawMsg, key) + case "isMtlsConnectionRequired": + err = unpopulate(val, "IsMtlsConnectionRequired", &a.IsMtlsConnectionRequired) + delete(rawMsg, key) + case "isPreview": + err = unpopulate(val, "IsPreview", &a.IsPreview) + delete(rawMsg, key) + case "isPreviewVersionWithServiceTermsAccepted": + err = unpopulate(val, "IsPreviewVersionWithServiceTermsAccepted", &a.IsPreviewVersionWithServiceTermsAccepted) + delete(rawMsg, key) + case "isRemoteDataGuardEnabled": + err = unpopulate(val, "IsRemoteDataGuardEnabled", &a.IsRemoteDataGuardEnabled) + delete(rawMsg, key) + case "licenseModel": + err = unpopulate(val, "LicenseModel", &a.LicenseModel) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &a.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &a.LifecycleState) + delete(rawMsg, key) + case "localAdgAutoFailoverMaxDataLossLimit": + err = unpopulate(val, "LocalAdgAutoFailoverMaxDataLossLimit", &a.LocalAdgAutoFailoverMaxDataLossLimit) + delete(rawMsg, key) + case "localDisasterRecoveryType": + err = unpopulate(val, "LocalDisasterRecoveryType", &a.LocalDisasterRecoveryType) + delete(rawMsg, key) + case "localStandbyDb": + err = unpopulate(val, "LocalStandbyDb", &a.LocalStandbyDb) + delete(rawMsg, key) + case "memoryPerOracleComputeUnitInGbs": + err = unpopulate(val, "MemoryPerOracleComputeUnitInGbs", &a.MemoryPerOracleComputeUnitInGbs) + delete(rawMsg, key) + case "ncharacterSet": + err = unpopulate(val, "NcharacterSet", &a.NcharacterSet) + delete(rawMsg, key) + case "ociUrl": + err = unpopulate(val, "OciURL", &a.OciURL) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &a.Ocid) + delete(rawMsg, key) + case "openMode": + err = unpopulate(val, "OpenMode", &a.OpenMode) + delete(rawMsg, key) + case "operationsInsightsStatus": + err = unpopulate(val, "OperationsInsightsStatus", &a.OperationsInsightsStatus) + delete(rawMsg, key) + case "peerDbId": + err = unpopulate(val, "PeerDbID", &a.PeerDbID) + delete(rawMsg, key) + case "peerDbIds": + err = unpopulate(val, "PeerDbIDs", &a.PeerDbIDs) + delete(rawMsg, key) + case "permissionLevel": + err = unpopulate(val, "PermissionLevel", &a.PermissionLevel) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &a.PrivateEndpoint) + delete(rawMsg, key) + case "privateEndpointIp": + err = unpopulate(val, "PrivateEndpointIP", &a.PrivateEndpointIP) + delete(rawMsg, key) + case "privateEndpointLabel": + err = unpopulate(val, "PrivateEndpointLabel", &a.PrivateEndpointLabel) + delete(rawMsg, key) + case "provisionableCpus": + err = unpopulate(val, "ProvisionableCpus", &a.ProvisionableCpus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &a.Role) + delete(rawMsg, key) + case "sqlWebDeveloperUrl": + err = unpopulate(val, "SQLWebDeveloperURL", &a.SQLWebDeveloperURL) + delete(rawMsg, key) + case "scheduledOperations": + err = unpopulate(val, "ScheduledOperations", &a.ScheduledOperations) + delete(rawMsg, key) + case "serviceConsoleUrl": + err = unpopulate(val, "ServiceConsoleURL", &a.ServiceConsoleURL) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &a.SubnetID) + delete(rawMsg, key) + case "supportedRegionsToCloneTo": + err = unpopulate(val, "SupportedRegionsToCloneTo", &a.SupportedRegionsToCloneTo) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &a.TimeCreated) + delete(rawMsg, key) + case "timeDataGuardRoleChanged": + err = unpopulate(val, "TimeDataGuardRoleChanged", &a.TimeDataGuardRoleChanged) + delete(rawMsg, key) + case "timeDeletionOfFreeAutonomousDatabase": + err = unpopulate(val, "TimeDeletionOfFreeAutonomousDatabase", &a.TimeDeletionOfFreeAutonomousDatabase) + delete(rawMsg, key) + case "timeLocalDataGuardEnabled": + err = unpopulate(val, "TimeLocalDataGuardEnabled", &a.TimeLocalDataGuardEnabled) + delete(rawMsg, key) + case "timeMaintenanceBegin": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceBegin", &a.TimeMaintenanceBegin) + delete(rawMsg, key) + case "timeMaintenanceEnd": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceEnd", &a.TimeMaintenanceEnd) + delete(rawMsg, key) + case "timeOfLastFailover": + err = unpopulate(val, "TimeOfLastFailover", &a.TimeOfLastFailover) + delete(rawMsg, key) + case "timeOfLastRefresh": + err = unpopulate(val, "TimeOfLastRefresh", &a.TimeOfLastRefresh) + delete(rawMsg, key) + case "timeOfLastRefreshPoint": + err = unpopulate(val, "TimeOfLastRefreshPoint", &a.TimeOfLastRefreshPoint) + delete(rawMsg, key) + case "timeOfLastSwitchover": + err = unpopulate(val, "TimeOfLastSwitchover", &a.TimeOfLastSwitchover) + delete(rawMsg, key) + case "timeReclamationOfFreeAutonomousDatabase": + err = unpopulate(val, "TimeReclamationOfFreeAutonomousDatabase", &a.TimeReclamationOfFreeAutonomousDatabase) + delete(rawMsg, key) + case "usedDataStorageSizeInGbs": + err = unpopulate(val, "UsedDataStorageSizeInGbs", &a.UsedDataStorageSizeInGbs) + delete(rawMsg, key) + case "usedDataStorageSizeInTbs": + err = unpopulate(val, "UsedDataStorageSizeInTbs", &a.UsedDataStorageSizeInTbs) + delete(rawMsg, key) + case "vnetId": + err = unpopulate(val, "VnetID", &a.VnetID) + delete(rawMsg, key) + case "whitelistedIps": + err = unpopulate(val, "WhitelistedIPs", &a.WhitelistedIPs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseStandbySummary. +func (a AutonomousDatabaseStandbySummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "lagTimeInSeconds", a.LagTimeInSeconds) + populate(objectMap, "lifecycleDetails", a.LifecycleDetails) + populate(objectMap, "lifecycleState", a.LifecycleState) + populate(objectMap, "timeDataGuardRoleChanged", a.TimeDataGuardRoleChanged) + populate(objectMap, "timeDisasterRecoveryRoleChanged", a.TimeDisasterRecoveryRoleChanged) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseStandbySummary. +func (a *AutonomousDatabaseStandbySummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lagTimeInSeconds": + err = unpopulate(val, "LagTimeInSeconds", &a.LagTimeInSeconds) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &a.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &a.LifecycleState) + delete(rawMsg, key) + case "timeDataGuardRoleChanged": + err = unpopulate(val, "TimeDataGuardRoleChanged", &a.TimeDataGuardRoleChanged) + delete(rawMsg, key) + case "timeDisasterRecoveryRoleChanged": + err = unpopulate(val, "TimeDisasterRecoveryRoleChanged", &a.TimeDisasterRecoveryRoleChanged) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseUpdate. +func (a AutonomousDatabaseUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseUpdate. +func (a *AutonomousDatabaseUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseUpdateProperties. +func (a AutonomousDatabaseUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adminPassword", a.AdminPassword) + populate(objectMap, "autonomousMaintenanceScheduleType", a.AutonomousMaintenanceScheduleType) + populate(objectMap, "backupRetentionPeriodInDays", a.BackupRetentionPeriodInDays) + populate(objectMap, "cpuCoreCount", a.CPUCoreCount) + populate(objectMap, "computeCount", a.ComputeCount) + populate(objectMap, "customerContacts", a.CustomerContacts) + populate(objectMap, "dataStorageSizeInGbs", a.DataStorageSizeInGbs) + populate(objectMap, "dataStorageSizeInTbs", a.DataStorageSizeInTbs) + populate(objectMap, "databaseEdition", a.DatabaseEdition) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "isAutoScalingEnabled", a.IsAutoScalingEnabled) + populate(objectMap, "isAutoScalingForStorageEnabled", a.IsAutoScalingForStorageEnabled) + populate(objectMap, "isLocalDataGuardEnabled", a.IsLocalDataGuardEnabled) + populate(objectMap, "isMtlsConnectionRequired", a.IsMtlsConnectionRequired) + populate(objectMap, "licenseModel", a.LicenseModel) + populate(objectMap, "localAdgAutoFailoverMaxDataLossLimit", a.LocalAdgAutoFailoverMaxDataLossLimit) + populate(objectMap, "openMode", a.OpenMode) + populate(objectMap, "peerDbId", a.PeerDbID) + populate(objectMap, "permissionLevel", a.PermissionLevel) + populate(objectMap, "role", a.Role) + populate(objectMap, "scheduledOperations", a.ScheduledOperations) + populate(objectMap, "whitelistedIps", a.WhitelistedIPs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseUpdateProperties. +func (a *AutonomousDatabaseUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "adminPassword": + err = unpopulate(val, "AdminPassword", &a.AdminPassword) + delete(rawMsg, key) + case "autonomousMaintenanceScheduleType": + err = unpopulate(val, "AutonomousMaintenanceScheduleType", &a.AutonomousMaintenanceScheduleType) + delete(rawMsg, key) + case "backupRetentionPeriodInDays": + err = unpopulate(val, "BackupRetentionPeriodInDays", &a.BackupRetentionPeriodInDays) + delete(rawMsg, key) + case "cpuCoreCount": + err = unpopulate(val, "CPUCoreCount", &a.CPUCoreCount) + delete(rawMsg, key) + case "computeCount": + err = unpopulate(val, "ComputeCount", &a.ComputeCount) + delete(rawMsg, key) + case "customerContacts": + err = unpopulate(val, "CustomerContacts", &a.CustomerContacts) + delete(rawMsg, key) + case "dataStorageSizeInGbs": + err = unpopulate(val, "DataStorageSizeInGbs", &a.DataStorageSizeInGbs) + delete(rawMsg, key) + case "dataStorageSizeInTbs": + err = unpopulate(val, "DataStorageSizeInTbs", &a.DataStorageSizeInTbs) + delete(rawMsg, key) + case "databaseEdition": + err = unpopulate(val, "DatabaseEdition", &a.DatabaseEdition) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "isAutoScalingEnabled": + err = unpopulate(val, "IsAutoScalingEnabled", &a.IsAutoScalingEnabled) + delete(rawMsg, key) + case "isAutoScalingForStorageEnabled": + err = unpopulate(val, "IsAutoScalingForStorageEnabled", &a.IsAutoScalingForStorageEnabled) + delete(rawMsg, key) + case "isLocalDataGuardEnabled": + err = unpopulate(val, "IsLocalDataGuardEnabled", &a.IsLocalDataGuardEnabled) + delete(rawMsg, key) + case "isMtlsConnectionRequired": + err = unpopulate(val, "IsMtlsConnectionRequired", &a.IsMtlsConnectionRequired) + delete(rawMsg, key) + case "licenseModel": + err = unpopulate(val, "LicenseModel", &a.LicenseModel) + delete(rawMsg, key) + case "localAdgAutoFailoverMaxDataLossLimit": + err = unpopulate(val, "LocalAdgAutoFailoverMaxDataLossLimit", &a.LocalAdgAutoFailoverMaxDataLossLimit) + delete(rawMsg, key) + case "openMode": + err = unpopulate(val, "OpenMode", &a.OpenMode) + delete(rawMsg, key) + case "peerDbId": + err = unpopulate(val, "PeerDbID", &a.PeerDbID) + delete(rawMsg, key) + case "permissionLevel": + err = unpopulate(val, "PermissionLevel", &a.PermissionLevel) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &a.Role) + delete(rawMsg, key) + case "scheduledOperations": + err = unpopulate(val, "ScheduledOperations", &a.ScheduledOperations) + delete(rawMsg, key) + case "whitelistedIps": + err = unpopulate(val, "WhitelistedIPs", &a.WhitelistedIPs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseWalletFile. +func (a AutonomousDatabaseWalletFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "walletFiles", a.WalletFiles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseWalletFile. +func (a *AutonomousDatabaseWalletFile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "walletFiles": + err = unpopulate(val, "WalletFiles", &a.WalletFiles) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDbVersion. +func (a AutonomousDbVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDbVersion. +func (a *AutonomousDbVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDbVersionListResult. +func (a AutonomousDbVersionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDbVersionListResult. +func (a *AutonomousDbVersionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutonomousDbVersionProperties. +func (a AutonomousDbVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dbWorkload", a.DbWorkload) + populate(objectMap, "isDefaultForFree", a.IsDefaultForFree) + populate(objectMap, "isDefaultForPaid", a.IsDefaultForPaid) + populate(objectMap, "isFreeTierEnabled", a.IsFreeTierEnabled) + populate(objectMap, "isPaidEnabled", a.IsPaidEnabled) + populate(objectMap, "version", a.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDbVersionProperties. +func (a *AutonomousDbVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dbWorkload": + err = unpopulate(val, "DbWorkload", &a.DbWorkload) + delete(rawMsg, key) + case "isDefaultForFree": + err = unpopulate(val, "IsDefaultForFree", &a.IsDefaultForFree) + delete(rawMsg, key) + case "isDefaultForPaid": + err = unpopulate(val, "IsDefaultForPaid", &a.IsDefaultForPaid) + delete(rawMsg, key) + case "isFreeTierEnabled": + err = unpopulate(val, "IsFreeTierEnabled", &a.IsFreeTierEnabled) + delete(rawMsg, key) + case "isPaidEnabled": + err = unpopulate(val, "IsPaidEnabled", &a.IsPaidEnabled) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &a.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudAccountDetails. +func (c CloudAccountDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cloudAccountHomeRegion", c.CloudAccountHomeRegion) + populate(objectMap, "cloudAccountName", c.CloudAccountName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudAccountDetails. +func (c *CloudAccountDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cloudAccountHomeRegion": + err = unpopulate(val, "CloudAccountHomeRegion", &c.CloudAccountHomeRegion) + delete(rawMsg, key) + case "cloudAccountName": + err = unpopulate(val, "CloudAccountName", &c.CloudAccountName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudExadataInfrastructure. +func (c CloudExadataInfrastructure) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + populate(objectMap, "zones", c.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructure. +func (c *CloudExadataInfrastructure) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &c.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudExadataInfrastructureListResult. +func (c CloudExadataInfrastructureListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructureListResult. +func (c *CloudExadataInfrastructureListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudExadataInfrastructureProperties. +func (c CloudExadataInfrastructureProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activatedStorageCount", c.ActivatedStorageCount) + populate(objectMap, "additionalStorageCount", c.AdditionalStorageCount) + populate(objectMap, "availableStorageSizeInGbs", c.AvailableStorageSizeInGbs) + populate(objectMap, "cpuCount", c.CPUCount) + populate(objectMap, "computeCount", c.ComputeCount) + populate(objectMap, "customerContacts", c.CustomerContacts) + populate(objectMap, "dataStorageSizeInTbs", c.DataStorageSizeInTbs) + populate(objectMap, "dbNodeStorageSizeInGbs", c.DbNodeStorageSizeInGbs) + populate(objectMap, "dbServerVersion", c.DbServerVersion) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "estimatedPatchingTime", c.EstimatedPatchingTime) + populate(objectMap, "lastMaintenanceRunId", c.LastMaintenanceRunID) + populate(objectMap, "lifecycleDetails", c.LifecycleDetails) + populate(objectMap, "lifecycleState", c.LifecycleState) + populate(objectMap, "maintenanceWindow", c.MaintenanceWindow) + populate(objectMap, "maxCpuCount", c.MaxCPUCount) + populate(objectMap, "maxDataStorageInTbs", c.MaxDataStorageInTbs) + populate(objectMap, "maxDbNodeStorageSizeInGbs", c.MaxDbNodeStorageSizeInGbs) + populate(objectMap, "maxMemoryInGbs", c.MaxMemoryInGbs) + populate(objectMap, "memorySizeInGbs", c.MemorySizeInGbs) + populate(objectMap, "monthlyDbServerVersion", c.MonthlyDbServerVersion) + populate(objectMap, "monthlyStorageServerVersion", c.MonthlyStorageServerVersion) + populate(objectMap, "nextMaintenanceRunId", c.NextMaintenanceRunID) + populate(objectMap, "ociUrl", c.OciURL) + populate(objectMap, "ocid", c.Ocid) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "shape", c.Shape) + populate(objectMap, "storageCount", c.StorageCount) + populate(objectMap, "storageServerVersion", c.StorageServerVersion) + populate(objectMap, "timeCreated", c.TimeCreated) + populate(objectMap, "totalStorageSizeInGbs", c.TotalStorageSizeInGbs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructureProperties. +func (c *CloudExadataInfrastructureProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activatedStorageCount": + err = unpopulate(val, "ActivatedStorageCount", &c.ActivatedStorageCount) + delete(rawMsg, key) + case "additionalStorageCount": + err = unpopulate(val, "AdditionalStorageCount", &c.AdditionalStorageCount) + delete(rawMsg, key) + case "availableStorageSizeInGbs": + err = unpopulate(val, "AvailableStorageSizeInGbs", &c.AvailableStorageSizeInGbs) + delete(rawMsg, key) + case "cpuCount": + err = unpopulate(val, "CPUCount", &c.CPUCount) + delete(rawMsg, key) + case "computeCount": + err = unpopulate(val, "ComputeCount", &c.ComputeCount) + delete(rawMsg, key) + case "customerContacts": + err = unpopulate(val, "CustomerContacts", &c.CustomerContacts) + delete(rawMsg, key) + case "dataStorageSizeInTbs": + err = unpopulate(val, "DataStorageSizeInTbs", &c.DataStorageSizeInTbs) + delete(rawMsg, key) + case "dbNodeStorageSizeInGbs": + err = unpopulate(val, "DbNodeStorageSizeInGbs", &c.DbNodeStorageSizeInGbs) + delete(rawMsg, key) + case "dbServerVersion": + err = unpopulate(val, "DbServerVersion", &c.DbServerVersion) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "estimatedPatchingTime": + err = unpopulate(val, "EstimatedPatchingTime", &c.EstimatedPatchingTime) + delete(rawMsg, key) + case "lastMaintenanceRunId": + err = unpopulate(val, "LastMaintenanceRunID", &c.LastMaintenanceRunID) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &c.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &c.LifecycleState) + delete(rawMsg, key) + case "maintenanceWindow": + err = unpopulate(val, "MaintenanceWindow", &c.MaintenanceWindow) + delete(rawMsg, key) + case "maxCpuCount": + err = unpopulate(val, "MaxCPUCount", &c.MaxCPUCount) + delete(rawMsg, key) + case "maxDataStorageInTbs": + err = unpopulate(val, "MaxDataStorageInTbs", &c.MaxDataStorageInTbs) + delete(rawMsg, key) + case "maxDbNodeStorageSizeInGbs": + err = unpopulate(val, "MaxDbNodeStorageSizeInGbs", &c.MaxDbNodeStorageSizeInGbs) + delete(rawMsg, key) + case "maxMemoryInGbs": + err = unpopulate(val, "MaxMemoryInGbs", &c.MaxMemoryInGbs) + delete(rawMsg, key) + case "memorySizeInGbs": + err = unpopulate(val, "MemorySizeInGbs", &c.MemorySizeInGbs) + delete(rawMsg, key) + case "monthlyDbServerVersion": + err = unpopulate(val, "MonthlyDbServerVersion", &c.MonthlyDbServerVersion) + delete(rawMsg, key) + case "monthlyStorageServerVersion": + err = unpopulate(val, "MonthlyStorageServerVersion", &c.MonthlyStorageServerVersion) + delete(rawMsg, key) + case "nextMaintenanceRunId": + err = unpopulate(val, "NextMaintenanceRunID", &c.NextMaintenanceRunID) + delete(rawMsg, key) + case "ociUrl": + err = unpopulate(val, "OciURL", &c.OciURL) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &c.Ocid) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "shape": + err = unpopulate(val, "Shape", &c.Shape) + delete(rawMsg, key) + case "storageCount": + err = unpopulate(val, "StorageCount", &c.StorageCount) + delete(rawMsg, key) + case "storageServerVersion": + err = unpopulate(val, "StorageServerVersion", &c.StorageServerVersion) + delete(rawMsg, key) + case "timeCreated": + err = unpopulate(val, "TimeCreated", &c.TimeCreated) + delete(rawMsg, key) + case "totalStorageSizeInGbs": + err = unpopulate(val, "TotalStorageSizeInGbs", &c.TotalStorageSizeInGbs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudExadataInfrastructureUpdate. +func (c CloudExadataInfrastructureUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "zones", c.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructureUpdate. +func (c *CloudExadataInfrastructureUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &c.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudExadataInfrastructureUpdateProperties. +func (c CloudExadataInfrastructureUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "computeCount", c.ComputeCount) + populate(objectMap, "customerContacts", c.CustomerContacts) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "maintenanceWindow", c.MaintenanceWindow) + populate(objectMap, "storageCount", c.StorageCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructureUpdateProperties. +func (c *CloudExadataInfrastructureUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "computeCount": + err = unpopulate(val, "ComputeCount", &c.ComputeCount) + delete(rawMsg, key) + case "customerContacts": + err = unpopulate(val, "CustomerContacts", &c.CustomerContacts) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "maintenanceWindow": + err = unpopulate(val, "MaintenanceWindow", &c.MaintenanceWindow) + delete(rawMsg, key) + case "storageCount": + err = unpopulate(val, "StorageCount", &c.StorageCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudVMCluster. +func (c CloudVMCluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMCluster. +func (c *CloudVMCluster) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudVMClusterListResult. +func (c CloudVMClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMClusterListResult. +func (c *CloudVMClusterListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudVMClusterProperties. +func (c CloudVMClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupSubnetCidr", c.BackupSubnetCidr) + populate(objectMap, "cpuCoreCount", c.CPUCoreCount) + populate(objectMap, "cloudExadataInfrastructureId", c.CloudExadataInfrastructureID) + populate(objectMap, "clusterName", c.ClusterName) + populate(objectMap, "compartmentId", c.CompartmentID) + populate(objectMap, "computeNodes", c.ComputeNodes) + populate(objectMap, "dataCollectionOptions", c.DataCollectionOptions) + populate(objectMap, "dataStoragePercentage", c.DataStoragePercentage) + populate(objectMap, "dataStorageSizeInTbs", c.DataStorageSizeInTbs) + populate(objectMap, "dbNodeStorageSizeInGbs", c.DbNodeStorageSizeInGbs) + populate(objectMap, "dbServers", c.DbServers) + populate(objectMap, "diskRedundancy", c.DiskRedundancy) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "domain", c.Domain) + populate(objectMap, "giVersion", c.GiVersion) + populate(objectMap, "hostname", c.Hostname) + populate(objectMap, "iormConfigCache", c.IormConfigCache) + populate(objectMap, "isLocalBackupEnabled", c.IsLocalBackupEnabled) + populate(objectMap, "isSparseDiskgroupEnabled", c.IsSparseDiskgroupEnabled) + populate(objectMap, "lastUpdateHistoryEntryId", c.LastUpdateHistoryEntryID) + populate(objectMap, "licenseModel", c.LicenseModel) + populate(objectMap, "lifecycleDetails", c.LifecycleDetails) + populate(objectMap, "lifecycleState", c.LifecycleState) + populate(objectMap, "listenerPort", c.ListenerPort) + populate(objectMap, "memorySizeInGbs", c.MemorySizeInGbs) + populate(objectMap, "nodeCount", c.NodeCount) + populate(objectMap, "nsgCidrs", c.NsgCidrs) + populate(objectMap, "nsgUrl", c.NsgURL) + populate(objectMap, "ociUrl", c.OciURL) + populate(objectMap, "ocid", c.Ocid) + populate(objectMap, "ocpuCount", c.OcpuCount) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "sshPublicKeys", c.SSHPublicKeys) + populate(objectMap, "scanDnsName", c.ScanDNSName) + populate(objectMap, "scanDnsRecordId", c.ScanDNSRecordID) + populate(objectMap, "scanIpIds", c.ScanIPIDs) + populate(objectMap, "scanListenerPortTcp", c.ScanListenerPortTCP) + populate(objectMap, "scanListenerPortTcpSsl", c.ScanListenerPortTCPSSL) + populate(objectMap, "shape", c.Shape) + populate(objectMap, "storageSizeInGbs", c.StorageSizeInGbs) + populate(objectMap, "subnetId", c.SubnetID) + populate(objectMap, "subnetOcid", c.SubnetOcid) + populate(objectMap, "systemVersion", c.SystemVersion) + populateDateTimeRFC3339(objectMap, "timeCreated", c.TimeCreated) + populate(objectMap, "timeZone", c.TimeZone) + populate(objectMap, "vipIds", c.VipIDs) + populate(objectMap, "vnetId", c.VnetID) + populate(objectMap, "zoneId", c.ZoneID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMClusterProperties. +func (c *CloudVMClusterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupSubnetCidr": + err = unpopulate(val, "BackupSubnetCidr", &c.BackupSubnetCidr) + delete(rawMsg, key) + case "cpuCoreCount": + err = unpopulate(val, "CPUCoreCount", &c.CPUCoreCount) + delete(rawMsg, key) + case "cloudExadataInfrastructureId": + err = unpopulate(val, "CloudExadataInfrastructureID", &c.CloudExadataInfrastructureID) + delete(rawMsg, key) + case "clusterName": + err = unpopulate(val, "ClusterName", &c.ClusterName) + delete(rawMsg, key) + case "compartmentId": + err = unpopulate(val, "CompartmentID", &c.CompartmentID) + delete(rawMsg, key) + case "computeNodes": + err = unpopulate(val, "ComputeNodes", &c.ComputeNodes) + delete(rawMsg, key) + case "dataCollectionOptions": + err = unpopulate(val, "DataCollectionOptions", &c.DataCollectionOptions) + delete(rawMsg, key) + case "dataStoragePercentage": + err = unpopulate(val, "DataStoragePercentage", &c.DataStoragePercentage) + delete(rawMsg, key) + case "dataStorageSizeInTbs": + err = unpopulate(val, "DataStorageSizeInTbs", &c.DataStorageSizeInTbs) + delete(rawMsg, key) + case "dbNodeStorageSizeInGbs": + err = unpopulate(val, "DbNodeStorageSizeInGbs", &c.DbNodeStorageSizeInGbs) + delete(rawMsg, key) + case "dbServers": + err = unpopulate(val, "DbServers", &c.DbServers) + delete(rawMsg, key) + case "diskRedundancy": + err = unpopulate(val, "DiskRedundancy", &c.DiskRedundancy) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "domain": + err = unpopulate(val, "Domain", &c.Domain) + delete(rawMsg, key) + case "giVersion": + err = unpopulate(val, "GiVersion", &c.GiVersion) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, "Hostname", &c.Hostname) + delete(rawMsg, key) + case "iormConfigCache": + err = unpopulate(val, "IormConfigCache", &c.IormConfigCache) + delete(rawMsg, key) + case "isLocalBackupEnabled": + err = unpopulate(val, "IsLocalBackupEnabled", &c.IsLocalBackupEnabled) + delete(rawMsg, key) + case "isSparseDiskgroupEnabled": + err = unpopulate(val, "IsSparseDiskgroupEnabled", &c.IsSparseDiskgroupEnabled) + delete(rawMsg, key) + case "lastUpdateHistoryEntryId": + err = unpopulate(val, "LastUpdateHistoryEntryID", &c.LastUpdateHistoryEntryID) + delete(rawMsg, key) + case "licenseModel": + err = unpopulate(val, "LicenseModel", &c.LicenseModel) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &c.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &c.LifecycleState) + delete(rawMsg, key) + case "listenerPort": + err = unpopulate(val, "ListenerPort", &c.ListenerPort) + delete(rawMsg, key) + case "memorySizeInGbs": + err = unpopulate(val, "MemorySizeInGbs", &c.MemorySizeInGbs) + delete(rawMsg, key) + case "nodeCount": + err = unpopulate(val, "NodeCount", &c.NodeCount) + delete(rawMsg, key) + case "nsgCidrs": + err = unpopulate(val, "NsgCidrs", &c.NsgCidrs) + delete(rawMsg, key) + case "nsgUrl": + err = unpopulate(val, "NsgURL", &c.NsgURL) + delete(rawMsg, key) + case "ociUrl": + err = unpopulate(val, "OciURL", &c.OciURL) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &c.Ocid) + delete(rawMsg, key) + case "ocpuCount": + err = unpopulate(val, "OcpuCount", &c.OcpuCount) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "sshPublicKeys": + err = unpopulate(val, "SSHPublicKeys", &c.SSHPublicKeys) + delete(rawMsg, key) + case "scanDnsName": + err = unpopulate(val, "ScanDNSName", &c.ScanDNSName) + delete(rawMsg, key) + case "scanDnsRecordId": + err = unpopulate(val, "ScanDNSRecordID", &c.ScanDNSRecordID) + delete(rawMsg, key) + case "scanIpIds": + err = unpopulate(val, "ScanIPIDs", &c.ScanIPIDs) + delete(rawMsg, key) + case "scanListenerPortTcp": + err = unpopulate(val, "ScanListenerPortTCP", &c.ScanListenerPortTCP) + delete(rawMsg, key) + case "scanListenerPortTcpSsl": + err = unpopulate(val, "ScanListenerPortTCPSSL", &c.ScanListenerPortTCPSSL) + delete(rawMsg, key) + case "shape": + err = unpopulate(val, "Shape", &c.Shape) + delete(rawMsg, key) + case "storageSizeInGbs": + err = unpopulate(val, "StorageSizeInGbs", &c.StorageSizeInGbs) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &c.SubnetID) + delete(rawMsg, key) + case "subnetOcid": + err = unpopulate(val, "SubnetOcid", &c.SubnetOcid) + delete(rawMsg, key) + case "systemVersion": + err = unpopulate(val, "SystemVersion", &c.SystemVersion) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &c.TimeCreated) + delete(rawMsg, key) + case "timeZone": + err = unpopulate(val, "TimeZone", &c.TimeZone) + delete(rawMsg, key) + case "vipIds": + err = unpopulate(val, "VipIDs", &c.VipIDs) + delete(rawMsg, key) + case "vnetId": + err = unpopulate(val, "VnetID", &c.VnetID) + delete(rawMsg, key) + case "zoneId": + err = unpopulate(val, "ZoneID", &c.ZoneID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudVMClusterUpdate. +func (c CloudVMClusterUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMClusterUpdate. +func (c *CloudVMClusterUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudVMClusterUpdateProperties. +func (c CloudVMClusterUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cpuCoreCount", c.CPUCoreCount) + populate(objectMap, "computeNodes", c.ComputeNodes) + populate(objectMap, "dataCollectionOptions", c.DataCollectionOptions) + populate(objectMap, "dataStorageSizeInTbs", c.DataStorageSizeInTbs) + populate(objectMap, "dbNodeStorageSizeInGbs", c.DbNodeStorageSizeInGbs) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "licenseModel", c.LicenseModel) + populate(objectMap, "memorySizeInGbs", c.MemorySizeInGbs) + populate(objectMap, "ocpuCount", c.OcpuCount) + populate(objectMap, "sshPublicKeys", c.SSHPublicKeys) + populate(objectMap, "storageSizeInGbs", c.StorageSizeInGbs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMClusterUpdateProperties. +func (c *CloudVMClusterUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cpuCoreCount": + err = unpopulate(val, "CPUCoreCount", &c.CPUCoreCount) + delete(rawMsg, key) + case "computeNodes": + err = unpopulate(val, "ComputeNodes", &c.ComputeNodes) + delete(rawMsg, key) + case "dataCollectionOptions": + err = unpopulate(val, "DataCollectionOptions", &c.DataCollectionOptions) + delete(rawMsg, key) + case "dataStorageSizeInTbs": + err = unpopulate(val, "DataStorageSizeInTbs", &c.DataStorageSizeInTbs) + delete(rawMsg, key) + case "dbNodeStorageSizeInGbs": + err = unpopulate(val, "DbNodeStorageSizeInGbs", &c.DbNodeStorageSizeInGbs) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "licenseModel": + err = unpopulate(val, "LicenseModel", &c.LicenseModel) + delete(rawMsg, key) + case "memorySizeInGbs": + err = unpopulate(val, "MemorySizeInGbs", &c.MemorySizeInGbs) + delete(rawMsg, key) + case "ocpuCount": + err = unpopulate(val, "OcpuCount", &c.OcpuCount) + delete(rawMsg, key) + case "sshPublicKeys": + err = unpopulate(val, "SSHPublicKeys", &c.SSHPublicKeys) + delete(rawMsg, key) + case "storageSizeInGbs": + err = unpopulate(val, "StorageSizeInGbs", &c.StorageSizeInGbs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionStringType. +func (c ConnectionStringType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allConnectionStrings", c.AllConnectionStrings) + populate(objectMap, "dedicated", c.Dedicated) + populate(objectMap, "high", c.High) + populate(objectMap, "low", c.Low) + populate(objectMap, "medium", c.Medium) + populate(objectMap, "profiles", c.Profiles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionStringType. +func (c *ConnectionStringType) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allConnectionStrings": + err = unpopulate(val, "AllConnectionStrings", &c.AllConnectionStrings) + delete(rawMsg, key) + case "dedicated": + err = unpopulate(val, "Dedicated", &c.Dedicated) + delete(rawMsg, key) + case "high": + err = unpopulate(val, "High", &c.High) + delete(rawMsg, key) + case "low": + err = unpopulate(val, "Low", &c.Low) + delete(rawMsg, key) + case "medium": + err = unpopulate(val, "Medium", &c.Medium) + delete(rawMsg, key) + case "profiles": + err = unpopulate(val, "Profiles", &c.Profiles) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionURLType. +func (c ConnectionURLType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apexUrl", c.ApexURL) + populate(objectMap, "databaseTransformsUrl", c.DatabaseTransformsURL) + populate(objectMap, "graphStudioUrl", c.GraphStudioURL) + populate(objectMap, "machineLearningNotebookUrl", c.MachineLearningNotebookURL) + populate(objectMap, "mongoDbUrl", c.MongoDbURL) + populate(objectMap, "ordsUrl", c.OrdsURL) + populate(objectMap, "sqlDevWebUrl", c.SQLDevWebURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionURLType. +func (c *ConnectionURLType) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apexUrl": + err = unpopulate(val, "ApexURL", &c.ApexURL) + delete(rawMsg, key) + case "databaseTransformsUrl": + err = unpopulate(val, "DatabaseTransformsURL", &c.DatabaseTransformsURL) + delete(rawMsg, key) + case "graphStudioUrl": + err = unpopulate(val, "GraphStudioURL", &c.GraphStudioURL) + delete(rawMsg, key) + case "machineLearningNotebookUrl": + err = unpopulate(val, "MachineLearningNotebookURL", &c.MachineLearningNotebookURL) + delete(rawMsg, key) + case "mongoDbUrl": + err = unpopulate(val, "MongoDbURL", &c.MongoDbURL) + delete(rawMsg, key) + case "ordsUrl": + err = unpopulate(val, "OrdsURL", &c.OrdsURL) + delete(rawMsg, key) + case "sqlDevWebUrl": + err = unpopulate(val, "SQLDevWebURL", &c.SQLDevWebURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomerContact. +func (c CustomerContact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "email", c.Email) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerContact. +func (c *CustomerContact) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "email": + err = unpopulate(val, "Email", &c.Email) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DNSPrivateView. +func (d DNSPrivateView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateView. +func (d *DNSPrivateView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DNSPrivateViewListResult. +func (d DNSPrivateViewListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateViewListResult. +func (d *DNSPrivateViewListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DNSPrivateViewProperties. +func (d DNSPrivateViewProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "isProtected", d.IsProtected) + populate(objectMap, "lifecycleState", d.LifecycleState) + populate(objectMap, "ocid", d.Ocid) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "self", d.Self) + populateDateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) + populateDateTimeRFC3339(objectMap, "timeUpdated", d.TimeUpdated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateViewProperties. +func (d *DNSPrivateViewProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &d.DisplayName) + delete(rawMsg, key) + case "isProtected": + err = unpopulate(val, "IsProtected", &d.IsProtected) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &d.LifecycleState) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &d.Ocid) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "self": + err = unpopulate(val, "Self", &d.Self) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + delete(rawMsg, key) + case "timeUpdated": + err = unpopulateDateTimeRFC3339(val, "TimeUpdated", &d.TimeUpdated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DNSPrivateZone. +func (d DNSPrivateZone) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateZone. +func (d *DNSPrivateZone) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DNSPrivateZoneListResult. +func (d DNSPrivateZoneListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateZoneListResult. +func (d *DNSPrivateZoneListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DNSPrivateZoneProperties. +func (d DNSPrivateZoneProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isProtected", d.IsProtected) + populate(objectMap, "lifecycleState", d.LifecycleState) + populate(objectMap, "ocid", d.Ocid) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "self", d.Self) + populate(objectMap, "serial", d.Serial) + populateDateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) + populate(objectMap, "version", d.Version) + populate(objectMap, "viewId", d.ViewID) + populate(objectMap, "zoneType", d.ZoneType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateZoneProperties. +func (d *DNSPrivateZoneProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isProtected": + err = unpopulate(val, "IsProtected", &d.IsProtected) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &d.LifecycleState) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &d.Ocid) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "self": + err = unpopulate(val, "Self", &d.Self) + delete(rawMsg, key) + case "serial": + err = unpopulate(val, "Serial", &d.Serial) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &d.Version) + delete(rawMsg, key) + case "viewId": + err = unpopulate(val, "ViewID", &d.ViewID) + delete(rawMsg, key) + case "zoneType": + err = unpopulate(val, "ZoneType", &d.ZoneType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionOptions. +func (d DataCollectionOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isDiagnosticsEventsEnabled", d.IsDiagnosticsEventsEnabled) + populate(objectMap, "isHealthMonitoringEnabled", d.IsHealthMonitoringEnabled) + populate(objectMap, "isIncidentLogsEnabled", d.IsIncidentLogsEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionOptions. +func (d *DataCollectionOptions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isDiagnosticsEventsEnabled": + err = unpopulate(val, "IsDiagnosticsEventsEnabled", &d.IsDiagnosticsEventsEnabled) + delete(rawMsg, key) + case "isHealthMonitoringEnabled": + err = unpopulate(val, "IsHealthMonitoringEnabled", &d.IsHealthMonitoringEnabled) + delete(rawMsg, key) + case "isIncidentLogsEnabled": + err = unpopulate(val, "IsIncidentLogsEnabled", &d.IsIncidentLogsEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DayOfWeek. +func (d DayOfWeek) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", d.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DayOfWeek. +func (d *DayOfWeek) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DayOfWeekUpdate. +func (d DayOfWeekUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", d.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DayOfWeekUpdate. +func (d *DayOfWeekUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbIormConfig. +func (d DbIormConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dbName", d.DbName) + populate(objectMap, "flashCacheLimit", d.FlashCacheLimit) + populate(objectMap, "share", d.Share) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbIormConfig. +func (d *DbIormConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dbName": + err = unpopulate(val, "DbName", &d.DbName) + delete(rawMsg, key) + case "flashCacheLimit": + err = unpopulate(val, "FlashCacheLimit", &d.FlashCacheLimit) + delete(rawMsg, key) + case "share": + err = unpopulate(val, "Share", &d.Share) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbNode. +func (d DbNode) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbNode. +func (d *DbNode) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbNodeAction. +func (d DbNodeAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", d.Action) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbNodeAction. +func (d *DbNodeAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &d.Action) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbNodeListResult. +func (d DbNodeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbNodeListResult. +func (d *DbNodeListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbNodeProperties. +func (d DbNodeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalDetails", d.AdditionalDetails) + populate(objectMap, "backupIpId", d.BackupIPID) + populate(objectMap, "backupVnic2Id", d.BackupVnic2ID) + populate(objectMap, "backupVnicId", d.BackupVnicID) + populate(objectMap, "cpuCoreCount", d.CPUCoreCount) + populate(objectMap, "dbNodeStorageSizeInGbs", d.DbNodeStorageSizeInGbs) + populate(objectMap, "dbServerId", d.DbServerID) + populate(objectMap, "dbSystemId", d.DbSystemID) + populate(objectMap, "faultDomain", d.FaultDomain) + populate(objectMap, "hostIpId", d.HostIPID) + populate(objectMap, "hostname", d.Hostname) + populate(objectMap, "lifecycleDetails", d.LifecycleDetails) + populate(objectMap, "lifecycleState", d.LifecycleState) + populate(objectMap, "maintenanceType", d.MaintenanceType) + populate(objectMap, "memorySizeInGbs", d.MemorySizeInGbs) + populate(objectMap, "ocid", d.Ocid) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "softwareStorageSizeInGb", d.SoftwareStorageSizeInGb) + populateDateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) + populateDateTimeRFC3339(objectMap, "timeMaintenanceWindowEnd", d.TimeMaintenanceWindowEnd) + populateDateTimeRFC3339(objectMap, "timeMaintenanceWindowStart", d.TimeMaintenanceWindowStart) + populate(objectMap, "vnic2Id", d.Vnic2ID) + populate(objectMap, "vnicId", d.VnicID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbNodeProperties. +func (d *DbNodeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalDetails": + err = unpopulate(val, "AdditionalDetails", &d.AdditionalDetails) + delete(rawMsg, key) + case "backupIpId": + err = unpopulate(val, "BackupIPID", &d.BackupIPID) + delete(rawMsg, key) + case "backupVnic2Id": + err = unpopulate(val, "BackupVnic2ID", &d.BackupVnic2ID) + delete(rawMsg, key) + case "backupVnicId": + err = unpopulate(val, "BackupVnicID", &d.BackupVnicID) + delete(rawMsg, key) + case "cpuCoreCount": + err = unpopulate(val, "CPUCoreCount", &d.CPUCoreCount) + delete(rawMsg, key) + case "dbNodeStorageSizeInGbs": + err = unpopulate(val, "DbNodeStorageSizeInGbs", &d.DbNodeStorageSizeInGbs) + delete(rawMsg, key) + case "dbServerId": + err = unpopulate(val, "DbServerID", &d.DbServerID) + delete(rawMsg, key) + case "dbSystemId": + err = unpopulate(val, "DbSystemID", &d.DbSystemID) + delete(rawMsg, key) + case "faultDomain": + err = unpopulate(val, "FaultDomain", &d.FaultDomain) + delete(rawMsg, key) + case "hostIpId": + err = unpopulate(val, "HostIPID", &d.HostIPID) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, "Hostname", &d.Hostname) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &d.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &d.LifecycleState) + delete(rawMsg, key) + case "maintenanceType": + err = unpopulate(val, "MaintenanceType", &d.MaintenanceType) + delete(rawMsg, key) + case "memorySizeInGbs": + err = unpopulate(val, "MemorySizeInGbs", &d.MemorySizeInGbs) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &d.Ocid) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "softwareStorageSizeInGb": + err = unpopulate(val, "SoftwareStorageSizeInGb", &d.SoftwareStorageSizeInGb) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + delete(rawMsg, key) + case "timeMaintenanceWindowEnd": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceWindowEnd", &d.TimeMaintenanceWindowEnd) + delete(rawMsg, key) + case "timeMaintenanceWindowStart": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceWindowStart", &d.TimeMaintenanceWindowStart) + delete(rawMsg, key) + case "vnic2Id": + err = unpopulate(val, "Vnic2ID", &d.Vnic2ID) + delete(rawMsg, key) + case "vnicId": + err = unpopulate(val, "VnicID", &d.VnicID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbServer. +func (d DbServer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbServer. +func (d *DbServer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbServerListResult. +func (d DbServerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbServerListResult. +func (d *DbServerListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbServerPatchingDetails. +func (d DbServerPatchingDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "estimatedPatchDuration", d.EstimatedPatchDuration) + populate(objectMap, "patchingStatus", d.PatchingStatus) + populateDateTimeRFC3339(objectMap, "timePatchingEnded", d.TimePatchingEnded) + populateDateTimeRFC3339(objectMap, "timePatchingStarted", d.TimePatchingStarted) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbServerPatchingDetails. +func (d *DbServerPatchingDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "estimatedPatchDuration": + err = unpopulate(val, "EstimatedPatchDuration", &d.EstimatedPatchDuration) + delete(rawMsg, key) + case "patchingStatus": + err = unpopulate(val, "PatchingStatus", &d.PatchingStatus) + delete(rawMsg, key) + case "timePatchingEnded": + err = unpopulateDateTimeRFC3339(val, "TimePatchingEnded", &d.TimePatchingEnded) + delete(rawMsg, key) + case "timePatchingStarted": + err = unpopulateDateTimeRFC3339(val, "TimePatchingStarted", &d.TimePatchingStarted) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbServerProperties. +func (d DbServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "autonomousVmClusterIds", d.AutonomousVMClusterIDs) + populate(objectMap, "autonomousVirtualMachineIds", d.AutonomousVirtualMachineIDs) + populate(objectMap, "cpuCoreCount", d.CPUCoreCount) + populate(objectMap, "compartmentId", d.CompartmentID) + populate(objectMap, "dbNodeIds", d.DbNodeIDs) + populate(objectMap, "dbNodeStorageSizeInGbs", d.DbNodeStorageSizeInGbs) + populate(objectMap, "dbServerPatchingDetails", d.DbServerPatchingDetails) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "exadataInfrastructureId", d.ExadataInfrastructureID) + populate(objectMap, "lifecycleDetails", d.LifecycleDetails) + populate(objectMap, "lifecycleState", d.LifecycleState) + populate(objectMap, "maxCpuCount", d.MaxCPUCount) + populate(objectMap, "maxDbNodeStorageInGbs", d.MaxDbNodeStorageInGbs) + populate(objectMap, "maxMemoryInGbs", d.MaxMemoryInGbs) + populate(objectMap, "memorySizeInGbs", d.MemorySizeInGbs) + populate(objectMap, "ocid", d.Ocid) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "shape", d.Shape) + populateDateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) + populate(objectMap, "vmClusterIds", d.VMClusterIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbServerProperties. +func (d *DbServerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autonomousVmClusterIds": + err = unpopulate(val, "AutonomousVMClusterIDs", &d.AutonomousVMClusterIDs) + delete(rawMsg, key) + case "autonomousVirtualMachineIds": + err = unpopulate(val, "AutonomousVirtualMachineIDs", &d.AutonomousVirtualMachineIDs) + delete(rawMsg, key) + case "cpuCoreCount": + err = unpopulate(val, "CPUCoreCount", &d.CPUCoreCount) + delete(rawMsg, key) + case "compartmentId": + err = unpopulate(val, "CompartmentID", &d.CompartmentID) + delete(rawMsg, key) + case "dbNodeIds": + err = unpopulate(val, "DbNodeIDs", &d.DbNodeIDs) + delete(rawMsg, key) + case "dbNodeStorageSizeInGbs": + err = unpopulate(val, "DbNodeStorageSizeInGbs", &d.DbNodeStorageSizeInGbs) + delete(rawMsg, key) + case "dbServerPatchingDetails": + err = unpopulate(val, "DbServerPatchingDetails", &d.DbServerPatchingDetails) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &d.DisplayName) + delete(rawMsg, key) + case "exadataInfrastructureId": + err = unpopulate(val, "ExadataInfrastructureID", &d.ExadataInfrastructureID) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &d.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &d.LifecycleState) + delete(rawMsg, key) + case "maxCpuCount": + err = unpopulate(val, "MaxCPUCount", &d.MaxCPUCount) + delete(rawMsg, key) + case "maxDbNodeStorageInGbs": + err = unpopulate(val, "MaxDbNodeStorageInGbs", &d.MaxDbNodeStorageInGbs) + delete(rawMsg, key) + case "maxMemoryInGbs": + err = unpopulate(val, "MaxMemoryInGbs", &d.MaxMemoryInGbs) + delete(rawMsg, key) + case "memorySizeInGbs": + err = unpopulate(val, "MemorySizeInGbs", &d.MemorySizeInGbs) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &d.Ocid) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "shape": + err = unpopulate(val, "Shape", &d.Shape) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + delete(rawMsg, key) + case "vmClusterIds": + err = unpopulate(val, "VMClusterIDs", &d.VMClusterIDs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbSystemShape. +func (d DbSystemShape) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbSystemShape. +func (d *DbSystemShape) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbSystemShapeListResult. +func (d DbSystemShapeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbSystemShapeListResult. +func (d *DbSystemShapeListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbSystemShapeProperties. +func (d DbSystemShapeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availableCoreCount", d.AvailableCoreCount) + populate(objectMap, "availableCoreCountPerNode", d.AvailableCoreCountPerNode) + populate(objectMap, "availableDataStorageInTbs", d.AvailableDataStorageInTbs) + populate(objectMap, "availableDataStoragePerServerInTbs", d.AvailableDataStoragePerServerInTbs) + populate(objectMap, "availableDbNodePerNodeInGbs", d.AvailableDbNodePerNodeInGbs) + populate(objectMap, "availableDbNodeStorageInGbs", d.AvailableDbNodeStorageInGbs) + populate(objectMap, "availableMemoryInGbs", d.AvailableMemoryInGbs) + populate(objectMap, "availableMemoryPerNodeInGbs", d.AvailableMemoryPerNodeInGbs) + populate(objectMap, "coreCountIncrement", d.CoreCountIncrement) + populate(objectMap, "maxStorageCount", d.MaxStorageCount) + populate(objectMap, "maximumNodeCount", d.MaximumNodeCount) + populate(objectMap, "minCoreCountPerNode", d.MinCoreCountPerNode) + populate(objectMap, "minDataStorageInTbs", d.MinDataStorageInTbs) + populate(objectMap, "minDbNodeStoragePerNodeInGbs", d.MinDbNodeStoragePerNodeInGbs) + populate(objectMap, "minMemoryPerNodeInGbs", d.MinMemoryPerNodeInGbs) + populate(objectMap, "minStorageCount", d.MinStorageCount) + populate(objectMap, "minimumCoreCount", d.MinimumCoreCount) + populate(objectMap, "minimumNodeCount", d.MinimumNodeCount) + populate(objectMap, "runtimeMinimumCoreCount", d.RuntimeMinimumCoreCount) + populate(objectMap, "shapeFamily", d.ShapeFamily) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbSystemShapeProperties. +func (d *DbSystemShapeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availableCoreCount": + err = unpopulate(val, "AvailableCoreCount", &d.AvailableCoreCount) + delete(rawMsg, key) + case "availableCoreCountPerNode": + err = unpopulate(val, "AvailableCoreCountPerNode", &d.AvailableCoreCountPerNode) + delete(rawMsg, key) + case "availableDataStorageInTbs": + err = unpopulate(val, "AvailableDataStorageInTbs", &d.AvailableDataStorageInTbs) + delete(rawMsg, key) + case "availableDataStoragePerServerInTbs": + err = unpopulate(val, "AvailableDataStoragePerServerInTbs", &d.AvailableDataStoragePerServerInTbs) + delete(rawMsg, key) + case "availableDbNodePerNodeInGbs": + err = unpopulate(val, "AvailableDbNodePerNodeInGbs", &d.AvailableDbNodePerNodeInGbs) + delete(rawMsg, key) + case "availableDbNodeStorageInGbs": + err = unpopulate(val, "AvailableDbNodeStorageInGbs", &d.AvailableDbNodeStorageInGbs) + delete(rawMsg, key) + case "availableMemoryInGbs": + err = unpopulate(val, "AvailableMemoryInGbs", &d.AvailableMemoryInGbs) + delete(rawMsg, key) + case "availableMemoryPerNodeInGbs": + err = unpopulate(val, "AvailableMemoryPerNodeInGbs", &d.AvailableMemoryPerNodeInGbs) + delete(rawMsg, key) + case "coreCountIncrement": + err = unpopulate(val, "CoreCountIncrement", &d.CoreCountIncrement) + delete(rawMsg, key) + case "maxStorageCount": + err = unpopulate(val, "MaxStorageCount", &d.MaxStorageCount) + delete(rawMsg, key) + case "maximumNodeCount": + err = unpopulate(val, "MaximumNodeCount", &d.MaximumNodeCount) + delete(rawMsg, key) + case "minCoreCountPerNode": + err = unpopulate(val, "MinCoreCountPerNode", &d.MinCoreCountPerNode) + delete(rawMsg, key) + case "minDataStorageInTbs": + err = unpopulate(val, "MinDataStorageInTbs", &d.MinDataStorageInTbs) + delete(rawMsg, key) + case "minDbNodeStoragePerNodeInGbs": + err = unpopulate(val, "MinDbNodeStoragePerNodeInGbs", &d.MinDbNodeStoragePerNodeInGbs) + delete(rawMsg, key) + case "minMemoryPerNodeInGbs": + err = unpopulate(val, "MinMemoryPerNodeInGbs", &d.MinMemoryPerNodeInGbs) + delete(rawMsg, key) + case "minStorageCount": + err = unpopulate(val, "MinStorageCount", &d.MinStorageCount) + delete(rawMsg, key) + case "minimumCoreCount": + err = unpopulate(val, "MinimumCoreCount", &d.MinimumCoreCount) + delete(rawMsg, key) + case "minimumNodeCount": + err = unpopulate(val, "MinimumNodeCount", &d.MinimumNodeCount) + delete(rawMsg, key) + case "runtimeMinimumCoreCount": + err = unpopulate(val, "RuntimeMinimumCoreCount", &d.RuntimeMinimumCoreCount) + delete(rawMsg, key) + case "shapeFamily": + err = unpopulate(val, "ShapeFamily", &d.ShapeFamily) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EstimatedPatchingTime. +func (e EstimatedPatchingTime) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "estimatedDbServerPatchingTime", e.EstimatedDbServerPatchingTime) + populate(objectMap, "estimatedNetworkSwitchesPatchingTime", e.EstimatedNetworkSwitchesPatchingTime) + populate(objectMap, "estimatedStorageServerPatchingTime", e.EstimatedStorageServerPatchingTime) + populate(objectMap, "totalEstimatedPatchingTime", e.TotalEstimatedPatchingTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EstimatedPatchingTime. +func (e *EstimatedPatchingTime) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "estimatedDbServerPatchingTime": + err = unpopulate(val, "EstimatedDbServerPatchingTime", &e.EstimatedDbServerPatchingTime) + delete(rawMsg, key) + case "estimatedNetworkSwitchesPatchingTime": + err = unpopulate(val, "EstimatedNetworkSwitchesPatchingTime", &e.EstimatedNetworkSwitchesPatchingTime) + delete(rawMsg, key) + case "estimatedStorageServerPatchingTime": + err = unpopulate(val, "EstimatedStorageServerPatchingTime", &e.EstimatedStorageServerPatchingTime) + delete(rawMsg, key) + case "totalEstimatedPatchingTime": + err = unpopulate(val, "TotalEstimatedPatchingTime", &e.TotalEstimatedPatchingTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExadataIormConfig. +func (e ExadataIormConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dbPlans", e.DbPlans) + populate(objectMap, "lifecycleDetails", e.LifecycleDetails) + populate(objectMap, "lifecycleState", e.LifecycleState) + populate(objectMap, "objective", e.Objective) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExadataIormConfig. +func (e *ExadataIormConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dbPlans": + err = unpopulate(val, "DbPlans", &e.DbPlans) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &e.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &e.LifecycleState) + delete(rawMsg, key) + case "objective": + err = unpopulate(val, "Objective", &e.Objective) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GenerateAutonomousDatabaseWalletDetails. +func (g GenerateAutonomousDatabaseWalletDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "generateType", g.GenerateType) + populate(objectMap, "isRegional", g.IsRegional) + populate(objectMap, "password", g.Password) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateAutonomousDatabaseWalletDetails. +func (g *GenerateAutonomousDatabaseWalletDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "generateType": + err = unpopulate(val, "GenerateType", &g.GenerateType) + delete(rawMsg, key) + case "isRegional": + err = unpopulate(val, "IsRegional", &g.IsRegional) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &g.Password) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GiVersion. +func (g GiVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GiVersion. +func (g *GiVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GiVersionListResult. +func (g GiVersionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GiVersionListResult. +func (g *GiVersionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GiVersionProperties. +func (g GiVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "version", g.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GiVersionProperties. +func (g *GiVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "version": + err = unpopulate(val, "Version", &g.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MaintenanceWindow. +func (m MaintenanceWindow) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customActionTimeoutInMins", m.CustomActionTimeoutInMins) + populate(objectMap, "daysOfWeek", m.DaysOfWeek) + populate(objectMap, "hoursOfDay", m.HoursOfDay) + populate(objectMap, "isCustomActionTimeoutEnabled", m.IsCustomActionTimeoutEnabled) + populate(objectMap, "isMonthlyPatchingEnabled", m.IsMonthlyPatchingEnabled) + populate(objectMap, "leadTimeInWeeks", m.LeadTimeInWeeks) + populate(objectMap, "months", m.Months) + populate(objectMap, "patchingMode", m.PatchingMode) + populate(objectMap, "preference", m.Preference) + populate(objectMap, "weeksOfMonth", m.WeeksOfMonth) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceWindow. +func (m *MaintenanceWindow) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customActionTimeoutInMins": + err = unpopulate(val, "CustomActionTimeoutInMins", &m.CustomActionTimeoutInMins) + delete(rawMsg, key) + case "daysOfWeek": + err = unpopulate(val, "DaysOfWeek", &m.DaysOfWeek) + delete(rawMsg, key) + case "hoursOfDay": + err = unpopulate(val, "HoursOfDay", &m.HoursOfDay) + delete(rawMsg, key) + case "isCustomActionTimeoutEnabled": + err = unpopulate(val, "IsCustomActionTimeoutEnabled", &m.IsCustomActionTimeoutEnabled) + delete(rawMsg, key) + case "isMonthlyPatchingEnabled": + err = unpopulate(val, "IsMonthlyPatchingEnabled", &m.IsMonthlyPatchingEnabled) + delete(rawMsg, key) + case "leadTimeInWeeks": + err = unpopulate(val, "LeadTimeInWeeks", &m.LeadTimeInWeeks) + delete(rawMsg, key) + case "months": + err = unpopulate(val, "Months", &m.Months) + delete(rawMsg, key) + case "patchingMode": + err = unpopulate(val, "PatchingMode", &m.PatchingMode) + delete(rawMsg, key) + case "preference": + err = unpopulate(val, "Preference", &m.Preference) + delete(rawMsg, key) + case "weeksOfMonth": + err = unpopulate(val, "WeeksOfMonth", &m.WeeksOfMonth) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Month. +func (m Month) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", m.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Month. +func (m *Month) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NSGCidr. +func (n NSGCidr) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinationPortRange", n.DestinationPortRange) + populate(objectMap, "source", n.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NSGCidr. +func (n *NSGCidr) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationPortRange": + err = unpopulate(val, "DestinationPortRange", &n.DestinationPortRange) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &n.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OracleSubscription. +func (o OracleSubscription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "plan", o.Plan) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OracleSubscription. +func (o *OracleSubscription) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "plan": + err = unpopulate(val, "Plan", &o.Plan) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OracleSubscriptionListResult. +func (o OracleSubscriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OracleSubscriptionListResult. +func (o *OracleSubscriptionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OracleSubscriptionProperties. +func (o OracleSubscriptionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cloudAccountId", o.CloudAccountID) + populate(objectMap, "cloudAccountState", o.CloudAccountState) + populate(objectMap, "intent", o.Intent) + populate(objectMap, "productCode", o.ProductCode) + populate(objectMap, "provisioningState", o.ProvisioningState) + populate(objectMap, "saasSubscriptionId", o.SaasSubscriptionID) + populate(objectMap, "termUnit", o.TermUnit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OracleSubscriptionProperties. +func (o *OracleSubscriptionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cloudAccountId": + err = unpopulate(val, "CloudAccountID", &o.CloudAccountID) + delete(rawMsg, key) + case "cloudAccountState": + err = unpopulate(val, "CloudAccountState", &o.CloudAccountState) + delete(rawMsg, key) + case "intent": + err = unpopulate(val, "Intent", &o.Intent) + delete(rawMsg, key) + case "productCode": + err = unpopulate(val, "ProductCode", &o.ProductCode) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + delete(rawMsg, key) + case "saasSubscriptionId": + err = unpopulate(val, "SaasSubscriptionID", &o.SaasSubscriptionID) + delete(rawMsg, key) + case "termUnit": + err = unpopulate(val, "TermUnit", &o.TermUnit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OracleSubscriptionUpdate. +func (o OracleSubscriptionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "plan", o.Plan) + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OracleSubscriptionUpdate. +func (o *OracleSubscriptionUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "plan": + err = unpopulate(val, "Plan", &o.Plan) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OracleSubscriptionUpdateProperties. +func (o OracleSubscriptionUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "intent", o.Intent) + populate(objectMap, "productCode", o.ProductCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OracleSubscriptionUpdateProperties. +func (o *OracleSubscriptionUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "intent": + err = unpopulate(val, "Intent", &o.Intent) + delete(rawMsg, key) + case "productCode": + err = unpopulate(val, "ProductCode", &o.ProductCode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PeerDbDetails. +func (p PeerDbDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "peerDbId", p.PeerDbID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PeerDbDetails. +func (p *PeerDbDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "peerDbId": + err = unpopulate(val, "PeerDbID", &p.PeerDbID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Plan. +func (p Plan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", p.Name) + populate(objectMap, "product", p.Product) + populate(objectMap, "promotionCode", p.PromotionCode) + populate(objectMap, "publisher", p.Publisher) + populate(objectMap, "version", p.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Plan. +func (p *Plan) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "product": + err = unpopulate(val, "Product", &p.Product) + delete(rawMsg, key) + case "promotionCode": + err = unpopulate(val, "PromotionCode", &p.PromotionCode) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &p.Publisher) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &p.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PortRange. +func (p PortRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "max", p.Max) + populate(objectMap, "min", p.Min) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PortRange. +func (p *PortRange) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "max": + err = unpopulate(val, "Max", &p.Max) + delete(rawMsg, key) + case "min": + err = unpopulate(val, "Min", &p.Min) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateIPAddressProperties. +func (p PrivateIPAddressProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "hostnameLabel", p.HostnameLabel) + populate(objectMap, "ipAddress", p.IPAddress) + populate(objectMap, "ocid", p.Ocid) + populate(objectMap, "subnetId", p.SubnetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateIPAddressProperties. +func (p *PrivateIPAddressProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "hostnameLabel": + err = unpopulate(val, "HostnameLabel", &p.HostnameLabel) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &p.IPAddress) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &p.Ocid) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &p.SubnetID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateIPAddressesFilter. +func (p PrivateIPAddressesFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "subnetId", p.SubnetID) + populate(objectMap, "vnicId", p.VnicID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateIPAddressesFilter. +func (p *PrivateIPAddressesFilter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "subnetId": + err = unpopulate(val, "SubnetID", &p.SubnetID) + delete(rawMsg, key) + case "vnicId": + err = unpopulate(val, "VnicID", &p.VnicID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProfileType. +func (p ProfileType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "consumerGroup", p.ConsumerGroup) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "hostFormat", p.HostFormat) + populate(objectMap, "isRegional", p.IsRegional) + populate(objectMap, "protocol", p.Protocol) + populate(objectMap, "sessionMode", p.SessionMode) + populate(objectMap, "syntaxFormat", p.SyntaxFormat) + populate(objectMap, "tlsAuthentication", p.TLSAuthentication) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProfileType. +func (p *ProfileType) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "consumerGroup": + err = unpopulate(val, "ConsumerGroup", &p.ConsumerGroup) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "hostFormat": + err = unpopulate(val, "HostFormat", &p.HostFormat) + delete(rawMsg, key) + case "isRegional": + err = unpopulate(val, "IsRegional", &p.IsRegional) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &p.Protocol) + delete(rawMsg, key) + case "sessionMode": + err = unpopulate(val, "SessionMode", &p.SessionMode) + delete(rawMsg, key) + case "syntaxFormat": + err = unpopulate(val, "SyntaxFormat", &p.SyntaxFormat) + delete(rawMsg, key) + case "tlsAuthentication": + err = unpopulate(val, "TLSAuthentication", &p.TLSAuthentication) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourcePlanTypeUpdate. +func (r ResourcePlanTypeUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", r.Name) + populate(objectMap, "product", r.Product) + populate(objectMap, "promotionCode", r.PromotionCode) + populate(objectMap, "publisher", r.Publisher) + populate(objectMap, "version", r.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourcePlanTypeUpdate. +func (r *ResourcePlanTypeUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "product": + err = unpopulate(val, "Product", &r.Product) + delete(rawMsg, key) + case "promotionCode": + err = unpopulate(val, "PromotionCode", &r.PromotionCode) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &r.Publisher) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &r.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SaasSubscriptionDetails. +func (s SaasSubscriptionDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "isAutoRenew", s.IsAutoRenew) + populate(objectMap, "isFreeTrial", s.IsFreeTrial) + populate(objectMap, "offerId", s.OfferID) + populate(objectMap, "planId", s.PlanID) + populate(objectMap, "publisherId", s.PublisherID) + populate(objectMap, "purchaserEmailId", s.PurchaserEmailID) + populate(objectMap, "purchaserTenantId", s.PurchaserTenantID) + populate(objectMap, "saasSubscriptionStatus", s.SaasSubscriptionStatus) + populate(objectMap, "subscriptionName", s.SubscriptionName) + populate(objectMap, "termUnit", s.TermUnit) + populateDateTimeRFC3339(objectMap, "timeCreated", s.TimeCreated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SaasSubscriptionDetails. +func (s *SaasSubscriptionDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "isAutoRenew": + err = unpopulate(val, "IsAutoRenew", &s.IsAutoRenew) + delete(rawMsg, key) + case "isFreeTrial": + err = unpopulate(val, "IsFreeTrial", &s.IsFreeTrial) + delete(rawMsg, key) + case "offerId": + err = unpopulate(val, "OfferID", &s.OfferID) + delete(rawMsg, key) + case "planId": + err = unpopulate(val, "PlanID", &s.PlanID) + delete(rawMsg, key) + case "publisherId": + err = unpopulate(val, "PublisherID", &s.PublisherID) + delete(rawMsg, key) + case "purchaserEmailId": + err = unpopulate(val, "PurchaserEmailID", &s.PurchaserEmailID) + delete(rawMsg, key) + case "purchaserTenantId": + err = unpopulate(val, "PurchaserTenantID", &s.PurchaserTenantID) + delete(rawMsg, key) + case "saasSubscriptionStatus": + err = unpopulate(val, "SaasSubscriptionStatus", &s.SaasSubscriptionStatus) + delete(rawMsg, key) + case "subscriptionName": + err = unpopulate(val, "SubscriptionName", &s.SubscriptionName) + delete(rawMsg, key) + case "termUnit": + err = unpopulate(val, "TermUnit", &s.TermUnit) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &s.TimeCreated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledOperationsType. +func (s ScheduledOperationsType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dayOfWeek", s.DayOfWeek) + populate(objectMap, "scheduledStartTime", s.ScheduledStartTime) + populate(objectMap, "scheduledStopTime", s.ScheduledStopTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledOperationsType. +func (s *ScheduledOperationsType) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dayOfWeek": + err = unpopulate(val, "DayOfWeek", &s.DayOfWeek) + delete(rawMsg, key) + case "scheduledStartTime": + err = unpopulate(val, "ScheduledStartTime", &s.ScheduledStartTime) + delete(rawMsg, key) + case "scheduledStopTime": + err = unpopulate(val, "ScheduledStopTime", &s.ScheduledStopTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledOperationsTypeUpdate. +func (s ScheduledOperationsTypeUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dayOfWeek", s.DayOfWeek) + populate(objectMap, "scheduledStartTime", s.ScheduledStartTime) + populate(objectMap, "scheduledStopTime", s.ScheduledStopTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledOperationsTypeUpdate. +func (s *ScheduledOperationsTypeUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dayOfWeek": + err = unpopulate(val, "DayOfWeek", &s.DayOfWeek) + delete(rawMsg, key) + case "scheduledStartTime": + err = unpopulate(val, "ScheduledStartTime", &s.ScheduledStartTime) + delete(rawMsg, key) + case "scheduledStopTime": + err = unpopulate(val, "ScheduledStopTime", &s.ScheduledStopTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkAddress. +func (v VirtualNetworkAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkAddress. +func (v *VirtualNetworkAddress) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkAddressListResult. +func (v VirtualNetworkAddressListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkAddressListResult. +func (v *VirtualNetworkAddressListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkAddressProperties. +func (v VirtualNetworkAddressProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "domain", v.Domain) + populate(objectMap, "ipAddress", v.IPAddress) + populate(objectMap, "lifecycleDetails", v.LifecycleDetails) + populate(objectMap, "lifecycleState", v.LifecycleState) + populate(objectMap, "ocid", v.Ocid) + populate(objectMap, "provisioningState", v.ProvisioningState) + populateDateTimeRFC3339(objectMap, "timeAssigned", v.TimeAssigned) + populate(objectMap, "vmOcid", v.VMOcid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkAddressProperties. +func (v *VirtualNetworkAddressProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "domain": + err = unpopulate(val, "Domain", &v.Domain) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &v.IPAddress) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &v.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &v.LifecycleState) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &v.Ocid) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "timeAssigned": + err = unpopulateDateTimeRFC3339(val, "TimeAssigned", &v.TimeAssigned) + delete(rawMsg, key) + case "vmOcid": + err = unpopulate(val, "VMOcid", &v.VMOcid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client.go new file mode 100644 index 000000000000..b19ae4329b48 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2023-09-01-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Oracle.Database/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/options.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/options.go new file mode 100644 index 000000000000..03d40217378c --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/options.go @@ -0,0 +1,392 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +// AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.BeginCreateOrUpdate +// method. +type AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AutonomousDatabaseBackupsClientBeginDeleteOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.BeginDelete +// method. +type AutonomousDatabaseBackupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AutonomousDatabaseBackupsClientBeginUpdateOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.BeginUpdate +// method. +type AutonomousDatabaseBackupsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AutonomousDatabaseBackupsClientGetOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.Get +// method. +type AutonomousDatabaseBackupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AutonomousDatabaseBackupsClientListByAutonomousDatabaseOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager +// method. +type AutonomousDatabaseBackupsClientListByAutonomousDatabaseOptions struct { + // placeholder for future optional parameters +} + +// AutonomousDatabaseCharacterSetsClientGetOptions contains the optional parameters for the AutonomousDatabaseCharacterSetsClient.Get +// method. +type AutonomousDatabaseCharacterSetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AutonomousDatabaseCharacterSetsClientListByLocationOptions contains the optional parameters for the AutonomousDatabaseCharacterSetsClient.NewListByLocationPager +// method. +type AutonomousDatabaseCharacterSetsClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// AutonomousDatabaseNationalCharacterSetsClientGetOptions contains the optional parameters for the AutonomousDatabaseNationalCharacterSetsClient.Get +// method. +type AutonomousDatabaseNationalCharacterSetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AutonomousDatabaseNationalCharacterSetsClientListByLocationOptions contains the optional parameters for the AutonomousDatabaseNationalCharacterSetsClient.NewListByLocationPager +// method. +type AutonomousDatabaseNationalCharacterSetsClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// AutonomousDatabaseVersionsClientGetOptions contains the optional parameters for the AutonomousDatabaseVersionsClient.Get +// method. +type AutonomousDatabaseVersionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AutonomousDatabaseVersionsClientListByLocationOptions contains the optional parameters for the AutonomousDatabaseVersionsClient.NewListByLocationPager +// method. +type AutonomousDatabaseVersionsClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// AutonomousDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the AutonomousDatabasesClient.BeginCreateOrUpdate +// method. +type AutonomousDatabasesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AutonomousDatabasesClientBeginDeleteOptions contains the optional parameters for the AutonomousDatabasesClient.BeginDelete +// method. +type AutonomousDatabasesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AutonomousDatabasesClientBeginFailoverOptions contains the optional parameters for the AutonomousDatabasesClient.BeginFailover +// method. +type AutonomousDatabasesClientBeginFailoverOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AutonomousDatabasesClientBeginSwitchoverOptions contains the optional parameters for the AutonomousDatabasesClient.BeginSwitchover +// method. +type AutonomousDatabasesClientBeginSwitchoverOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AutonomousDatabasesClientBeginUpdateOptions contains the optional parameters for the AutonomousDatabasesClient.BeginUpdate +// method. +type AutonomousDatabasesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AutonomousDatabasesClientGenerateWalletOptions contains the optional parameters for the AutonomousDatabasesClient.GenerateWallet +// method. +type AutonomousDatabasesClientGenerateWalletOptions struct { + // placeholder for future optional parameters +} + +// AutonomousDatabasesClientGetOptions contains the optional parameters for the AutonomousDatabasesClient.Get method. +type AutonomousDatabasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// AutonomousDatabasesClientListByResourceGroupOptions contains the optional parameters for the AutonomousDatabasesClient.NewListByResourceGroupPager +// method. +type AutonomousDatabasesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AutonomousDatabasesClientListBySubscriptionOptions contains the optional parameters for the AutonomousDatabasesClient.NewListBySubscriptionPager +// method. +type AutonomousDatabasesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginAddStorageCapacity +// method. +type CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginCreateOrUpdate +// method. +type CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudExadataInfrastructuresClientBeginDeleteOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginDelete +// method. +type CloudExadataInfrastructuresClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudExadataInfrastructuresClientBeginUpdateOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginUpdate +// method. +type CloudExadataInfrastructuresClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudExadataInfrastructuresClientGetOptions contains the optional parameters for the CloudExadataInfrastructuresClient.Get +// method. +type CloudExadataInfrastructuresClientGetOptions struct { + // placeholder for future optional parameters +} + +// CloudExadataInfrastructuresClientListByResourceGroupOptions contains the optional parameters for the CloudExadataInfrastructuresClient.NewListByResourceGroupPager +// method. +type CloudExadataInfrastructuresClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// CloudExadataInfrastructuresClientListBySubscriptionOptions contains the optional parameters for the CloudExadataInfrastructuresClient.NewListBySubscriptionPager +// method. +type CloudExadataInfrastructuresClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// CloudVMClustersClientBeginAddVMsOptions contains the optional parameters for the CloudVMClustersClient.BeginAddVMs method. +type CloudVMClustersClientBeginAddVMsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudVMClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudVMClustersClient.BeginCreateOrUpdate +// method. +type CloudVMClustersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudVMClustersClientBeginDeleteOptions contains the optional parameters for the CloudVMClustersClient.BeginDelete method. +type CloudVMClustersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudVMClustersClientBeginRemoveVMsOptions contains the optional parameters for the CloudVMClustersClient.BeginRemoveVMs +// method. +type CloudVMClustersClientBeginRemoveVMsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudVMClustersClientBeginUpdateOptions contains the optional parameters for the CloudVMClustersClient.BeginUpdate method. +type CloudVMClustersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudVMClustersClientGetOptions contains the optional parameters for the CloudVMClustersClient.Get method. +type CloudVMClustersClientGetOptions struct { + // placeholder for future optional parameters +} + +// CloudVMClustersClientListByResourceGroupOptions contains the optional parameters for the CloudVMClustersClient.NewListByResourceGroupPager +// method. +type CloudVMClustersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// CloudVMClustersClientListBySubscriptionOptions contains the optional parameters for the CloudVMClustersClient.NewListBySubscriptionPager +// method. +type CloudVMClustersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// CloudVMClustersClientListPrivateIPAddressesOptions contains the optional parameters for the CloudVMClustersClient.ListPrivateIPAddresses +// method. +type CloudVMClustersClientListPrivateIPAddressesOptions struct { + // placeholder for future optional parameters +} + +// DNSPrivateViewsClientGetOptions contains the optional parameters for the DNSPrivateViewsClient.Get method. +type DNSPrivateViewsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DNSPrivateViewsClientListByLocationOptions contains the optional parameters for the DNSPrivateViewsClient.NewListByLocationPager +// method. +type DNSPrivateViewsClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// DNSPrivateZonesClientGetOptions contains the optional parameters for the DNSPrivateZonesClient.Get method. +type DNSPrivateZonesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DNSPrivateZonesClientListByLocationOptions contains the optional parameters for the DNSPrivateZonesClient.NewListByLocationPager +// method. +type DNSPrivateZonesClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// DbNodesClientBeginActionOptions contains the optional parameters for the DbNodesClient.BeginAction method. +type DbNodesClientBeginActionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DbNodesClientGetOptions contains the optional parameters for the DbNodesClient.Get method. +type DbNodesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DbNodesClientListByCloudVMClusterOptions contains the optional parameters for the DbNodesClient.NewListByCloudVMClusterPager +// method. +type DbNodesClientListByCloudVMClusterOptions struct { + // placeholder for future optional parameters +} + +// DbServersClientGetOptions contains the optional parameters for the DbServersClient.Get method. +type DbServersClientGetOptions struct { + // placeholder for future optional parameters +} + +// DbServersClientListByCloudExadataInfrastructureOptions contains the optional parameters for the DbServersClient.NewListByCloudExadataInfrastructurePager +// method. +type DbServersClientListByCloudExadataInfrastructureOptions struct { + // placeholder for future optional parameters +} + +// DbSystemShapesClientGetOptions contains the optional parameters for the DbSystemShapesClient.Get method. +type DbSystemShapesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DbSystemShapesClientListByLocationOptions contains the optional parameters for the DbSystemShapesClient.NewListByLocationPager +// method. +type DbSystemShapesClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// GiVersionsClientGetOptions contains the optional parameters for the GiVersionsClient.Get method. +type GiVersionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// GiVersionsClientListByLocationOptions contains the optional parameters for the GiVersionsClient.NewListByLocationPager +// method. +type GiVersionsClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// OracleSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the OracleSubscriptionsClient.BeginCreateOrUpdate +// method. +type OracleSubscriptionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// OracleSubscriptionsClientBeginDeleteOptions contains the optional parameters for the OracleSubscriptionsClient.BeginDelete +// method. +type OracleSubscriptionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// OracleSubscriptionsClientBeginListActivationLinksOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListActivationLinks +// method. +type OracleSubscriptionsClientBeginListActivationLinksOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// OracleSubscriptionsClientBeginListCloudAccountDetailsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListCloudAccountDetails +// method. +type OracleSubscriptionsClientBeginListCloudAccountDetailsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListSaasSubscriptionDetails +// method. +type OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// OracleSubscriptionsClientBeginUpdateOptions contains the optional parameters for the OracleSubscriptionsClient.BeginUpdate +// method. +type OracleSubscriptionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// OracleSubscriptionsClientGetOptions contains the optional parameters for the OracleSubscriptionsClient.Get method. +type OracleSubscriptionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// OracleSubscriptionsClientListBySubscriptionOptions contains the optional parameters for the OracleSubscriptionsClient.NewListBySubscriptionPager +// method. +type OracleSubscriptionsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkAddressesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkAddressesClient.BeginCreateOrUpdate +// method. +type VirtualNetworkAddressesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkAddressesClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkAddressesClient.BeginDelete +// method. +type VirtualNetworkAddressesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkAddressesClientGetOptions contains the optional parameters for the VirtualNetworkAddressesClient.Get method. +type VirtualNetworkAddressesClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkAddressesClientListByCloudVMClusterOptions contains the optional parameters for the VirtualNetworkAddressesClient.NewListByCloudVMClusterPager +// method. +type VirtualNetworkAddressesClientListByCloudVMClusterOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client.go new file mode 100644 index 000000000000..4d178c5655e9 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client.go @@ -0,0 +1,563 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// OracleSubscriptionsClient contains the methods for the OracleSubscriptions group. +// Don't use this type directly, use NewOracleSubscriptionsClient() instead. +type OracleSubscriptionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewOracleSubscriptionsClient creates a new instance of OracleSubscriptionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOracleSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OracleSubscriptionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OracleSubscriptionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a OracleSubscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resource - Resource create parameters. +// - options - OracleSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the OracleSubscriptionsClient.BeginCreateOrUpdate +// method. +func (client *OracleSubscriptionsClient) BeginCreateOrUpdate(ctx context.Context, resource OracleSubscription, options *OracleSubscriptionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[OracleSubscriptionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OracleSubscriptionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a OracleSubscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *OracleSubscriptionsClient) createOrUpdate(ctx context.Context, resource OracleSubscription, options *OracleSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "OracleSubscriptionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *OracleSubscriptionsClient) createOrUpdateCreateRequest(ctx context.Context, resource OracleSubscription, options *OracleSubscriptionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a OracleSubscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - options - OracleSubscriptionsClientBeginDeleteOptions contains the optional parameters for the OracleSubscriptionsClient.BeginDelete +// method. +func (client *OracleSubscriptionsClient) BeginDelete(ctx context.Context, options *OracleSubscriptionsClientBeginDeleteOptions) (*runtime.Poller[OracleSubscriptionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OracleSubscriptionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a OracleSubscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *OracleSubscriptionsClient) deleteOperation(ctx context.Context, options *OracleSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "OracleSubscriptionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *OracleSubscriptionsClient) deleteCreateRequest(ctx context.Context, options *OracleSubscriptionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a OracleSubscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - options - OracleSubscriptionsClientGetOptions contains the optional parameters for the OracleSubscriptionsClient.Get method. +func (client *OracleSubscriptionsClient) Get(ctx context.Context, options *OracleSubscriptionsClientGetOptions) (OracleSubscriptionsClientGetResponse, error) { + var err error + const operationName = "OracleSubscriptionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, options) + if err != nil { + return OracleSubscriptionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OracleSubscriptionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OracleSubscriptionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *OracleSubscriptionsClient) getCreateRequest(ctx context.Context, options *OracleSubscriptionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OracleSubscriptionsClient) getHandleResponse(resp *http.Response) (OracleSubscriptionsClientGetResponse, error) { + result := OracleSubscriptionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OracleSubscription); err != nil { + return OracleSubscriptionsClientGetResponse{}, err + } + return result, nil +} + +// BeginListActivationLinks - List Activation Links +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - options - OracleSubscriptionsClientBeginListActivationLinksOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListActivationLinks +// method. +func (client *OracleSubscriptionsClient) BeginListActivationLinks(ctx context.Context, options *OracleSubscriptionsClientBeginListActivationLinksOptions) (*runtime.Poller[OracleSubscriptionsClientListActivationLinksResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listActivationLinks(ctx, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientListActivationLinksResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OracleSubscriptionsClientListActivationLinksResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ListActivationLinks - List Activation Links +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *OracleSubscriptionsClient) listActivationLinks(ctx context.Context, options *OracleSubscriptionsClientBeginListActivationLinksOptions) (*http.Response, error) { + var err error + const operationName = "OracleSubscriptionsClient.BeginListActivationLinks" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listActivationLinksCreateRequest(ctx, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// listActivationLinksCreateRequest creates the ListActivationLinks request. +func (client *OracleSubscriptionsClient) listActivationLinksCreateRequest(ctx context.Context, options *OracleSubscriptionsClientBeginListActivationLinksOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/listActivationLinks" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListBySubscriptionPager - List OracleSubscription resources by subscription ID +// +// Generated from API version 2023-09-01-preview +// - options - OracleSubscriptionsClientListBySubscriptionOptions contains the optional parameters for the OracleSubscriptionsClient.NewListBySubscriptionPager +// method. +func (client *OracleSubscriptionsClient) NewListBySubscriptionPager(options *OracleSubscriptionsClientListBySubscriptionOptions) *runtime.Pager[OracleSubscriptionsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[OracleSubscriptionsClientListBySubscriptionResponse]{ + More: func(page OracleSubscriptionsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OracleSubscriptionsClientListBySubscriptionResponse) (OracleSubscriptionsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OracleSubscriptionsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return OracleSubscriptionsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *OracleSubscriptionsClient) listBySubscriptionCreateRequest(ctx context.Context, options *OracleSubscriptionsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *OracleSubscriptionsClient) listBySubscriptionHandleResponse(resp *http.Response) (OracleSubscriptionsClientListBySubscriptionResponse, error) { + result := OracleSubscriptionsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OracleSubscriptionListResult); err != nil { + return OracleSubscriptionsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginListCloudAccountDetails - List Cloud Account Details +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - options - OracleSubscriptionsClientBeginListCloudAccountDetailsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListCloudAccountDetails +// method. +func (client *OracleSubscriptionsClient) BeginListCloudAccountDetails(ctx context.Context, options *OracleSubscriptionsClientBeginListCloudAccountDetailsOptions) (*runtime.Poller[OracleSubscriptionsClientListCloudAccountDetailsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listCloudAccountDetails(ctx, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientListCloudAccountDetailsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OracleSubscriptionsClientListCloudAccountDetailsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ListCloudAccountDetails - List Cloud Account Details +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *OracleSubscriptionsClient) listCloudAccountDetails(ctx context.Context, options *OracleSubscriptionsClientBeginListCloudAccountDetailsOptions) (*http.Response, error) { + var err error + const operationName = "OracleSubscriptionsClient.BeginListCloudAccountDetails" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCloudAccountDetailsCreateRequest(ctx, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// listCloudAccountDetailsCreateRequest creates the ListCloudAccountDetails request. +func (client *OracleSubscriptionsClient) listCloudAccountDetailsCreateRequest(ctx context.Context, options *OracleSubscriptionsClientBeginListCloudAccountDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/listCloudAccountDetails" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginListSaasSubscriptionDetails - List Saas Subscription Details +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - options - OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListSaasSubscriptionDetails +// method. +func (client *OracleSubscriptionsClient) BeginListSaasSubscriptionDetails(ctx context.Context, options *OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions) (*runtime.Poller[OracleSubscriptionsClientListSaasSubscriptionDetailsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listSaasSubscriptionDetails(ctx, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientListSaasSubscriptionDetailsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OracleSubscriptionsClientListSaasSubscriptionDetailsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ListSaasSubscriptionDetails - List Saas Subscription Details +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *OracleSubscriptionsClient) listSaasSubscriptionDetails(ctx context.Context, options *OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions) (*http.Response, error) { + var err error + const operationName = "OracleSubscriptionsClient.BeginListSaasSubscriptionDetails" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listSaasSubscriptionDetailsCreateRequest(ctx, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// listSaasSubscriptionDetailsCreateRequest creates the ListSaasSubscriptionDetails request. +func (client *OracleSubscriptionsClient) listSaasSubscriptionDetailsCreateRequest(ctx context.Context, options *OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/listSaasSubscriptionDetails" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Update a OracleSubscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - properties - The resource properties to be updated. +// - options - OracleSubscriptionsClientBeginUpdateOptions contains the optional parameters for the OracleSubscriptionsClient.BeginUpdate +// method. +func (client *OracleSubscriptionsClient) BeginUpdate(ctx context.Context, properties OracleSubscriptionUpdate, options *OracleSubscriptionsClientBeginUpdateOptions) (*runtime.Poller[OracleSubscriptionsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OracleSubscriptionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a OracleSubscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *OracleSubscriptionsClient) update(ctx context.Context, properties OracleSubscriptionUpdate, options *OracleSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "OracleSubscriptionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *OracleSubscriptionsClient) updateCreateRequest(ctx context.Context, properties OracleSubscriptionUpdate, options *OracleSubscriptionsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/polymorphic_helpers.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/polymorphic_helpers.go new file mode 100644 index 000000000000..63ffe40ed9bf --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/polymorphic_helpers.go @@ -0,0 +1,34 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import "encoding/json" + +func unmarshalAutonomousDatabaseBasePropertiesClassification(rawMsg json.RawMessage) (AutonomousDatabaseBasePropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b AutonomousDatabaseBasePropertiesClassification + switch m["dataBaseType"] { + case string(DataBaseTypeClone): + b = &AutonomousDatabaseCloneProperties{} + case string(DataBaseTypeRegular): + b = &AutonomousDatabaseProperties{} + default: + b = &AutonomousDatabaseBaseProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/responses.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/responses.go new file mode 100644 index 000000000000..bb1e66edc589 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/responses.go @@ -0,0 +1,375 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +// AutonomousDatabaseBackupsClientCreateOrUpdateResponse contains the response from method AutonomousDatabaseBackupsClient.BeginCreateOrUpdate. +type AutonomousDatabaseBackupsClientCreateOrUpdateResponse struct { + // AutonomousDatabaseBackup resource definition + AutonomousDatabaseBackup +} + +// AutonomousDatabaseBackupsClientDeleteResponse contains the response from method AutonomousDatabaseBackupsClient.BeginDelete. +type AutonomousDatabaseBackupsClientDeleteResponse struct { + // placeholder for future response values +} + +// AutonomousDatabaseBackupsClientGetResponse contains the response from method AutonomousDatabaseBackupsClient.Get. +type AutonomousDatabaseBackupsClientGetResponse struct { + // AutonomousDatabaseBackup resource definition + AutonomousDatabaseBackup +} + +// AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse contains the response from method AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager. +type AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse struct { + // The response of a AutonomousDatabaseBackup list operation. + AutonomousDatabaseBackupListResult +} + +// AutonomousDatabaseBackupsClientUpdateResponse contains the response from method AutonomousDatabaseBackupsClient.BeginUpdate. +type AutonomousDatabaseBackupsClientUpdateResponse struct { + // AutonomousDatabaseBackup resource definition + AutonomousDatabaseBackup +} + +// AutonomousDatabaseCharacterSetsClientGetResponse contains the response from method AutonomousDatabaseCharacterSetsClient.Get. +type AutonomousDatabaseCharacterSetsClientGetResponse struct { + // AutonomousDatabaseCharacterSets resource definition + AutonomousDatabaseCharacterSet +} + +// AutonomousDatabaseCharacterSetsClientListByLocationResponse contains the response from method AutonomousDatabaseCharacterSetsClient.NewListByLocationPager. +type AutonomousDatabaseCharacterSetsClientListByLocationResponse struct { + // The response of a AutonomousDatabaseCharacterSet list operation. + AutonomousDatabaseCharacterSetListResult +} + +// AutonomousDatabaseNationalCharacterSetsClientGetResponse contains the response from method AutonomousDatabaseNationalCharacterSetsClient.Get. +type AutonomousDatabaseNationalCharacterSetsClientGetResponse struct { + // AutonomousDatabaseNationalCharacterSets resource definition + AutonomousDatabaseNationalCharacterSet +} + +// AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse contains the response from method AutonomousDatabaseNationalCharacterSetsClient.NewListByLocationPager. +type AutonomousDatabaseNationalCharacterSetsClientListByLocationResponse struct { + // The response of a AutonomousDatabaseNationalCharacterSet list operation. + AutonomousDatabaseNationalCharacterSetListResult +} + +// AutonomousDatabaseVersionsClientGetResponse contains the response from method AutonomousDatabaseVersionsClient.Get. +type AutonomousDatabaseVersionsClientGetResponse struct { + // AutonomousDbVersion resource definition + AutonomousDbVersion +} + +// AutonomousDatabaseVersionsClientListByLocationResponse contains the response from method AutonomousDatabaseVersionsClient.NewListByLocationPager. +type AutonomousDatabaseVersionsClientListByLocationResponse struct { + // The response of a AutonomousDbVersion list operation. + AutonomousDbVersionListResult +} + +// AutonomousDatabasesClientCreateOrUpdateResponse contains the response from method AutonomousDatabasesClient.BeginCreateOrUpdate. +type AutonomousDatabasesClientCreateOrUpdateResponse struct { + // Autonomous Database resource model. + AutonomousDatabase +} + +// AutonomousDatabasesClientDeleteResponse contains the response from method AutonomousDatabasesClient.BeginDelete. +type AutonomousDatabasesClientDeleteResponse struct { + // placeholder for future response values +} + +// AutonomousDatabasesClientFailoverResponse contains the response from method AutonomousDatabasesClient.BeginFailover. +type AutonomousDatabasesClientFailoverResponse struct { + // Autonomous Database resource model. + AutonomousDatabase +} + +// AutonomousDatabasesClientGenerateWalletResponse contains the response from method AutonomousDatabasesClient.GenerateWallet. +type AutonomousDatabasesClientGenerateWalletResponse struct { + // Autonomous Database Wallet File resource model. + AutonomousDatabaseWalletFile +} + +// AutonomousDatabasesClientGetResponse contains the response from method AutonomousDatabasesClient.Get. +type AutonomousDatabasesClientGetResponse struct { + // Autonomous Database resource model. + AutonomousDatabase +} + +// AutonomousDatabasesClientListByResourceGroupResponse contains the response from method AutonomousDatabasesClient.NewListByResourceGroupPager. +type AutonomousDatabasesClientListByResourceGroupResponse struct { + // The response of a AutonomousDatabase list operation. + AutonomousDatabaseListResult +} + +// AutonomousDatabasesClientListBySubscriptionResponse contains the response from method AutonomousDatabasesClient.NewListBySubscriptionPager. +type AutonomousDatabasesClientListBySubscriptionResponse struct { + // The response of a AutonomousDatabase list operation. + AutonomousDatabaseListResult +} + +// AutonomousDatabasesClientSwitchoverResponse contains the response from method AutonomousDatabasesClient.BeginSwitchover. +type AutonomousDatabasesClientSwitchoverResponse struct { + // Autonomous Database resource model. + AutonomousDatabase +} + +// AutonomousDatabasesClientUpdateResponse contains the response from method AutonomousDatabasesClient.BeginUpdate. +type AutonomousDatabasesClientUpdateResponse struct { + // Autonomous Database resource model. + AutonomousDatabase +} + +// CloudExadataInfrastructuresClientAddStorageCapacityResponse contains the response from method CloudExadataInfrastructuresClient.BeginAddStorageCapacity. +type CloudExadataInfrastructuresClientAddStorageCapacityResponse struct { + // CloudExadataInfrastructure resource definition + CloudExadataInfrastructure +} + +// CloudExadataInfrastructuresClientCreateOrUpdateResponse contains the response from method CloudExadataInfrastructuresClient.BeginCreateOrUpdate. +type CloudExadataInfrastructuresClientCreateOrUpdateResponse struct { + // CloudExadataInfrastructure resource definition + CloudExadataInfrastructure +} + +// CloudExadataInfrastructuresClientDeleteResponse contains the response from method CloudExadataInfrastructuresClient.BeginDelete. +type CloudExadataInfrastructuresClientDeleteResponse struct { + // placeholder for future response values +} + +// CloudExadataInfrastructuresClientGetResponse contains the response from method CloudExadataInfrastructuresClient.Get. +type CloudExadataInfrastructuresClientGetResponse struct { + // CloudExadataInfrastructure resource definition + CloudExadataInfrastructure +} + +// CloudExadataInfrastructuresClientListByResourceGroupResponse contains the response from method CloudExadataInfrastructuresClient.NewListByResourceGroupPager. +type CloudExadataInfrastructuresClientListByResourceGroupResponse struct { + // The response of a CloudExadataInfrastructure list operation. + CloudExadataInfrastructureListResult +} + +// CloudExadataInfrastructuresClientListBySubscriptionResponse contains the response from method CloudExadataInfrastructuresClient.NewListBySubscriptionPager. +type CloudExadataInfrastructuresClientListBySubscriptionResponse struct { + // The response of a CloudExadataInfrastructure list operation. + CloudExadataInfrastructureListResult +} + +// CloudExadataInfrastructuresClientUpdateResponse contains the response from method CloudExadataInfrastructuresClient.BeginUpdate. +type CloudExadataInfrastructuresClientUpdateResponse struct { + // CloudExadataInfrastructure resource definition + CloudExadataInfrastructure +} + +// CloudVMClustersClientAddVMsResponse contains the response from method CloudVMClustersClient.BeginAddVMs. +type CloudVMClustersClientAddVMsResponse struct { + // CloudVmCluster resource definition + CloudVMCluster +} + +// CloudVMClustersClientCreateOrUpdateResponse contains the response from method CloudVMClustersClient.BeginCreateOrUpdate. +type CloudVMClustersClientCreateOrUpdateResponse struct { + // CloudVmCluster resource definition + CloudVMCluster +} + +// CloudVMClustersClientDeleteResponse contains the response from method CloudVMClustersClient.BeginDelete. +type CloudVMClustersClientDeleteResponse struct { + // placeholder for future response values +} + +// CloudVMClustersClientGetResponse contains the response from method CloudVMClustersClient.Get. +type CloudVMClustersClientGetResponse struct { + // CloudVmCluster resource definition + CloudVMCluster +} + +// CloudVMClustersClientListByResourceGroupResponse contains the response from method CloudVMClustersClient.NewListByResourceGroupPager. +type CloudVMClustersClientListByResourceGroupResponse struct { + // The response of a CloudVmCluster list operation. + CloudVMClusterListResult +} + +// CloudVMClustersClientListBySubscriptionResponse contains the response from method CloudVMClustersClient.NewListBySubscriptionPager. +type CloudVMClustersClientListBySubscriptionResponse struct { + // The response of a CloudVmCluster list operation. + CloudVMClusterListResult +} + +// CloudVMClustersClientListPrivateIPAddressesResponse contains the response from method CloudVMClustersClient.ListPrivateIPAddresses. +type CloudVMClustersClientListPrivateIPAddressesResponse struct { + // Array of PrivateIpAddressProperties + PrivateIPAddressPropertiesArray []*PrivateIPAddressProperties +} + +// CloudVMClustersClientRemoveVMsResponse contains the response from method CloudVMClustersClient.BeginRemoveVMs. +type CloudVMClustersClientRemoveVMsResponse struct { + // CloudVmCluster resource definition + CloudVMCluster +} + +// CloudVMClustersClientUpdateResponse contains the response from method CloudVMClustersClient.BeginUpdate. +type CloudVMClustersClientUpdateResponse struct { + // CloudVmCluster resource definition + CloudVMCluster +} + +// DNSPrivateViewsClientGetResponse contains the response from method DNSPrivateViewsClient.Get. +type DNSPrivateViewsClientGetResponse struct { + // DnsPrivateView resource definition + DNSPrivateView +} + +// DNSPrivateViewsClientListByLocationResponse contains the response from method DNSPrivateViewsClient.NewListByLocationPager. +type DNSPrivateViewsClientListByLocationResponse struct { + // The response of a DnsPrivateView list operation. + DNSPrivateViewListResult +} + +// DNSPrivateZonesClientGetResponse contains the response from method DNSPrivateZonesClient.Get. +type DNSPrivateZonesClientGetResponse struct { + // DnsPrivateZone resource definition + DNSPrivateZone +} + +// DNSPrivateZonesClientListByLocationResponse contains the response from method DNSPrivateZonesClient.NewListByLocationPager. +type DNSPrivateZonesClientListByLocationResponse struct { + // The response of a DnsPrivateZone list operation. + DNSPrivateZoneListResult +} + +// DbNodesClientActionResponse contains the response from method DbNodesClient.BeginAction. +type DbNodesClientActionResponse struct { + // The DbNode resource belonging to vmCluster + DbNode +} + +// DbNodesClientGetResponse contains the response from method DbNodesClient.Get. +type DbNodesClientGetResponse struct { + // The DbNode resource belonging to vmCluster + DbNode +} + +// DbNodesClientListByCloudVMClusterResponse contains the response from method DbNodesClient.NewListByCloudVMClusterPager. +type DbNodesClientListByCloudVMClusterResponse struct { + // The response of a DbNode list operation. + DbNodeListResult +} + +// DbServersClientGetResponse contains the response from method DbServersClient.Get. +type DbServersClientGetResponse struct { + // DbServer resource model + DbServer +} + +// DbServersClientListByCloudExadataInfrastructureResponse contains the response from method DbServersClient.NewListByCloudExadataInfrastructurePager. +type DbServersClientListByCloudExadataInfrastructureResponse struct { + // The response of a DbServer list operation. + DbServerListResult +} + +// DbSystemShapesClientGetResponse contains the response from method DbSystemShapesClient.Get. +type DbSystemShapesClientGetResponse struct { + // DbSystemShape resource definition + DbSystemShape +} + +// DbSystemShapesClientListByLocationResponse contains the response from method DbSystemShapesClient.NewListByLocationPager. +type DbSystemShapesClientListByLocationResponse struct { + // The response of a DbSystemShape list operation. + DbSystemShapeListResult +} + +// GiVersionsClientGetResponse contains the response from method GiVersionsClient.Get. +type GiVersionsClientGetResponse struct { + // GiVersion resource definition + GiVersion +} + +// GiVersionsClientListByLocationResponse contains the response from method GiVersionsClient.NewListByLocationPager. +type GiVersionsClientListByLocationResponse struct { + // The response of a GiVersion list operation. + GiVersionListResult +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} + +// OracleSubscriptionsClientCreateOrUpdateResponse contains the response from method OracleSubscriptionsClient.BeginCreateOrUpdate. +type OracleSubscriptionsClientCreateOrUpdateResponse struct { + // OracleSubscription resource definition + OracleSubscription +} + +// OracleSubscriptionsClientDeleteResponse contains the response from method OracleSubscriptionsClient.BeginDelete. +type OracleSubscriptionsClientDeleteResponse struct { + // placeholder for future response values +} + +// OracleSubscriptionsClientGetResponse contains the response from method OracleSubscriptionsClient.Get. +type OracleSubscriptionsClientGetResponse struct { + // OracleSubscription resource definition + OracleSubscription +} + +// OracleSubscriptionsClientListActivationLinksResponse contains the response from method OracleSubscriptionsClient.BeginListActivationLinks. +type OracleSubscriptionsClientListActivationLinksResponse struct { + // Activation Links model + ActivationLinks +} + +// OracleSubscriptionsClientListBySubscriptionResponse contains the response from method OracleSubscriptionsClient.NewListBySubscriptionPager. +type OracleSubscriptionsClientListBySubscriptionResponse struct { + // The response of a OracleSubscription list operation. + OracleSubscriptionListResult +} + +// OracleSubscriptionsClientListCloudAccountDetailsResponse contains the response from method OracleSubscriptionsClient.BeginListCloudAccountDetails. +type OracleSubscriptionsClientListCloudAccountDetailsResponse struct { + // Cloud Account Details model + CloudAccountDetails +} + +// OracleSubscriptionsClientListSaasSubscriptionDetailsResponse contains the response from method OracleSubscriptionsClient.BeginListSaasSubscriptionDetails. +type OracleSubscriptionsClientListSaasSubscriptionDetailsResponse struct { + // SaaS Subscription Details model + SaasSubscriptionDetails +} + +// OracleSubscriptionsClientUpdateResponse contains the response from method OracleSubscriptionsClient.BeginUpdate. +type OracleSubscriptionsClientUpdateResponse struct { + // OracleSubscription resource definition + OracleSubscription +} + +// VirtualNetworkAddressesClientCreateOrUpdateResponse contains the response from method VirtualNetworkAddressesClient.BeginCreateOrUpdate. +type VirtualNetworkAddressesClientCreateOrUpdateResponse struct { + // Virtual IP resource belonging to a vm cluster resource. + VirtualNetworkAddress +} + +// VirtualNetworkAddressesClientDeleteResponse contains the response from method VirtualNetworkAddressesClient.BeginDelete. +type VirtualNetworkAddressesClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworkAddressesClientGetResponse contains the response from method VirtualNetworkAddressesClient.Get. +type VirtualNetworkAddressesClientGetResponse struct { + // Virtual IP resource belonging to a vm cluster resource. + VirtualNetworkAddress +} + +// VirtualNetworkAddressesClientListByCloudVMClusterResponse contains the response from method VirtualNetworkAddressesClient.NewListByCloudVMClusterPager. +type VirtualNetworkAddressesClientListByCloudVMClusterResponse struct { + // The response of a VirtualNetworkAddress list operation. + VirtualNetworkAddressListResult +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/time_rfc3339.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/time_rfc3339.go new file mode 100644 index 000000000000..fa76bf4dd2e3 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client.go new file mode 100644 index 000000000000..abf0ec46ba1e --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client.go @@ -0,0 +1,347 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armoracledatabase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualNetworkAddressesClient contains the methods for the VirtualNetworkAddresses group. +// Don't use this type directly, use NewVirtualNetworkAddressesClient() instead. +type VirtualNetworkAddressesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVirtualNetworkAddressesClient creates a new instance of VirtualNetworkAddressesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVirtualNetworkAddressesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworkAddressesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualNetworkAddressesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a VirtualNetworkAddress +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - virtualnetworkaddressname - Virtual IP address hostname. +// - resource - Resource create parameters. +// - options - VirtualNetworkAddressesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkAddressesClient.BeginCreateOrUpdate +// method. +func (client *VirtualNetworkAddressesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, resource VirtualNetworkAddress, options *VirtualNetworkAddressesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworkAddressesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, cloudvmclustername, virtualnetworkaddressname, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkAddressesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkAddressesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a VirtualNetworkAddress +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *VirtualNetworkAddressesClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, resource VirtualNetworkAddress, options *VirtualNetworkAddressesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualNetworkAddressesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, cloudvmclustername, virtualnetworkaddressname, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualNetworkAddressesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, resource VirtualNetworkAddress, options *VirtualNetworkAddressesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses/{virtualnetworkaddressname}" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + if virtualnetworkaddressname == "" { + return nil, errors.New("parameter virtualnetworkaddressname cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualnetworkaddressname}", url.PathEscape(virtualnetworkaddressname)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a VirtualNetworkAddress +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - virtualnetworkaddressname - Virtual IP address hostname. +// - options - VirtualNetworkAddressesClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkAddressesClient.BeginDelete +// method. +func (client *VirtualNetworkAddressesClient) BeginDelete(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, options *VirtualNetworkAddressesClientBeginDeleteOptions) (*runtime.Poller[VirtualNetworkAddressesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, cloudvmclustername, virtualnetworkaddressname, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkAddressesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkAddressesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a VirtualNetworkAddress +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *VirtualNetworkAddressesClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, options *VirtualNetworkAddressesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "VirtualNetworkAddressesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, cloudvmclustername, virtualnetworkaddressname, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualNetworkAddressesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, options *VirtualNetworkAddressesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses/{virtualnetworkaddressname}" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + if virtualnetworkaddressname == "" { + return nil, errors.New("parameter virtualnetworkaddressname cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualnetworkaddressname}", url.PathEscape(virtualnetworkaddressname)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a VirtualNetworkAddress +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - virtualnetworkaddressname - Virtual IP address hostname. +// - options - VirtualNetworkAddressesClientGetOptions contains the optional parameters for the VirtualNetworkAddressesClient.Get +// method. +func (client *VirtualNetworkAddressesClient) Get(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, options *VirtualNetworkAddressesClientGetOptions) (VirtualNetworkAddressesClientGetResponse, error) { + var err error + const operationName = "VirtualNetworkAddressesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, cloudvmclustername, virtualnetworkaddressname, options) + if err != nil { + return VirtualNetworkAddressesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworkAddressesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworkAddressesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VirtualNetworkAddressesClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, options *VirtualNetworkAddressesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses/{virtualnetworkaddressname}" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + if virtualnetworkaddressname == "" { + return nil, errors.New("parameter virtualnetworkaddressname cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualnetworkaddressname}", url.PathEscape(virtualnetworkaddressname)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualNetworkAddressesClient) getHandleResponse(resp *http.Response) (VirtualNetworkAddressesClientGetResponse, error) { + result := VirtualNetworkAddressesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkAddress); err != nil { + return VirtualNetworkAddressesClientGetResponse{}, err + } + return result, nil +} + +// NewListByCloudVMClusterPager - List VirtualNetworkAddress resources by CloudVmCluster +// +// Generated from API version 2023-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - cloudvmclustername - CloudVmCluster name +// - options - VirtualNetworkAddressesClientListByCloudVMClusterOptions contains the optional parameters for the VirtualNetworkAddressesClient.NewListByCloudVMClusterPager +// method. +func (client *VirtualNetworkAddressesClient) NewListByCloudVMClusterPager(resourceGroupName string, cloudvmclustername string, options *VirtualNetworkAddressesClientListByCloudVMClusterOptions) *runtime.Pager[VirtualNetworkAddressesClientListByCloudVMClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworkAddressesClientListByCloudVMClusterResponse]{ + More: func(page VirtualNetworkAddressesClientListByCloudVMClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworkAddressesClientListByCloudVMClusterResponse) (VirtualNetworkAddressesClientListByCloudVMClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualNetworkAddressesClient.NewListByCloudVMClusterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByCloudVMClusterCreateRequest(ctx, resourceGroupName, cloudvmclustername, options) + }, nil) + if err != nil { + return VirtualNetworkAddressesClientListByCloudVMClusterResponse{}, err + } + return client.listByCloudVMClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByCloudVMClusterCreateRequest creates the ListByCloudVMCluster request. +func (client *VirtualNetworkAddressesClient) listByCloudVMClusterCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *VirtualNetworkAddressesClientListByCloudVMClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses" + 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 cloudvmclustername == "" { + return nil, errors.New("parameter cloudvmclustername cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudvmclustername}", url.PathEscape(cloudvmclustername)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByCloudVMClusterHandleResponse handles the ListByCloudVMCluster response. +func (client *VirtualNetworkAddressesClient) listByCloudVMClusterHandleResponse(resp *http.Response) (VirtualNetworkAddressesClientListByCloudVMClusterResponse, error) { + result := VirtualNetworkAddressesClientListByCloudVMClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkAddressListResult); err != nil { + return VirtualNetworkAddressesClientListByCloudVMClusterResponse{}, err + } + return result, nil +}