From 8d1af2dcd86f494192486949d2925c98b567c81c Mon Sep 17 00:00:00 2001 From: ReleaseHelper Date: Mon, 1 Jan 2024 01:11:12 +0000 Subject: [PATCH 1/2] [Release] sdk/resourcemanager/springappdiscovery/armspringappdiscovery/0.1.0 generation from spec commit: 41e4538ed7bb3ceac3c1322c9455a0812ed110ac --- .../armspringappdiscovery/CHANGELOG.md | 7 + .../armspringappdiscovery/LICENSE.txt | 21 + .../armspringappdiscovery/README.md | 92 ++ .../armspringappdiscovery/autorest.md | 13 + .../armspringappdiscovery/build.go | 7 + .../armspringappdiscovery/ci.yml | 28 + .../armspringappdiscovery/client_factory.go | 74 + .../armspringappdiscovery/constants.go | 93 ++ .../errorsummaries_client.go | 178 +++ .../errorsummaries_client_example_test.go | 188 +++ .../fake/errorsummaries_server.go | 156 ++ .../armspringappdiscovery/fake/internal.go | 64 + .../fake/operations_server.go | 96 ++ .../fake/server_factory.go | 108 ++ .../fake/springbootapps_server.go | 261 ++++ .../fake/springbootservers_server.go | 364 +++++ .../fake/springbootsites_server.go | 392 +++++ .../fake/summaries_server.go | 156 ++ .../fake/time_rfc3339.go | 86 ++ .../armspringappdiscovery/go.mod | 21 + .../armspringappdiscovery/go.sum | 31 + .../armspringappdiscovery/models.go | 531 +++++++ .../armspringappdiscovery/models_serde.go | 1256 +++++++++++++++++ .../operations_client.go | 88 ++ .../operations_client_example_test.go | 83 ++ .../armspringappdiscovery/options.go | 137 ++ .../armspringappdiscovery/response_types.go | 138 ++ .../springbootapps_client.go | 324 +++++ .../springbootapps_client_example_test.go | 467 ++++++ .../springbootservers_client.go | 480 +++++++ .../springbootservers_client_example_test.go | 442 ++++++ .../springbootsites_client.go | 527 +++++++ .../springbootsites_client_example_test.go | 504 +++++++ .../armspringappdiscovery/summaries_client.go | 178 +++ .../summaries_client_example_test.go | 158 +++ .../armspringappdiscovery/time_rfc3339.go | 86 ++ 36 files changed, 7835 insertions(+) create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/CHANGELOG.md create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/LICENSE.txt create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/README.md create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/autorest.md create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/build.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/ci.yml create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/client_factory.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/constants.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/errorsummaries_client.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/errorsummaries_client_example_test.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/errorsummaries_server.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/internal.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/operations_server.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/server_factory.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/springbootapps_server.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/springbootservers_server.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/springbootsites_server.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/summaries_server.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/go.mod create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/go.sum create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/models.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/models_serde.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/operations_client.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/operations_client_example_test.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/options.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/response_types.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootapps_client.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootapps_client_example_test.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootservers_client.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootservers_client_example_test.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootsites_client.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootsites_client_example_test.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/summaries_client.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/summaries_client_example_test.go create mode 100644 sdk/resourcemanager/springappdiscovery/armspringappdiscovery/time_rfc3339.go diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/CHANGELOG.md b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/CHANGELOG.md new file mode 100644 index 000000000000..79659c640a39 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 0.1.0 (2024-01-26) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/springappdiscovery/armspringappdiscovery` 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/springappdiscovery/armspringappdiscovery/LICENSE.txt b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/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/springappdiscovery/armspringappdiscovery/README.md b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/README.md new file mode 100644 index 000000000000..6eb0a50f2d3a --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/README.md @@ -0,0 +1,92 @@ +# Azure Springappdiscovery Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/springappdiscovery/armspringappdiscovery)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/springappdiscovery/armspringappdiscovery) + +The `armspringappdiscovery` module provides operations for working with Azure Springappdiscovery. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/springappdiscovery/armspringappdiscovery) + +# 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 Springappdiscovery module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/springappdiscovery/armspringappdiscovery +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Springappdiscovery. 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 Springappdiscovery 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 := armspringappdiscovery.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 := armspringappdiscovery.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.NewErrorSummariesClient() +``` + +## 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 `Springappdiscovery` 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/springappdiscovery/armspringappdiscovery/autorest.md b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/autorest.md new file mode 100644 index 000000000000..a3291114c996 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 +tag: package-2023-01-01-preview +``` \ No newline at end of file diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/build.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/build.go new file mode 100644 index 000000000000..712a0447b578 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/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/springappdiscovery/armspringappdiscovery + +package armspringappdiscovery diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/ci.yml b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/ci.yml new file mode 100644 index 000000000000..a9f6e0b3f42c --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/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/springappdiscovery/armspringappdiscovery/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/springappdiscovery/armspringappdiscovery/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/springappdiscovery/armspringappdiscovery' diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/client_factory.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/client_factory.go new file mode 100644 index 000000000000..5d51ea43e0c8 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/client_factory.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 armspringappdiscovery + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +// NewErrorSummariesClient creates a new instance of ErrorSummariesClient. +func (c *ClientFactory) NewErrorSummariesClient() *ErrorSummariesClient { + subClient, _ := NewErrorSummariesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +// NewSpringbootappsClient creates a new instance of SpringbootappsClient. +func (c *ClientFactory) NewSpringbootappsClient() *SpringbootappsClient { + subClient, _ := NewSpringbootappsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSpringbootserversClient creates a new instance of SpringbootserversClient. +func (c *ClientFactory) NewSpringbootserversClient() *SpringbootserversClient { + subClient, _ := NewSpringbootserversClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSpringbootsitesClient creates a new instance of SpringbootsitesClient. +func (c *ClientFactory) NewSpringbootsitesClient() *SpringbootsitesClient { + subClient, _ := NewSpringbootsitesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSummariesClient creates a new instance of SummariesClient. +func (c *ClientFactory) NewSummariesClient() *SummariesClient { + subClient, _ := NewSummariesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/constants.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/constants.go new file mode 100644 index 000000000000..45a04e9522fb --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/constants.go @@ -0,0 +1,93 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armspringappdiscovery + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/springappdiscovery/armspringappdiscovery" + moduleVersion = "v0.1.0" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProvisioningState - The resource provisioning state. +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUnknown, + } +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/errorsummaries_client.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/errorsummaries_client.go new file mode 100644 index 000000000000..6cd2ae4fca80 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/errorsummaries_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 armspringappdiscovery + +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" +) + +// ErrorSummariesClient contains the methods for the ErrorSummaries group. +// Don't use this type directly, use NewErrorSummariesClient() instead. +type ErrorSummariesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewErrorSummariesClient creates a new instance of ErrorSummariesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewErrorSummariesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ErrorSummariesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ErrorSummariesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets the ErrorSummaries resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - The springbootsites name. +// - errorSummaryName - The name of error summary +// - options - ErrorSummariesClientGetOptions contains the optional parameters for the ErrorSummariesClient.Get method. +func (client *ErrorSummariesClient) Get(ctx context.Context, resourceGroupName string, siteName string, errorSummaryName string, options *ErrorSummariesClientGetOptions) (ErrorSummariesClientGetResponse, error) { + var err error + const operationName = "ErrorSummariesClient.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, siteName, errorSummaryName, options) + if err != nil { + return ErrorSummariesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ErrorSummariesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ErrorSummariesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ErrorSummariesClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, errorSummaryName string, options *ErrorSummariesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/errorSummaries/{errorSummaryName}" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if errorSummaryName == "" { + return nil, errors.New("parameter errorSummaryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{errorSummaryName}", url.PathEscape(errorSummaryName)) + 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-01-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 *ErrorSummariesClient) getHandleResponse(resp *http.Response) (ErrorSummariesClientGetResponse, error) { + result := ErrorSummariesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ErrorSummary); err != nil { + return ErrorSummariesClientGetResponse{}, err + } + return result, nil +} + +// NewListBySitePager - Lists the ErrorSummaries resource in springbootsites. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - The springbootsites name. +// - options - ErrorSummariesClientListBySiteOptions contains the optional parameters for the ErrorSummariesClient.NewListBySitePager +// method. +func (client *ErrorSummariesClient) NewListBySitePager(resourceGroupName string, siteName string, options *ErrorSummariesClientListBySiteOptions) *runtime.Pager[ErrorSummariesClientListBySiteResponse] { + return runtime.NewPager(runtime.PagingHandler[ErrorSummariesClientListBySiteResponse]{ + More: func(page ErrorSummariesClientListBySiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ErrorSummariesClientListBySiteResponse) (ErrorSummariesClientListBySiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ErrorSummariesClient.NewListBySitePager") + 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.listBySiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return ErrorSummariesClientListBySiteResponse{}, err + } + return client.listBySiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySiteCreateRequest creates the ListBySite request. +func (client *ErrorSummariesClient) listBySiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ErrorSummariesClientListBySiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/errorSummaries" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + 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-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySiteHandleResponse handles the ListBySite response. +func (client *ErrorSummariesClient) listBySiteHandleResponse(resp *http.Response) (ErrorSummariesClientListBySiteResponse, error) { + result := ErrorSummariesClientListBySiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ErrorSummaryList); err != nil { + return ErrorSummariesClientListBySiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/errorsummaries_client_example_test.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/errorsummaries_client_example_test.go new file mode 100644 index 000000000000..286d328034b2 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/errorsummaries_client_example_test.go @@ -0,0 +1,188 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armspringappdiscovery_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/springappdiscovery/armspringappdiscovery" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/ErrorSummaries_Get_MaximumSet_Gen.json +func ExampleErrorSummariesClient_Get_errorSummariesGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewErrorSummariesClient().Get(ctx, "rgspringbootdiscovery", "xxkzlvbihwxunadjcpjpjmghmhxrqyvghtpfps", "K2lv", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ErrorSummary = armspringappdiscovery.ErrorSummary{ + // Name: to.Ptr("tfmbwokvgn"), + // Type: to.Ptr("qfemnwktjpynmezppab"), + // ID: to.Ptr("waudmuluqttorwxywyibbezvko"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T16:44:32.561Z"); return t}()), + // CreatedBy: to.Ptr("ztjtyfhicmxcpqszeovgojwzceagbc"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T16:44:32.562Z"); return t}()), + // LastModifiedBy: to.Ptr("isjllzvqodp"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Properties: &armspringappdiscovery.ErrorSummariesProperties{ + // DiscoveryScopeErrorSummaries: []*armspringappdiscovery.ErrorSummaryModel{ + // { + // AffectedObjectsCount: to.Ptr[int64](2), + // AffectedResourceType: to.Ptr("kprvjasvybficrqctgbjpaek"), + // }}, + // Errors: []*armspringappdiscovery.Error{ + // { + // Code: to.Ptr("czbrpdxmv"), + // ID: to.Ptr[int64](13), + // Message: to.Ptr("knjufnfkdpukqiuqzfviwnss"), + // PossibleCauses: to.Ptr("knjufnfkdpukqiuqzfviwnss"), + // RecommendedAction: to.Ptr("qpycieevlbrcomlwooiw"), + // RunAsAccountID: to.Ptr("knjufnfkdpukqiuqzfviwnss"), + // Severity: to.Ptr("wcusqqmqwo"), + // SummaryMessage: to.Ptr("knjufnfkdpukqiuqzfviwnss"), + // UpdatedTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // }}, + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2085": to.Ptr("olljrx"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/ErrorSummaries_Get_MinimumSet_Gen.json +func ExampleErrorSummariesClient_Get_errorSummariesGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewErrorSummariesClient().Get(ctx, "rgspringbootdiscovery", "xxkzlvbihwxunadjcpjpjmghmhxrqyvghtpfps", "K2lv", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ErrorSummary = armspringappdiscovery.ErrorSummary{ + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.OffAzureSpringBoot/springbootsites/testsite1/errorsummaries/default"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/ErrorSummaries_ListBySite_MaximumSet_Gen.json +func ExampleErrorSummariesClient_NewListBySitePager_errorSummariesListBySiteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewErrorSummariesClient().NewListBySitePager("rgspringbootdiscovery", "xxkzlvbihwxunadjcpjpjmghmhxrqyvghtpfps", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.ErrorSummaryList = armspringappdiscovery.ErrorSummaryList{ + // Value: []*armspringappdiscovery.ErrorSummary{ + // { + // Name: to.Ptr("tfmbwokvgn"), + // Type: to.Ptr("qfemnwktjpynmezppab"), + // ID: to.Ptr("waudmuluqttorwxywyibbezvko"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T16:44:32.561Z"); return t}()), + // CreatedBy: to.Ptr("ztjtyfhicmxcpqszeovgojwzceagbc"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T16:44:32.562Z"); return t}()), + // LastModifiedBy: to.Ptr("isjllzvqodp"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Properties: &armspringappdiscovery.ErrorSummariesProperties{ + // DiscoveryScopeErrorSummaries: []*armspringappdiscovery.ErrorSummaryModel{ + // { + // AffectedObjectsCount: to.Ptr[int64](2), + // AffectedResourceType: to.Ptr("kprvjasvybficrqctgbjpaek"), + // }}, + // Errors: []*armspringappdiscovery.Error{ + // { + // Code: to.Ptr("czbrpdxmv"), + // ID: to.Ptr[int64](13), + // Message: to.Ptr("knjufnfkdpukqiuqzfviwnss"), + // PossibleCauses: to.Ptr("knjufnfkdpukqiuqzfviwnss"), + // RecommendedAction: to.Ptr("qpycieevlbrcomlwooiw"), + // RunAsAccountID: to.Ptr("knjufnfkdpukqiuqzfviwnss"), + // Severity: to.Ptr("wcusqqmqwo"), + // SummaryMessage: to.Ptr("knjufnfkdpukqiuqzfviwnss"), + // UpdatedTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // }}, + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2085": to.Ptr("olljrx"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/ErrorSummaries_ListBySite_MinimumSet_Gen.json +func ExampleErrorSummariesClient_NewListBySitePager_errorSummariesListBySiteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewErrorSummariesClient().NewListBySitePager("rgspringbootdiscovery", "xxkzlvbihwxunadjcpjpjmghmhxrqyvghtpfps", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.ErrorSummaryList = armspringappdiscovery.ErrorSummaryList{ + // } + } +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/errorsummaries_server.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/errorsummaries_server.go new file mode 100644 index 000000000000..6d0f04e15bcb --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/errorsummaries_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/springappdiscovery/armspringappdiscovery" + "net/http" + "net/url" + "regexp" +) + +// ErrorSummariesServer is a fake server for instances of the armspringappdiscovery.ErrorSummariesClient type. +type ErrorSummariesServer struct { + // Get is the fake for method ErrorSummariesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, errorSummaryName string, options *armspringappdiscovery.ErrorSummariesClientGetOptions) (resp azfake.Responder[armspringappdiscovery.ErrorSummariesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListBySitePager is the fake for method ErrorSummariesClient.NewListBySitePager + // HTTP status codes to indicate success: http.StatusOK + NewListBySitePager func(resourceGroupName string, siteName string, options *armspringappdiscovery.ErrorSummariesClientListBySiteOptions) (resp azfake.PagerResponder[armspringappdiscovery.ErrorSummariesClientListBySiteResponse]) +} + +// NewErrorSummariesServerTransport creates a new instance of ErrorSummariesServerTransport with the provided implementation. +// The returned ErrorSummariesServerTransport instance is connected to an instance of armspringappdiscovery.ErrorSummariesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewErrorSummariesServerTransport(srv *ErrorSummariesServer) *ErrorSummariesServerTransport { + return &ErrorSummariesServerTransport{ + srv: srv, + newListBySitePager: newTracker[azfake.PagerResponder[armspringappdiscovery.ErrorSummariesClientListBySiteResponse]](), + } +} + +// ErrorSummariesServerTransport connects instances of armspringappdiscovery.ErrorSummariesClient to instances of ErrorSummariesServer. +// Don't use this type directly, use NewErrorSummariesServerTransport instead. +type ErrorSummariesServerTransport struct { + srv *ErrorSummariesServer + newListBySitePager *tracker[azfake.PagerResponder[armspringappdiscovery.ErrorSummariesClientListBySiteResponse]] +} + +// Do implements the policy.Transporter interface for ErrorSummariesServerTransport. +func (e *ErrorSummariesServerTransport) 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 "ErrorSummariesClient.Get": + resp, err = e.dispatchGet(req) + case "ErrorSummariesClient.NewListBySitePager": + resp, err = e.dispatchNewListBySitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (e *ErrorSummariesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.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\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/errorSummaries/(?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 + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + errorSummaryNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("errorSummaryName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, errorSummaryNameParam, 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).ErrorSummary, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *ErrorSummariesServerTransport) dispatchNewListBySitePager(req *http.Request) (*http.Response, error) { + if e.srv.NewListBySitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySitePager not implemented")} + } + newListBySitePager := e.newListBySitePager.get(req) + if newListBySitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/errorSummaries` + 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 + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := e.srv.NewListBySitePager(resourceGroupNameParam, siteNameParam, nil) + newListBySitePager = &resp + e.newListBySitePager.add(req, newListBySitePager) + server.PagerResponderInjectNextLinks(newListBySitePager, req, func(page *armspringappdiscovery.ErrorSummariesClientListBySiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListBySitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySitePager) { + e.newListBySitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/internal.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/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/springappdiscovery/armspringappdiscovery/fake/operations_server.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/operations_server.go new file mode 100644 index 000000000000..083717f54863 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/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/springappdiscovery/armspringappdiscovery" + "net/http" +) + +// OperationsServer is a fake server for instances of the armspringappdiscovery.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armspringappdiscovery.OperationsClientListOptions) (resp azfake.PagerResponder[armspringappdiscovery.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armspringappdiscovery.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[armspringappdiscovery.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armspringappdiscovery.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armspringappdiscovery.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 *armspringappdiscovery.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/springappdiscovery/armspringappdiscovery/fake/server_factory.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/server_factory.go new file mode 100644 index 000000000000..50b1330b74ba --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/server_factory.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" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armspringappdiscovery.ClientFactory type. +type ServerFactory struct { + ErrorSummariesServer ErrorSummariesServer + OperationsServer OperationsServer + SpringbootappsServer SpringbootappsServer + SpringbootserversServer SpringbootserversServer + SpringbootsitesServer SpringbootsitesServer + SummariesServer SummariesServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armspringappdiscovery.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 armspringappdiscovery.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trErrorSummariesServer *ErrorSummariesServerTransport + trOperationsServer *OperationsServerTransport + trSpringbootappsServer *SpringbootappsServerTransport + trSpringbootserversServer *SpringbootserversServerTransport + trSpringbootsitesServer *SpringbootsitesServerTransport + trSummariesServer *SummariesServerTransport +} + +// 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 "ErrorSummariesClient": + initServer(s, &s.trErrorSummariesServer, func() *ErrorSummariesServerTransport { + return NewErrorSummariesServerTransport(&s.srv.ErrorSummariesServer) + }) + resp, err = s.trErrorSummariesServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "SpringbootappsClient": + initServer(s, &s.trSpringbootappsServer, func() *SpringbootappsServerTransport { + return NewSpringbootappsServerTransport(&s.srv.SpringbootappsServer) + }) + resp, err = s.trSpringbootappsServer.Do(req) + case "SpringbootserversClient": + initServer(s, &s.trSpringbootserversServer, func() *SpringbootserversServerTransport { + return NewSpringbootserversServerTransport(&s.srv.SpringbootserversServer) + }) + resp, err = s.trSpringbootserversServer.Do(req) + case "SpringbootsitesClient": + initServer(s, &s.trSpringbootsitesServer, func() *SpringbootsitesServerTransport { + return NewSpringbootsitesServerTransport(&s.srv.SpringbootsitesServer) + }) + resp, err = s.trSpringbootsitesServer.Do(req) + case "SummariesClient": + initServer(s, &s.trSummariesServer, func() *SummariesServerTransport { return NewSummariesServerTransport(&s.srv.SummariesServer) }) + resp, err = s.trSummariesServer.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/springappdiscovery/armspringappdiscovery/fake/springbootapps_server.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/springbootapps_server.go new file mode 100644 index 000000000000..b67c17485360 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/springbootapps_server.go @@ -0,0 +1,261 @@ +//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/springappdiscovery/armspringappdiscovery" + "net/http" + "net/url" + "regexp" +) + +// SpringbootappsServer is a fake server for instances of the armspringappdiscovery.SpringbootappsClient type. +type SpringbootappsServer struct { + // Get is the fake for method SpringbootappsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, springbootappsName string, options *armspringappdiscovery.SpringbootappsClientGetOptions) (resp azfake.Responder[armspringappdiscovery.SpringbootappsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method SpringbootappsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, siteName string, options *armspringappdiscovery.SpringbootappsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armspringappdiscovery.SpringbootappsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method SpringbootappsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(siteName string, options *armspringappdiscovery.SpringbootappsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armspringappdiscovery.SpringbootappsClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method SpringbootappsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, siteName string, springbootappsName string, springbootapps armspringappdiscovery.SpringbootappsPatch, options *armspringappdiscovery.SpringbootappsClientBeginUpdateOptions) (resp azfake.PollerResponder[armspringappdiscovery.SpringbootappsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSpringbootappsServerTransport creates a new instance of SpringbootappsServerTransport with the provided implementation. +// The returned SpringbootappsServerTransport instance is connected to an instance of armspringappdiscovery.SpringbootappsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSpringbootappsServerTransport(srv *SpringbootappsServer) *SpringbootappsServerTransport { + return &SpringbootappsServerTransport{ + srv: srv, + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armspringappdiscovery.SpringbootappsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armspringappdiscovery.SpringbootappsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armspringappdiscovery.SpringbootappsClientUpdateResponse]](), + } +} + +// SpringbootappsServerTransport connects instances of armspringappdiscovery.SpringbootappsClient to instances of SpringbootappsServer. +// Don't use this type directly, use NewSpringbootappsServerTransport instead. +type SpringbootappsServerTransport struct { + srv *SpringbootappsServer + newListByResourceGroupPager *tracker[azfake.PagerResponder[armspringappdiscovery.SpringbootappsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armspringappdiscovery.SpringbootappsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armspringappdiscovery.SpringbootappsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for SpringbootappsServerTransport. +func (s *SpringbootappsServerTransport) 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 "SpringbootappsClient.Get": + resp, err = s.dispatchGet(req) + case "SpringbootappsClient.NewListByResourceGroupPager": + resp, err = s.dispatchNewListByResourceGroupPager(req) + case "SpringbootappsClient.NewListBySubscriptionPager": + resp, err = s.dispatchNewListBySubscriptionPager(req) + case "SpringbootappsClient.BeginUpdate": + resp, err = s.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SpringbootappsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.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\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/springbootapps/(?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 + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + springbootappsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("springbootappsName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, springbootappsNameParam, 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).SpringbootappsModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SpringbootappsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := s.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/springbootapps` + 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 + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByResourceGroupPager(resourceGroupNameParam, siteNameParam, nil) + newListByResourceGroupPager = &resp + s.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armspringappdiscovery.SpringbootappsClientListByResourceGroupResponse, 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) { + s.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + s.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (s *SpringbootappsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := s.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/springbootapps` + 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) + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListBySubscriptionPager(siteNameParam, nil) + newListBySubscriptionPager = &resp + s.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armspringappdiscovery.SpringbootappsClientListBySubscriptionResponse, 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) { + s.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + s.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (s *SpringbootappsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := s.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/springbootapps/(?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[armspringappdiscovery.SpringbootappsPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + springbootappsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("springbootappsName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdate(req.Context(), resourceGroupNameParam, siteNameParam, springbootappsNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + s.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) { + s.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) { + s.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/springbootservers_server.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/springbootservers_server.go new file mode 100644 index 000000000000..f8d158e416f4 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/springbootservers_server.go @@ -0,0 +1,364 @@ +//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/springappdiscovery/armspringappdiscovery" + "net/http" + "net/url" + "regexp" +) + +// SpringbootserversServer is a fake server for instances of the armspringappdiscovery.SpringbootserversClient type. +type SpringbootserversServer struct { + // CreateOrUpdate is the fake for method SpringbootserversClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, springbootservers armspringappdiscovery.SpringbootserversModel, options *armspringappdiscovery.SpringbootserversClientCreateOrUpdateOptions) (resp azfake.Responder[armspringappdiscovery.SpringbootserversClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SpringbootserversClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, options *armspringappdiscovery.SpringbootserversClientBeginDeleteOptions) (resp azfake.PollerResponder[armspringappdiscovery.SpringbootserversClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SpringbootserversClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, options *armspringappdiscovery.SpringbootserversClientGetOptions) (resp azfake.Responder[armspringappdiscovery.SpringbootserversClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method SpringbootserversClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, siteName string, options *armspringappdiscovery.SpringbootserversClientListByResourceGroupOptions) (resp azfake.PagerResponder[armspringappdiscovery.SpringbootserversClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method SpringbootserversClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(siteName string, options *armspringappdiscovery.SpringbootserversClientListBySubscriptionOptions) (resp azfake.PagerResponder[armspringappdiscovery.SpringbootserversClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method SpringbootserversClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, springbootservers armspringappdiscovery.SpringbootserversPatch, options *armspringappdiscovery.SpringbootserversClientBeginUpdateOptions) (resp azfake.PollerResponder[armspringappdiscovery.SpringbootserversClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSpringbootserversServerTransport creates a new instance of SpringbootserversServerTransport with the provided implementation. +// The returned SpringbootserversServerTransport instance is connected to an instance of armspringappdiscovery.SpringbootserversClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSpringbootserversServerTransport(srv *SpringbootserversServer) *SpringbootserversServerTransport { + return &SpringbootserversServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armspringappdiscovery.SpringbootserversClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armspringappdiscovery.SpringbootserversClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armspringappdiscovery.SpringbootserversClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armspringappdiscovery.SpringbootserversClientUpdateResponse]](), + } +} + +// SpringbootserversServerTransport connects instances of armspringappdiscovery.SpringbootserversClient to instances of SpringbootserversServer. +// Don't use this type directly, use NewSpringbootserversServerTransport instead. +type SpringbootserversServerTransport struct { + srv *SpringbootserversServer + beginDelete *tracker[azfake.PollerResponder[armspringappdiscovery.SpringbootserversClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armspringappdiscovery.SpringbootserversClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armspringappdiscovery.SpringbootserversClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armspringappdiscovery.SpringbootserversClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for SpringbootserversServerTransport. +func (s *SpringbootserversServerTransport) 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 "SpringbootserversClient.CreateOrUpdate": + resp, err = s.dispatchCreateOrUpdate(req) + case "SpringbootserversClient.BeginDelete": + resp, err = s.dispatchBeginDelete(req) + case "SpringbootserversClient.Get": + resp, err = s.dispatchGet(req) + case "SpringbootserversClient.NewListByResourceGroupPager": + resp, err = s.dispatchNewListByResourceGroupPager(req) + case "SpringbootserversClient.NewListBySubscriptionPager": + resp, err = s.dispatchNewListBySubscriptionPager(req) + case "SpringbootserversClient.BeginUpdate": + resp, err = s.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SpringbootserversServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/springbootservers/(?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[armspringappdiscovery.SpringbootserversModel](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + springbootserversNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("springbootserversName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, siteNameParam, springbootserversNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SpringbootserversModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SpringbootserversServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/springbootservers/(?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 + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + springbootserversNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("springbootserversName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, siteNameParam, springbootserversNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.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) { + s.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) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SpringbootserversServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.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\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/springbootservers/(?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 + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + springbootserversNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("springbootserversName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, springbootserversNameParam, 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).SpringbootserversModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SpringbootserversServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := s.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/springbootservers` + 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 + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByResourceGroupPager(resourceGroupNameParam, siteNameParam, nil) + newListByResourceGroupPager = &resp + s.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armspringappdiscovery.SpringbootserversClientListByResourceGroupResponse, 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) { + s.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + s.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (s *SpringbootserversServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := s.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/springbootservers` + 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) + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListBySubscriptionPager(siteNameParam, nil) + newListBySubscriptionPager = &resp + s.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armspringappdiscovery.SpringbootserversClientListBySubscriptionResponse, 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) { + s.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + s.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (s *SpringbootserversServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := s.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/springbootservers/(?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[armspringappdiscovery.SpringbootserversPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + springbootserversNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("springbootserversName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdate(req.Context(), resourceGroupNameParam, siteNameParam, springbootserversNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + s.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) { + s.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) { + s.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/springbootsites_server.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/springbootsites_server.go new file mode 100644 index 000000000000..35b7fff039bb --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/springbootsites_server.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 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/springappdiscovery/armspringappdiscovery" + "net/http" + "net/url" + "regexp" +) + +// SpringbootsitesServer is a fake server for instances of the armspringappdiscovery.SpringbootsitesClient type. +type SpringbootsitesServer struct { + // CreateOrUpdate is the fake for method SpringbootsitesClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, springbootsitesName string, springbootsites armspringappdiscovery.SpringbootsitesModel, options *armspringappdiscovery.SpringbootsitesClientCreateOrUpdateOptions) (resp azfake.Responder[armspringappdiscovery.SpringbootsitesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SpringbootsitesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, springbootsitesName string, options *armspringappdiscovery.SpringbootsitesClientBeginDeleteOptions) (resp azfake.PollerResponder[armspringappdiscovery.SpringbootsitesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SpringbootsitesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, springbootsitesName string, options *armspringappdiscovery.SpringbootsitesClientGetOptions) (resp azfake.Responder[armspringappdiscovery.SpringbootsitesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method SpringbootsitesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armspringappdiscovery.SpringbootsitesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armspringappdiscovery.SpringbootsitesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method SpringbootsitesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armspringappdiscovery.SpringbootsitesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armspringappdiscovery.SpringbootsitesClientListBySubscriptionResponse]) + + // BeginTriggerRefreshSite is the fake for method SpringbootsitesClient.BeginTriggerRefreshSite + // HTTP status codes to indicate success: http.StatusAccepted + BeginTriggerRefreshSite func(ctx context.Context, resourceGroupName string, springbootsitesName string, options *armspringappdiscovery.SpringbootsitesClientBeginTriggerRefreshSiteOptions) (resp azfake.PollerResponder[armspringappdiscovery.SpringbootsitesClientTriggerRefreshSiteResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method SpringbootsitesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, springbootsitesName string, springbootsites armspringappdiscovery.SpringbootsitesPatch, options *armspringappdiscovery.SpringbootsitesClientBeginUpdateOptions) (resp azfake.PollerResponder[armspringappdiscovery.SpringbootsitesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSpringbootsitesServerTransport creates a new instance of SpringbootsitesServerTransport with the provided implementation. +// The returned SpringbootsitesServerTransport instance is connected to an instance of armspringappdiscovery.SpringbootsitesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSpringbootsitesServerTransport(srv *SpringbootsitesServer) *SpringbootsitesServerTransport { + return &SpringbootsitesServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armspringappdiscovery.SpringbootsitesClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armspringappdiscovery.SpringbootsitesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armspringappdiscovery.SpringbootsitesClientListBySubscriptionResponse]](), + beginTriggerRefreshSite: newTracker[azfake.PollerResponder[armspringappdiscovery.SpringbootsitesClientTriggerRefreshSiteResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armspringappdiscovery.SpringbootsitesClientUpdateResponse]](), + } +} + +// SpringbootsitesServerTransport connects instances of armspringappdiscovery.SpringbootsitesClient to instances of SpringbootsitesServer. +// Don't use this type directly, use NewSpringbootsitesServerTransport instead. +type SpringbootsitesServerTransport struct { + srv *SpringbootsitesServer + beginDelete *tracker[azfake.PollerResponder[armspringappdiscovery.SpringbootsitesClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armspringappdiscovery.SpringbootsitesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armspringappdiscovery.SpringbootsitesClientListBySubscriptionResponse]] + beginTriggerRefreshSite *tracker[azfake.PollerResponder[armspringappdiscovery.SpringbootsitesClientTriggerRefreshSiteResponse]] + beginUpdate *tracker[azfake.PollerResponder[armspringappdiscovery.SpringbootsitesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for SpringbootsitesServerTransport. +func (s *SpringbootsitesServerTransport) 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 "SpringbootsitesClient.CreateOrUpdate": + resp, err = s.dispatchCreateOrUpdate(req) + case "SpringbootsitesClient.BeginDelete": + resp, err = s.dispatchBeginDelete(req) + case "SpringbootsitesClient.Get": + resp, err = s.dispatchGet(req) + case "SpringbootsitesClient.NewListByResourceGroupPager": + resp, err = s.dispatchNewListByResourceGroupPager(req) + case "SpringbootsitesClient.NewListBySubscriptionPager": + resp, err = s.dispatchNewListBySubscriptionPager(req) + case "SpringbootsitesClient.BeginTriggerRefreshSite": + resp, err = s.dispatchBeginTriggerRefreshSite(req) + case "SpringbootsitesClient.BeginUpdate": + resp, err = s.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SpringbootsitesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?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[armspringappdiscovery.SpringbootsitesModel](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + springbootsitesNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("springbootsitesName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, springbootsitesNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SpringbootsitesModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SpringbootsitesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?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 + } + springbootsitesNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("springbootsitesName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, springbootsitesNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.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) { + s.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) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SpringbootsitesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.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\.OffAzureSpringBoot/springbootsites/(?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 + } + springbootsitesNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("springbootsitesName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, springbootsitesNameParam, 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).SpringbootsitesModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SpringbootsitesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := s.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites` + 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 := s.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + s.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armspringappdiscovery.SpringbootsitesClientListByResourceGroupResponse, 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) { + s.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + s.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (s *SpringbootsitesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := s.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites` + 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 := s.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + s.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armspringappdiscovery.SpringbootsitesClientListBySubscriptionResponse, 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) { + s.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + s.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (s *SpringbootsitesServerTransport) dispatchBeginTriggerRefreshSite(req *http.Request) (*http.Response, error) { + if s.srv.BeginTriggerRefreshSite == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginTriggerRefreshSite not implemented")} + } + beginTriggerRefreshSite := s.beginTriggerRefreshSite.get(req) + if beginTriggerRefreshSite == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/refreshSite` + 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 + } + springbootsitesNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("springbootsitesName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginTriggerRefreshSite(req.Context(), resourceGroupNameParam, springbootsitesNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginTriggerRefreshSite = &respr + s.beginTriggerRefreshSite.add(req, beginTriggerRefreshSite) + } + + resp, err := server.PollerResponderNext(beginTriggerRefreshSite, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + s.beginTriggerRefreshSite.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginTriggerRefreshSite) { + s.beginTriggerRefreshSite.remove(req) + } + + return resp, nil +} + +func (s *SpringbootsitesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := s.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?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[armspringappdiscovery.SpringbootsitesPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + springbootsitesNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("springbootsitesName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdate(req.Context(), resourceGroupNameParam, springbootsitesNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + s.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) { + s.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) { + s.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/summaries_server.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/summaries_server.go new file mode 100644 index 000000000000..59103b1d5fed --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/summaries_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/springappdiscovery/armspringappdiscovery" + "net/http" + "net/url" + "regexp" +) + +// SummariesServer is a fake server for instances of the armspringappdiscovery.SummariesClient type. +type SummariesServer struct { + // Get is the fake for method SummariesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, summaryName string, options *armspringappdiscovery.SummariesClientGetOptions) (resp azfake.Responder[armspringappdiscovery.SummariesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListBySitePager is the fake for method SummariesClient.NewListBySitePager + // HTTP status codes to indicate success: http.StatusOK + NewListBySitePager func(resourceGroupName string, siteName string, options *armspringappdiscovery.SummariesClientListBySiteOptions) (resp azfake.PagerResponder[armspringappdiscovery.SummariesClientListBySiteResponse]) +} + +// NewSummariesServerTransport creates a new instance of SummariesServerTransport with the provided implementation. +// The returned SummariesServerTransport instance is connected to an instance of armspringappdiscovery.SummariesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSummariesServerTransport(srv *SummariesServer) *SummariesServerTransport { + return &SummariesServerTransport{ + srv: srv, + newListBySitePager: newTracker[azfake.PagerResponder[armspringappdiscovery.SummariesClientListBySiteResponse]](), + } +} + +// SummariesServerTransport connects instances of armspringappdiscovery.SummariesClient to instances of SummariesServer. +// Don't use this type directly, use NewSummariesServerTransport instead. +type SummariesServerTransport struct { + srv *SummariesServer + newListBySitePager *tracker[azfake.PagerResponder[armspringappdiscovery.SummariesClientListBySiteResponse]] +} + +// Do implements the policy.Transporter interface for SummariesServerTransport. +func (s *SummariesServerTransport) 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 "SummariesClient.Get": + resp, err = s.dispatchGet(req) + case "SummariesClient.NewListBySitePager": + resp, err = s.dispatchNewListBySitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SummariesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.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\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/summaries/(?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 + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + summaryNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("summaryName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, summaryNameParam, 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).Summary, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SummariesServerTransport) dispatchNewListBySitePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySitePager not implemented")} + } + newListBySitePager := s.newListBySitePager.get(req) + if newListBySitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzureSpringBoot/springbootsites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/summaries` + 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 + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListBySitePager(resourceGroupNameParam, siteNameParam, nil) + newListBySitePager = &resp + s.newListBySitePager.add(req, newListBySitePager) + server.PagerResponderInjectNextLinks(newListBySitePager, req, func(page *armspringappdiscovery.SummariesClientListBySiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySitePager) { + s.newListBySitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/time_rfc3339.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/time_rfc3339.go new file mode 100644 index 000000000000..b0535a7b63e6 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/fake/time_rfc3339.go @@ -0,0 +1,86 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package 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 ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +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 { + layout := utcDateTimeJSON + if tzOffsetRegex.Match(data) { + layout = dateTimeJSON + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + 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 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 || strings.EqualFold(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/springappdiscovery/armspringappdiscovery/go.mod b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/go.mod new file mode 100644 index 000000000000..1cae42a0e922 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/springappdiscovery/armspringappdiscovery + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect + github.com/golang-jwt/jwt/v5 v5.0.0 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect +) diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/go.sum b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/go.sum new file mode 100644 index 000000000000..7985f1da436f --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/go.sum @@ -0,0 +1,31 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 h1:fb8kj/Dh4CSwgsOzHeZY4Xh68cFVbzXx+ONXGMY//4w= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0/go.mod h1:uReU2sSxZExRPBAg3qKzmAucSi51+SP1OhohieR821Q= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 h1:d81/ng9rET2YqdVkVwkb6EXeRrLJIwyGnJcAlAWKwhs= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= +github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 h1:WpB/QDNLpMw72xHJc34BNNykqSOeEJDAWkhf0u12/Jk= +github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= +github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= +github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/models.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/models.go new file mode 100644 index 000000000000..b4977b1bb0b4 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/models.go @@ -0,0 +1,531 @@ +//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 armspringappdiscovery + +import "time" + +// Error - Defines the error. +type Error struct { + // The error code. + Code *string + + // The error ID. + ID *int64 + + // The detailed error message. + Message *string + + // The error possible causes. + PossibleCauses *string + + // The error recommended action + RecommendedAction *string + + // The account ID used to login. + RunAsAccountID *string + + // The error severity + Severity *string + + // The summarized error message. + SummaryMessage *string + + // Time when this error was last updated. + UpdatedTimeStamp *time.Time +} + +// ErrorSummariesProperties - Error summary properties +type ErrorSummariesProperties struct { + // The list of ErrorSummary. + DiscoveryScopeErrorSummaries []*ErrorSummaryModel + + // The list of errors. + Errors []*Error + + // The resource provisioning state. + ProvisioningState *ProvisioningState +} + +// ErrorSummary - The error summary resource definition. +type ErrorSummary struct { + // Resource properties. + Properties *ErrorSummariesProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ErrorSummaryList - The list of ErrorSummary. +type ErrorSummaryList struct { + // Url to follow for getting next page of resources. + NextLink *string + + // The list of ErrorSummary. + Value []*ErrorSummary +} + +// ErrorSummaryModel - ErrorSummary model. +type ErrorSummaryModel struct { + // The count. + AffectedObjectsCount *int64 + + // The type of Object. + AffectedResourceType *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 +} + +// SpringbootappsListResult - The springbootapps list resource definition. +type SpringbootappsListResult struct { + // The link used to get the next page of springbootapps resources list. + NextLink *string + + // The springbootsites list. + Value []*SpringbootappsModel +} + +// SpringbootappsModel - The springbootapps envelope resource definition. +type SpringbootappsModel struct { + // The springbootapps resource definition. + Properties *SpringbootappsProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SpringbootappsPatch - The springbootapps resource patch definition. +type SpringbootappsPatch struct { + // The springbootapps resource definition. + Properties *SpringbootappsProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SpringbootappsProperties - The springbootapps resource definition. +type SpringbootappsProperties struct { + // The name of SpringBootApp. + AppName *string + + // The application port. + AppPort *int32 + + // The application type, whether it is a SpringBoot app. + AppType *string + + // The application configuration file list. + ApplicationConfigurations []*SpringbootappsPropertiesApplicationConfigurationsItem + + // The artifact name of SpringBootApp. + ArtifactName *string + + // The application binding port list. + BindingPorts []*int32 + + // The jdk version in build. + BuildJdkVersion *string + + // The certificate file list. + Certificates []*string + + // The checksum of jar file. + Checksum *string + + // The connection string list. + ConnectionStrings []*string + + // The dependency list. + Dependencies []*string + + // The environment variable list. + Environments []*string + + // The list of errors. + Errors []*Error + + // The total instance count the app deployed. + InstanceCount *int32 + + // The breakdown info for app instances on all the servers + Instances []*SpringbootappsPropertiesInstancesItem + + // The jar file location on the server. + JarFileLocation *string + + // The jvm heap memory allocated. + JvmMemoryInMB *int32 + + // The jvm options. + JvmOptions []*string + + // Time when this springbootapps jar file was last modified. + LastModifiedTime *time.Time + + // Time when this springbootapps instance was last refreshed. + LastUpdatedTime *time.Time + + // The machine ARM id list the app belongs to. + MachineArmIDs []*string + + // The other types of date collected. + Miscs []*SpringbootappsPropertiesMiscsItem + + // The resource provisioning state. + ProvisioningState *ProvisioningState + + // The jdk version installed on server + RuntimeJdkVersion *string + + // The server list the app installed + Servers []*string + + // The site name. + SiteName *string + + // The spring boot version. + SpringBootVersion *string + + // The static content location list. + StaticContentLocations []*string +} + +type SpringbootappsPropertiesApplicationConfigurationsItem struct { + // REQUIRED; The application config file name. + Key *string + + // The application config file content, only contains config keys. + Value *string +} + +type SpringbootappsPropertiesInstancesItem struct { + // REQUIRED; The machine ARM resource Id of this app instance + MachineArmID *string + + // The instance count of this app instance + InstanceCount *int32 + + // The jvm heap memory allocated of this app instance + JvmMemoryInMB *int32 +} + +type SpringbootappsPropertiesMiscsItem struct { + // REQUIRED; The miscs. key. + Key *string + + // The miscs. value. + Value *string +} + +// SpringbootserversListResult - The springbootservers list resource definition. +type SpringbootserversListResult struct { + // The link used to get the next page of springbootservers resources list. + NextLink *string + + // The springbootsites list. + Value []*SpringbootserversModel +} + +// SpringbootserversModel - The springbootservers envelope resource definition. +type SpringbootserversModel struct { + // The springbootservers resource definition. + Properties *SpringbootserversProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SpringbootserversPatch - The springbootservers resource patch definition. +type SpringbootserversPatch struct { + // The springbootsites resource definition. + Properties *SpringbootserversProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SpringbootserversProperties - The springbootservers resource definition. +type SpringbootserversProperties struct { + // REQUIRED; Server is the target server name or ip address to discover of SpringBootServer. + Server *string + + // The list of errors. + Errors []*Error + + // The alternative FQDN or IP addresses to discover for this server + FqdnAndIPAddressList []*string + + // The machine Id from ARM + MachineArmID *string + + // Target server port for remote login + Port *int32 + + // The resource provisioning state. + ProvisioningState *ProvisioningState + + // The total number of spring boot apps been discovered + SpringBootApps *int32 + + // The total number of apps been discovered + TotalApps *int32 +} + +// SpringbootsitesListResult - The springbootsites list resource definition. +type SpringbootsitesListResult struct { + // The link used to get the next page of springbootsites resources list. + NextLink *string + + // The springbootsites list. + Value []*SpringbootsitesModel +} + +// SpringbootsitesModel - The springbootsites envelope resource definition. +type SpringbootsitesModel struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The extended location definition. + ExtendedLocation *SpringbootsitesModelExtendedLocation + + // The springbootsites resource definition. + Properties *SpringbootsitesProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SpringbootsitesModelExtendedLocation - The extended location definition. +type SpringbootsitesModelExtendedLocation struct { + // The extended location name. + Name *string + + // The extended location type. + Type *string +} + +// SpringbootsitesPatch - The springbootsites resource patch definition. +type SpringbootsitesPatch struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The springbootsites resource definition. + Properties *SpringbootsitesProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SpringbootsitesProperties - The springbootsites resource definition. +type SpringbootsitesProperties struct { + // The master site ID from Azure Migrate. + MasterSiteID *string + + // The migrate project ID from Azure Migrate. + MigrateProjectID *string + + // The resource provisioning state. + ProvisioningState *ProvisioningState +} + +// SummariesProperties - Summaries properties +type SummariesProperties struct { + // The of number discovered spring boot apps. + DiscoveredApps *int64 + + // The of number discovered spring boot servers. + DiscoveredServers *int64 + + // The list of errors. + Errors []*Error + + // The resource provisioning state. + ProvisioningState *ProvisioningState +} + +// Summary - The summary resource definition. +type Summary struct { + // Resource properties. + Properties *SummariesProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SummaryList - List of Sites. +type SummaryList struct { + // Url to follow for getting next page of resources. + NextLink *string + + // List of Sites. + Value []*Summary +} + +// 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 +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/models_serde.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/models_serde.go new file mode 100644 index 000000000000..9ee465aabe72 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/models_serde.go @@ -0,0 +1,1256 @@ +//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 armspringappdiscovery + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Error. +func (e Error) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "id", e.ID) + populate(objectMap, "message", e.Message) + populate(objectMap, "possibleCauses", e.PossibleCauses) + populate(objectMap, "recommendedAction", e.RecommendedAction) + populate(objectMap, "runAsAccountId", e.RunAsAccountID) + populate(objectMap, "severity", e.Severity) + populate(objectMap, "summaryMessage", e.SummaryMessage) + populateDateTimeRFC3339(objectMap, "updatedTimeStamp", e.UpdatedTimeStamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Error. +func (e *Error) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "possibleCauses": + err = unpopulate(val, "PossibleCauses", &e.PossibleCauses) + delete(rawMsg, key) + case "recommendedAction": + err = unpopulate(val, "RecommendedAction", &e.RecommendedAction) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &e.RunAsAccountID) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &e.Severity) + delete(rawMsg, key) + case "summaryMessage": + err = unpopulate(val, "SummaryMessage", &e.SummaryMessage) + delete(rawMsg, key) + case "updatedTimeStamp": + err = unpopulateDateTimeRFC3339(val, "UpdatedTimeStamp", &e.UpdatedTimeStamp) + 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 ErrorSummariesProperties. +func (e ErrorSummariesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoveryScopeErrorSummaries", e.DiscoveryScopeErrorSummaries) + populate(objectMap, "errors", e.Errors) + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorSummariesProperties. +func (e *ErrorSummariesProperties) UnmarshalJSON(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 "discoveryScopeErrorSummaries": + err = unpopulate(val, "DiscoveryScopeErrorSummaries", &e.DiscoveryScopeErrorSummaries) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &e.Errors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + 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 ErrorSummary. +func (e ErrorSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorSummary. +func (e *ErrorSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorSummaryList. +func (e ErrorSummaryList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorSummaryList. +func (e *ErrorSummaryList) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + 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 ErrorSummaryModel. +func (e ErrorSummaryModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "affectedObjectsCount", e.AffectedObjectsCount) + populate(objectMap, "affectedResourceType", e.AffectedResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorSummaryModel. +func (e *ErrorSummaryModel) UnmarshalJSON(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 "affectedObjectsCount": + err = unpopulate(val, "AffectedObjectsCount", &e.AffectedObjectsCount) + delete(rawMsg, key) + case "affectedResourceType": + err = unpopulate(val, "AffectedResourceType", &e.AffectedResourceType) + 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 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 SpringbootappsListResult. +func (s SpringbootappsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootappsListResult. +func (s *SpringbootappsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpringbootappsModel. +func (s SpringbootappsModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootappsModel. +func (s *SpringbootappsModel) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpringbootappsPatch. +func (s SpringbootappsPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootappsPatch. +func (s *SpringbootappsPatch) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpringbootappsProperties. +func (s SpringbootappsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appName", s.AppName) + populate(objectMap, "appPort", s.AppPort) + populate(objectMap, "appType", s.AppType) + populate(objectMap, "applicationConfigurations", s.ApplicationConfigurations) + populate(objectMap, "artifactName", s.ArtifactName) + populate(objectMap, "bindingPorts", s.BindingPorts) + populate(objectMap, "buildJdkVersion", s.BuildJdkVersion) + populate(objectMap, "certificates", s.Certificates) + populate(objectMap, "checksum", s.Checksum) + populate(objectMap, "connectionStrings", s.ConnectionStrings) + populate(objectMap, "dependencies", s.Dependencies) + populate(objectMap, "environments", s.Environments) + populate(objectMap, "errors", s.Errors) + populate(objectMap, "instanceCount", s.InstanceCount) + populate(objectMap, "instances", s.Instances) + populate(objectMap, "jarFileLocation", s.JarFileLocation) + populate(objectMap, "jvmMemoryInMB", s.JvmMemoryInMB) + populate(objectMap, "jvmOptions", s.JvmOptions) + populateDateTimeRFC3339(objectMap, "lastModifiedTime", s.LastModifiedTime) + populateDateTimeRFC3339(objectMap, "lastUpdatedTime", s.LastUpdatedTime) + populate(objectMap, "machineArmIds", s.MachineArmIDs) + populate(objectMap, "miscs", s.Miscs) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "runtimeJdkVersion", s.RuntimeJdkVersion) + populate(objectMap, "servers", s.Servers) + populate(objectMap, "siteName", s.SiteName) + populate(objectMap, "springBootVersion", s.SpringBootVersion) + populate(objectMap, "staticContentLocations", s.StaticContentLocations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootappsProperties. +func (s *SpringbootappsProperties) UnmarshalJSON(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 "appName": + err = unpopulate(val, "AppName", &s.AppName) + delete(rawMsg, key) + case "appPort": + err = unpopulate(val, "AppPort", &s.AppPort) + delete(rawMsg, key) + case "appType": + err = unpopulate(val, "AppType", &s.AppType) + delete(rawMsg, key) + case "applicationConfigurations": + err = unpopulate(val, "ApplicationConfigurations", &s.ApplicationConfigurations) + delete(rawMsg, key) + case "artifactName": + err = unpopulate(val, "ArtifactName", &s.ArtifactName) + delete(rawMsg, key) + case "bindingPorts": + err = unpopulate(val, "BindingPorts", &s.BindingPorts) + delete(rawMsg, key) + case "buildJdkVersion": + err = unpopulate(val, "BuildJdkVersion", &s.BuildJdkVersion) + delete(rawMsg, key) + case "certificates": + err = unpopulate(val, "Certificates", &s.Certificates) + delete(rawMsg, key) + case "checksum": + err = unpopulate(val, "Checksum", &s.Checksum) + delete(rawMsg, key) + case "connectionStrings": + err = unpopulate(val, "ConnectionStrings", &s.ConnectionStrings) + delete(rawMsg, key) + case "dependencies": + err = unpopulate(val, "Dependencies", &s.Dependencies) + delete(rawMsg, key) + case "environments": + err = unpopulate(val, "Environments", &s.Environments) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &s.Errors) + delete(rawMsg, key) + case "instanceCount": + err = unpopulate(val, "InstanceCount", &s.InstanceCount) + delete(rawMsg, key) + case "instances": + err = unpopulate(val, "Instances", &s.Instances) + delete(rawMsg, key) + case "jarFileLocation": + err = unpopulate(val, "JarFileLocation", &s.JarFileLocation) + delete(rawMsg, key) + case "jvmMemoryInMB": + err = unpopulate(val, "JvmMemoryInMB", &s.JvmMemoryInMB) + delete(rawMsg, key) + case "jvmOptions": + err = unpopulate(val, "JvmOptions", &s.JvmOptions) + delete(rawMsg, key) + case "lastModifiedTime": + err = unpopulateDateTimeRFC3339(val, "LastModifiedTime", &s.LastModifiedTime) + delete(rawMsg, key) + case "lastUpdatedTime": + err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &s.LastUpdatedTime) + delete(rawMsg, key) + case "machineArmIds": + err = unpopulate(val, "MachineArmIDs", &s.MachineArmIDs) + delete(rawMsg, key) + case "miscs": + err = unpopulate(val, "Miscs", &s.Miscs) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "runtimeJdkVersion": + err = unpopulate(val, "RuntimeJdkVersion", &s.RuntimeJdkVersion) + delete(rawMsg, key) + case "servers": + err = unpopulate(val, "Servers", &s.Servers) + delete(rawMsg, key) + case "siteName": + err = unpopulate(val, "SiteName", &s.SiteName) + delete(rawMsg, key) + case "springBootVersion": + err = unpopulate(val, "SpringBootVersion", &s.SpringBootVersion) + delete(rawMsg, key) + case "staticContentLocations": + err = unpopulate(val, "StaticContentLocations", &s.StaticContentLocations) + 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 SpringbootappsPropertiesApplicationConfigurationsItem. +func (s SpringbootappsPropertiesApplicationConfigurationsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", s.Key) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootappsPropertiesApplicationConfigurationsItem. +func (s *SpringbootappsPropertiesApplicationConfigurationsItem) UnmarshalJSON(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 "key": + err = unpopulate(val, "Key", &s.Key) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpringbootappsPropertiesInstancesItem. +func (s SpringbootappsPropertiesInstancesItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "instanceCount", s.InstanceCount) + populate(objectMap, "jvmMemoryInMB", s.JvmMemoryInMB) + populate(objectMap, "machineArmId", s.MachineArmID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootappsPropertiesInstancesItem. +func (s *SpringbootappsPropertiesInstancesItem) UnmarshalJSON(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 "instanceCount": + err = unpopulate(val, "InstanceCount", &s.InstanceCount) + delete(rawMsg, key) + case "jvmMemoryInMB": + err = unpopulate(val, "JvmMemoryInMB", &s.JvmMemoryInMB) + delete(rawMsg, key) + case "machineArmId": + err = unpopulate(val, "MachineArmID", &s.MachineArmID) + 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 SpringbootappsPropertiesMiscsItem. +func (s SpringbootappsPropertiesMiscsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", s.Key) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootappsPropertiesMiscsItem. +func (s *SpringbootappsPropertiesMiscsItem) UnmarshalJSON(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 "key": + err = unpopulate(val, "Key", &s.Key) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpringbootserversListResult. +func (s SpringbootserversListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootserversListResult. +func (s *SpringbootserversListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpringbootserversModel. +func (s SpringbootserversModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootserversModel. +func (s *SpringbootserversModel) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpringbootserversPatch. +func (s SpringbootserversPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootserversPatch. +func (s *SpringbootserversPatch) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpringbootserversProperties. +func (s SpringbootserversProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errors", s.Errors) + populate(objectMap, "fqdnAndIpAddressList", s.FqdnAndIPAddressList) + populate(objectMap, "machineArmId", s.MachineArmID) + populate(objectMap, "port", s.Port) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "server", s.Server) + populate(objectMap, "springBootApps", s.SpringBootApps) + populate(objectMap, "totalApps", s.TotalApps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootserversProperties. +func (s *SpringbootserversProperties) UnmarshalJSON(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 "errors": + err = unpopulate(val, "Errors", &s.Errors) + delete(rawMsg, key) + case "fqdnAndIpAddressList": + err = unpopulate(val, "FqdnAndIPAddressList", &s.FqdnAndIPAddressList) + delete(rawMsg, key) + case "machineArmId": + err = unpopulate(val, "MachineArmID", &s.MachineArmID) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &s.Port) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "server": + err = unpopulate(val, "Server", &s.Server) + delete(rawMsg, key) + case "springBootApps": + err = unpopulate(val, "SpringBootApps", &s.SpringBootApps) + delete(rawMsg, key) + case "totalApps": + err = unpopulate(val, "TotalApps", &s.TotalApps) + 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 SpringbootsitesListResult. +func (s SpringbootsitesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootsitesListResult. +func (s *SpringbootsitesListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpringbootsitesModel. +func (s SpringbootsitesModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", s.ExtendedLocation) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootsitesModel. +func (s *SpringbootsitesModel) UnmarshalJSON(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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &s.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpringbootsitesModelExtendedLocation. +func (s SpringbootsitesModelExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootsitesModelExtendedLocation. +func (s *SpringbootsitesModelExtendedLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpringbootsitesPatch. +func (s SpringbootsitesPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootsitesPatch. +func (s *SpringbootsitesPatch) UnmarshalJSON(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 "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpringbootsitesProperties. +func (s SpringbootsitesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "masterSiteId", s.MasterSiteID) + populate(objectMap, "migrateProjectId", s.MigrateProjectID) + populate(objectMap, "provisioningState", s.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringbootsitesProperties. +func (s *SpringbootsitesProperties) UnmarshalJSON(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 "masterSiteId": + err = unpopulate(val, "MasterSiteID", &s.MasterSiteID) + delete(rawMsg, key) + case "migrateProjectId": + err = unpopulate(val, "MigrateProjectID", &s.MigrateProjectID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + 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 SummariesProperties. +func (s SummariesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoveredApps", s.DiscoveredApps) + populate(objectMap, "discoveredServers", s.DiscoveredServers) + populate(objectMap, "errors", s.Errors) + populate(objectMap, "provisioningState", s.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SummariesProperties. +func (s *SummariesProperties) UnmarshalJSON(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 "discoveredApps": + err = unpopulate(val, "DiscoveredApps", &s.DiscoveredApps) + delete(rawMsg, key) + case "discoveredServers": + err = unpopulate(val, "DiscoveredServers", &s.DiscoveredServers) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &s.Errors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + 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 Summary. +func (s Summary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Summary. +func (s *Summary) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SummaryList. +func (s SummaryList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SummaryList. +func (s *SummaryList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type 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 +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/operations_client.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/operations_client.go new file mode 100644 index 000000000000..bd2734751c19 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/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 armspringappdiscovery + +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 operations. +// +// Generated from API version 2023-01-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/Microsoft.OffAzureSpringBoot/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-01-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/springappdiscovery/armspringappdiscovery/operations_client_example_test.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/operations_client_example_test.go new file mode 100644 index 000000000000..4d7a444c15cb --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/operations_client_example_test.go @@ -0,0 +1,83 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armspringappdiscovery_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/springappdiscovery/armspringappdiscovery" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/Operations_List_MaximumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.OperationListResult = armspringappdiscovery.OperationListResult{ + // Value: []*armspringappdiscovery.Operation{ + // { + // Name: to.Ptr("lmpy"), + // Display: &armspringappdiscovery.OperationDisplay{ + // Description: to.Ptr("hheiroxxlhavuv"), + // Operation: to.Ptr("ffohgob"), + // Provider: to.Ptr("thndcnzvcjndz"), + // Resource: to.Ptr("fkifpgecyzhcbfkp"), + // }, + // IsDataAction: to.Ptr(true), + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/Operations_List_MinimumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.OperationListResult = armspringappdiscovery.OperationListResult{ + // } + } +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/options.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/options.go new file mode 100644 index 000000000000..ea404c3964eb --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/options.go @@ -0,0 +1,137 @@ +//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 armspringappdiscovery + +// ErrorSummariesClientGetOptions contains the optional parameters for the ErrorSummariesClient.Get method. +type ErrorSummariesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ErrorSummariesClientListBySiteOptions contains the optional parameters for the ErrorSummariesClient.NewListBySitePager +// method. +type ErrorSummariesClientListBySiteOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// SpringbootappsClientBeginUpdateOptions contains the optional parameters for the SpringbootappsClient.BeginUpdate method. +type SpringbootappsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SpringbootappsClientGetOptions contains the optional parameters for the SpringbootappsClient.Get method. +type SpringbootappsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SpringbootappsClientListByResourceGroupOptions contains the optional parameters for the SpringbootappsClient.NewListByResourceGroupPager +// method. +type SpringbootappsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SpringbootappsClientListBySubscriptionOptions contains the optional parameters for the SpringbootappsClient.NewListBySubscriptionPager +// method. +type SpringbootappsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// SpringbootserversClientBeginDeleteOptions contains the optional parameters for the SpringbootserversClient.BeginDelete +// method. +type SpringbootserversClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SpringbootserversClientBeginUpdateOptions contains the optional parameters for the SpringbootserversClient.BeginUpdate +// method. +type SpringbootserversClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SpringbootserversClientCreateOrUpdateOptions contains the optional parameters for the SpringbootserversClient.CreateOrUpdate +// method. +type SpringbootserversClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SpringbootserversClientGetOptions contains the optional parameters for the SpringbootserversClient.Get method. +type SpringbootserversClientGetOptions struct { + // placeholder for future optional parameters +} + +// SpringbootserversClientListByResourceGroupOptions contains the optional parameters for the SpringbootserversClient.NewListByResourceGroupPager +// method. +type SpringbootserversClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SpringbootserversClientListBySubscriptionOptions contains the optional parameters for the SpringbootserversClient.NewListBySubscriptionPager +// method. +type SpringbootserversClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// SpringbootsitesClientBeginDeleteOptions contains the optional parameters for the SpringbootsitesClient.BeginDelete method. +type SpringbootsitesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SpringbootsitesClientBeginTriggerRefreshSiteOptions contains the optional parameters for the SpringbootsitesClient.BeginTriggerRefreshSite +// method. +type SpringbootsitesClientBeginTriggerRefreshSiteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SpringbootsitesClientBeginUpdateOptions contains the optional parameters for the SpringbootsitesClient.BeginUpdate method. +type SpringbootsitesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SpringbootsitesClientCreateOrUpdateOptions contains the optional parameters for the SpringbootsitesClient.CreateOrUpdate +// method. +type SpringbootsitesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SpringbootsitesClientGetOptions contains the optional parameters for the SpringbootsitesClient.Get method. +type SpringbootsitesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SpringbootsitesClientListByResourceGroupOptions contains the optional parameters for the SpringbootsitesClient.NewListByResourceGroupPager +// method. +type SpringbootsitesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SpringbootsitesClientListBySubscriptionOptions contains the optional parameters for the SpringbootsitesClient.NewListBySubscriptionPager +// method. +type SpringbootsitesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// SummariesClientGetOptions contains the optional parameters for the SummariesClient.Get method. +type SummariesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SummariesClientListBySiteOptions contains the optional parameters for the SummariesClient.NewListBySitePager method. +type SummariesClientListBySiteOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/response_types.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/response_types.go new file mode 100644 index 000000000000..5aa198a66b06 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/response_types.go @@ -0,0 +1,138 @@ +//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 armspringappdiscovery + +// ErrorSummariesClientGetResponse contains the response from method ErrorSummariesClient.Get. +type ErrorSummariesClientGetResponse struct { + // The error summary resource definition. + ErrorSummary +} + +// ErrorSummariesClientListBySiteResponse contains the response from method ErrorSummariesClient.NewListBySitePager. +type ErrorSummariesClientListBySiteResponse struct { + // The list of ErrorSummary. + ErrorSummaryList +} + +// 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 +} + +// SpringbootappsClientGetResponse contains the response from method SpringbootappsClient.Get. +type SpringbootappsClientGetResponse struct { + // The springbootapps envelope resource definition. + SpringbootappsModel +} + +// SpringbootappsClientListByResourceGroupResponse contains the response from method SpringbootappsClient.NewListByResourceGroupPager. +type SpringbootappsClientListByResourceGroupResponse struct { + // The springbootapps list resource definition. + SpringbootappsListResult +} + +// SpringbootappsClientListBySubscriptionResponse contains the response from method SpringbootappsClient.NewListBySubscriptionPager. +type SpringbootappsClientListBySubscriptionResponse struct { + // The springbootapps list resource definition. + SpringbootappsListResult +} + +// SpringbootappsClientUpdateResponse contains the response from method SpringbootappsClient.BeginUpdate. +type SpringbootappsClientUpdateResponse struct { + // The springbootapps envelope resource definition. + SpringbootappsModel +} + +// SpringbootserversClientCreateOrUpdateResponse contains the response from method SpringbootserversClient.CreateOrUpdate. +type SpringbootserversClientCreateOrUpdateResponse struct { + // The springbootservers envelope resource definition. + SpringbootserversModel +} + +// SpringbootserversClientDeleteResponse contains the response from method SpringbootserversClient.BeginDelete. +type SpringbootserversClientDeleteResponse struct { + // placeholder for future response values +} + +// SpringbootserversClientGetResponse contains the response from method SpringbootserversClient.Get. +type SpringbootserversClientGetResponse struct { + // The springbootservers envelope resource definition. + SpringbootserversModel +} + +// SpringbootserversClientListByResourceGroupResponse contains the response from method SpringbootserversClient.NewListByResourceGroupPager. +type SpringbootserversClientListByResourceGroupResponse struct { + // The springbootservers list resource definition. + SpringbootserversListResult +} + +// SpringbootserversClientListBySubscriptionResponse contains the response from method SpringbootserversClient.NewListBySubscriptionPager. +type SpringbootserversClientListBySubscriptionResponse struct { + // The springbootservers list resource definition. + SpringbootserversListResult +} + +// SpringbootserversClientUpdateResponse contains the response from method SpringbootserversClient.BeginUpdate. +type SpringbootserversClientUpdateResponse struct { + // The springbootservers envelope resource definition. + SpringbootserversModel +} + +// SpringbootsitesClientCreateOrUpdateResponse contains the response from method SpringbootsitesClient.CreateOrUpdate. +type SpringbootsitesClientCreateOrUpdateResponse struct { + // The springbootsites envelope resource definition. + SpringbootsitesModel +} + +// SpringbootsitesClientDeleteResponse contains the response from method SpringbootsitesClient.BeginDelete. +type SpringbootsitesClientDeleteResponse struct { + // placeholder for future response values +} + +// SpringbootsitesClientGetResponse contains the response from method SpringbootsitesClient.Get. +type SpringbootsitesClientGetResponse struct { + // The springbootsites envelope resource definition. + SpringbootsitesModel +} + +// SpringbootsitesClientListByResourceGroupResponse contains the response from method SpringbootsitesClient.NewListByResourceGroupPager. +type SpringbootsitesClientListByResourceGroupResponse struct { + // The springbootsites list resource definition. + SpringbootsitesListResult +} + +// SpringbootsitesClientListBySubscriptionResponse contains the response from method SpringbootsitesClient.NewListBySubscriptionPager. +type SpringbootsitesClientListBySubscriptionResponse struct { + // The springbootsites list resource definition. + SpringbootsitesListResult +} + +// SpringbootsitesClientTriggerRefreshSiteResponse contains the response from method SpringbootsitesClient.BeginTriggerRefreshSite. +type SpringbootsitesClientTriggerRefreshSiteResponse struct { + // placeholder for future response values +} + +// SpringbootsitesClientUpdateResponse contains the response from method SpringbootsitesClient.BeginUpdate. +type SpringbootsitesClientUpdateResponse struct { + // The springbootsites envelope resource definition. + SpringbootsitesModel +} + +// SummariesClientGetResponse contains the response from method SummariesClient.Get. +type SummariesClientGetResponse struct { + // The summary resource definition. + Summary +} + +// SummariesClientListBySiteResponse contains the response from method SummariesClient.NewListBySitePager. +type SummariesClientListBySiteResponse struct { + // List of Sites. + SummaryList +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootapps_client.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootapps_client.go new file mode 100644 index 000000000000..971fe4759ecb --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootapps_client.go @@ -0,0 +1,324 @@ +//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 armspringappdiscovery + +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" +) + +// SpringbootappsClient contains the methods for the Springbootapps group. +// Don't use this type directly, use NewSpringbootappsClient() instead. +type SpringbootappsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSpringbootappsClient creates a new instance of SpringbootappsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSpringbootappsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SpringbootappsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SpringbootappsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a springbootapps resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - The springbootsites name. +// - springbootappsName - The springbootapps name. +// - options - SpringbootappsClientGetOptions contains the optional parameters for the SpringbootappsClient.Get method. +func (client *SpringbootappsClient) Get(ctx context.Context, resourceGroupName string, siteName string, springbootappsName string, options *SpringbootappsClientGetOptions) (SpringbootappsClientGetResponse, error) { + var err error + const operationName = "SpringbootappsClient.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, siteName, springbootappsName, options) + if err != nil { + return SpringbootappsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SpringbootappsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SpringbootappsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SpringbootappsClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, springbootappsName string, options *SpringbootappsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/springbootapps/{springbootappsName}" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if springbootappsName == "" { + return nil, errors.New("parameter springbootappsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{springbootappsName}", url.PathEscape(springbootappsName)) + 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-01-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 *SpringbootappsClient) getHandleResponse(resp *http.Response) (SpringbootappsClientGetResponse, error) { + result := SpringbootappsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SpringbootappsModel); err != nil { + return SpringbootappsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List springbootapps resource by resourceGroup +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - The springbootsites name. +// - options - SpringbootappsClientListByResourceGroupOptions contains the optional parameters for the SpringbootappsClient.NewListByResourceGroupPager +// method. +func (client *SpringbootappsClient) NewListByResourceGroupPager(resourceGroupName string, siteName string, options *SpringbootappsClientListByResourceGroupOptions) *runtime.Pager[SpringbootappsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SpringbootappsClientListByResourceGroupResponse]{ + More: func(page SpringbootappsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SpringbootappsClientListByResourceGroupResponse) (SpringbootappsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SpringbootappsClient.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, siteName, options) + }, nil) + if err != nil { + return SpringbootappsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SpringbootappsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *SpringbootappsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/springbootapps" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + 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-01-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 *SpringbootappsClient) listByResourceGroupHandleResponse(resp *http.Response) (SpringbootappsClientListByResourceGroupResponse, error) { + result := SpringbootappsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SpringbootappsListResult); err != nil { + return SpringbootappsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List springbootapps resource by subscription +// +// Generated from API version 2023-01-01-preview +// - siteName - The springbootsites name. +// - options - SpringbootappsClientListBySubscriptionOptions contains the optional parameters for the SpringbootappsClient.NewListBySubscriptionPager +// method. +func (client *SpringbootappsClient) NewListBySubscriptionPager(siteName string, options *SpringbootappsClientListBySubscriptionOptions) *runtime.Pager[SpringbootappsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[SpringbootappsClientListBySubscriptionResponse]{ + More: func(page SpringbootappsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SpringbootappsClientListBySubscriptionResponse) (SpringbootappsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SpringbootappsClient.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, siteName, options) + }, nil) + if err != nil { + return SpringbootappsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *SpringbootappsClient) listBySubscriptionCreateRequest(ctx context.Context, siteName string, options *SpringbootappsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/springbootapps" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + 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-01-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 *SpringbootappsClient) listBySubscriptionHandleResponse(resp *http.Response) (SpringbootappsClientListBySubscriptionResponse, error) { + result := SpringbootappsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SpringbootappsListResult); err != nil { + return SpringbootappsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a springbootapps resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - The springbootsites name. +// - springbootappsName - The springbootapps name. +// - springbootapps - Update a springbootapps payload. +// - options - SpringbootappsClientBeginUpdateOptions contains the optional parameters for the SpringbootappsClient.BeginUpdate +// method. +func (client *SpringbootappsClient) BeginUpdate(ctx context.Context, resourceGroupName string, siteName string, springbootappsName string, springbootapps SpringbootappsPatch, options *SpringbootappsClientBeginUpdateOptions) (*runtime.Poller[SpringbootappsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, siteName, springbootappsName, springbootapps, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SpringbootappsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SpringbootappsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a springbootapps resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +func (client *SpringbootappsClient) update(ctx context.Context, resourceGroupName string, siteName string, springbootappsName string, springbootapps SpringbootappsPatch, options *SpringbootappsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SpringbootappsClient.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, siteName, springbootappsName, springbootapps, 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 *SpringbootappsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, springbootappsName string, springbootapps SpringbootappsPatch, options *SpringbootappsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/springbootapps/{springbootappsName}" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if springbootappsName == "" { + return nil, errors.New("parameter springbootappsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{springbootappsName}", url.PathEscape(springbootappsName)) + 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-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, springbootapps); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootapps_client_example_test.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootapps_client_example_test.go new file mode 100644 index 000000000000..c3f70c804698 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootapps_client_example_test.go @@ -0,0 +1,467 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armspringappdiscovery_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/springappdiscovery/armspringappdiscovery" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootapps_Get_MaximumSet_Gen.json +func ExampleSpringbootappsClient_Get_springbootappsGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSpringbootappsClient().Get(ctx, "rgspringbootapps", "pdfosfhtemfsaglvwjdyqlyeipucrd", "ofjeesoahqtnovlbuvflyknpbhcpeqqhekntvqxyemuwbcqnuxjgfhsf", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootappsModel = armspringappdiscovery.SpringbootappsModel{ + // Name: to.Ptr("enyeyrgonjdauhscqy"), + // Type: to.Ptr("hvtpwijptwksiyxdrmnpsv"), + // ID: to.Ptr("ftbefgkqxhwszzienudx"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // CreatedBy: to.Ptr("kmiwjeuplqvqwk"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // LastModifiedBy: to.Ptr("pmmzrztbtuuj"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Properties: &armspringappdiscovery.SpringbootappsProperties{ + // AppName: to.Ptr("wrauwfegjfccym"), + // AppPort: to.Ptr[int32](12), + // AppType: to.Ptr("axzunlh"), + // ApplicationConfigurations: []*armspringappdiscovery.SpringbootappsPropertiesApplicationConfigurationsItem{ + // { + // Key: to.Ptr("wrbnwhqxjextxgdfbonuynvs"), + // Value: to.Ptr("jnmaf"), + // }}, + // ArtifactName: to.Ptr("wrauwfegjfccym"), + // BindingPorts: []*int32{ + // to.Ptr[int32](11)}, + // BuildJdkVersion: to.Ptr("ipzruwqqulkpvhzymqegntz"), + // Certificates: []*string{ + // to.Ptr("xpiqqob")}, + // Checksum: to.Ptr("gpzumvbzfnhhmuehveanctiamr"), + // Dependencies: []*string{ + // to.Ptr("zrtted")}, + // Environments: []*string{ + // to.Ptr("afhprevtcx")}, + // InstanceCount: to.Ptr[int32](5), + // Instances: []*armspringappdiscovery.SpringbootappsPropertiesInstancesItem{ + // { + // InstanceCount: to.Ptr[int32](5), + // JvmMemoryInMB: to.Ptr[int32](128), + // MachineArmID: to.Ptr("lsstlommxuskyhnwyxh"), + // }}, + // JarFileLocation: to.Ptr("wfptqclncaqycyfbfih"), + // JvmMemoryInMB: to.Ptr[int32](1), + // JvmOptions: []*string{ + // to.Ptr("nytejjoytevmvlgnfwb")}, + // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // MachineArmIDs: []*string{ + // to.Ptr("lsstlommxuskyhnwyxh")}, + // Miscs: []*armspringappdiscovery.SpringbootappsPropertiesMiscsItem{ + // { + // Key: to.Ptr("fobsfetkynfmkziei"), + // Value: to.Ptr("k"), + // }}, + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // RuntimeJdkVersion: to.Ptr("eblzujbsulpeilykqyjso"), + // Servers: []*string{ + // to.Ptr("gvfhsohasdx")}, + // SiteName: to.Ptr("nzzyrevhsz"), + // SpringBootVersion: to.Ptr("euggigfiii"), + // StaticContentLocations: []*string{ + // to.Ptr("wvvajfkbtmjftir")}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootapps_Get_MinimumSet_Gen.json +func ExampleSpringbootappsClient_Get_springbootappsGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSpringbootappsClient().Get(ctx, "rgspringbootapps", "pdfosfhtemfsaglvwjdyqlyeipucrd", "ofjeesoahqtnovlbuvflyknpbhcpeqqhekntvqxyemuwbcqnuxjgfhsf", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootappsModel = armspringappdiscovery.SpringbootappsModel{ + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.OffAzureSpringBoot/springbootsites/testsite1/springbootapps/app1"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootapps_Update_MaximumSet_Gen.json +func ExampleSpringbootappsClient_BeginUpdate_springbootappsUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpringbootappsClient().BeginUpdate(ctx, "rgspringbootapps", "pdfosfhtemfsaglvwjdyqlyeipucrd", "ofjeesoahqtnovlbuvflyknpbhcpeqqhekntvqxyemuwbcqnuxjgfhsf", armspringappdiscovery.SpringbootappsPatch{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootappsModel = armspringappdiscovery.SpringbootappsModel{ + // Name: to.Ptr("enyeyrgonjdauhscqy"), + // Type: to.Ptr("hvtpwijptwksiyxdrmnpsv"), + // ID: to.Ptr("ftbefgkqxhwszzienudx"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // CreatedBy: to.Ptr("kmiwjeuplqvqwk"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // LastModifiedBy: to.Ptr("pmmzrztbtuuj"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Properties: &armspringappdiscovery.SpringbootappsProperties{ + // AppName: to.Ptr("wrauwfegjfccym"), + // AppPort: to.Ptr[int32](12), + // AppType: to.Ptr("axzunlh"), + // ApplicationConfigurations: []*armspringappdiscovery.SpringbootappsPropertiesApplicationConfigurationsItem{ + // { + // Key: to.Ptr("wrbnwhqxjextxgdfbonuynvs"), + // Value: to.Ptr("jnmaf"), + // }}, + // ArtifactName: to.Ptr("wrauwfegjfccym"), + // BindingPorts: []*int32{ + // to.Ptr[int32](11)}, + // BuildJdkVersion: to.Ptr("ipzruwqqulkpvhzymqegntz"), + // Certificates: []*string{ + // to.Ptr("xpiqqob")}, + // Checksum: to.Ptr("gpzumvbzfnhhmuehveanctiamr"), + // Dependencies: []*string{ + // to.Ptr("zrtted")}, + // Environments: []*string{ + // to.Ptr("afhprevtcx")}, + // InstanceCount: to.Ptr[int32](5), + // Instances: []*armspringappdiscovery.SpringbootappsPropertiesInstancesItem{ + // { + // InstanceCount: to.Ptr[int32](5), + // JvmMemoryInMB: to.Ptr[int32](128), + // MachineArmID: to.Ptr("lsstlommxuskyhnwyxh"), + // }}, + // JarFileLocation: to.Ptr("wfptqclncaqycyfbfih"), + // JvmMemoryInMB: to.Ptr[int32](1), + // JvmOptions: []*string{ + // to.Ptr("nytejjoytevmvlgnfwb")}, + // MachineArmIDs: []*string{ + // to.Ptr("lsstlommxuskyhnwyxh")}, + // Miscs: []*armspringappdiscovery.SpringbootappsPropertiesMiscsItem{ + // { + // Key: to.Ptr("fobsfetkynfmkziei"), + // Value: to.Ptr("k"), + // }}, + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // RuntimeJdkVersion: to.Ptr("eblzujbsulpeilykqyjso"), + // Servers: []*string{ + // to.Ptr("gvfhsohasdx")}, + // SiteName: to.Ptr("nzzyrevhsz"), + // SpringBootVersion: to.Ptr("euggigfiii"), + // StaticContentLocations: []*string{ + // to.Ptr("wvvajfkbtmjftir")}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootapps_Update_MinimumSet_Gen.json +func ExampleSpringbootappsClient_BeginUpdate_springbootappsUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpringbootappsClient().BeginUpdate(ctx, "rgspringbootapps", "pdfosfhtemfsaglvwjdyqlyeipucrd", "ofjeesoahqtnovlbuvflyknpbhcpeqqhekntvqxyemuwbcqnuxjgfhsf", armspringappdiscovery.SpringbootappsPatch{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootappsModel = armspringappdiscovery.SpringbootappsModel{ + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootapps_ListByResourceGroup_MaximumSet_Gen.json +func ExampleSpringbootappsClient_NewListByResourceGroupPager_springbootappsListByResourceGroupMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpringbootappsClient().NewListByResourceGroupPager("rgspringbootapps", "pdfosfhtemfsaglvwjdyqlyeipucrd", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpringbootappsListResult = armspringappdiscovery.SpringbootappsListResult{ + // Value: []*armspringappdiscovery.SpringbootappsModel{ + // { + // Name: to.Ptr("enyeyrgonjdauhscqy"), + // Type: to.Ptr("hvtpwijptwksiyxdrmnpsv"), + // ID: to.Ptr("ftbefgkqxhwszzienudx"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // CreatedBy: to.Ptr("kmiwjeuplqvqwk"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // LastModifiedBy: to.Ptr("pmmzrztbtuuj"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Properties: &armspringappdiscovery.SpringbootappsProperties{ + // AppName: to.Ptr("wrauwfegjfccym"), + // AppPort: to.Ptr[int32](12), + // AppType: to.Ptr("axzunlh"), + // ApplicationConfigurations: []*armspringappdiscovery.SpringbootappsPropertiesApplicationConfigurationsItem{ + // { + // Key: to.Ptr("wrbnwhqxjextxgdfbonuynvs"), + // Value: to.Ptr("jnmaf"), + // }}, + // ArtifactName: to.Ptr("wrauwfegjfccym"), + // BindingPorts: []*int32{ + // to.Ptr[int32](11)}, + // BuildJdkVersion: to.Ptr("ipzruwqqulkpvhzymqegntz"), + // Certificates: []*string{ + // to.Ptr("xpiqqob")}, + // Checksum: to.Ptr("gpzumvbzfnhhmuehveanctiamr"), + // Dependencies: []*string{ + // to.Ptr("zrtted")}, + // Environments: []*string{ + // to.Ptr("afhprevtcx")}, + // InstanceCount: to.Ptr[int32](5), + // Instances: []*armspringappdiscovery.SpringbootappsPropertiesInstancesItem{ + // { + // InstanceCount: to.Ptr[int32](5), + // JvmMemoryInMB: to.Ptr[int32](128), + // MachineArmID: to.Ptr("lsstlommxuskyhnwyxh"), + // }}, + // JarFileLocation: to.Ptr("wfptqclncaqycyfbfih"), + // JvmMemoryInMB: to.Ptr[int32](1), + // JvmOptions: []*string{ + // to.Ptr("nytejjoytevmvlgnfwb")}, + // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // MachineArmIDs: []*string{ + // to.Ptr("lsstlommxuskyhnwyxh")}, + // Miscs: []*armspringappdiscovery.SpringbootappsPropertiesMiscsItem{ + // { + // Key: to.Ptr("fobsfetkynfmkziei"), + // Value: to.Ptr("k"), + // }}, + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // RuntimeJdkVersion: to.Ptr("eblzujbsulpeilykqyjso"), + // Servers: []*string{ + // to.Ptr("gvfhsohasdx")}, + // SiteName: to.Ptr("nzzyrevhsz"), + // SpringBootVersion: to.Ptr("euggigfiii"), + // StaticContentLocations: []*string{ + // to.Ptr("wvvajfkbtmjftir")}, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootapps_ListByResourceGroup_MinimumSet_Gen.json +func ExampleSpringbootappsClient_NewListByResourceGroupPager_springbootappsListByResourceGroupMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpringbootappsClient().NewListByResourceGroupPager("rgspringbootapps", "pdfosfhtemfsaglvwjdyqlyeipucrd", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpringbootappsListResult = armspringappdiscovery.SpringbootappsListResult{ + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootapps_ListBySubscription_MaximumSet_Gen.json +func ExampleSpringbootappsClient_NewListBySubscriptionPager_springbootappsListBySubscriptionMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpringbootappsClient().NewListBySubscriptionPager("pdfosfhtemfsaglvwjdyqlyeipucrd", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpringbootappsListResult = armspringappdiscovery.SpringbootappsListResult{ + // Value: []*armspringappdiscovery.SpringbootappsModel{ + // { + // Name: to.Ptr("enyeyrgonjdauhscqy"), + // Type: to.Ptr("hvtpwijptwksiyxdrmnpsv"), + // ID: to.Ptr("ftbefgkqxhwszzienudx"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // CreatedBy: to.Ptr("kmiwjeuplqvqwk"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // LastModifiedBy: to.Ptr("pmmzrztbtuuj"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Properties: &armspringappdiscovery.SpringbootappsProperties{ + // AppName: to.Ptr("wrauwfegjfccym"), + // AppPort: to.Ptr[int32](12), + // AppType: to.Ptr("axzunlh"), + // ApplicationConfigurations: []*armspringappdiscovery.SpringbootappsPropertiesApplicationConfigurationsItem{ + // { + // Key: to.Ptr("wrbnwhqxjextxgdfbonuynvs"), + // Value: to.Ptr("jnmaf"), + // }}, + // ArtifactName: to.Ptr("wrauwfegjfccym"), + // BindingPorts: []*int32{ + // to.Ptr[int32](11)}, + // BuildJdkVersion: to.Ptr("ipzruwqqulkpvhzymqegntz"), + // Certificates: []*string{ + // to.Ptr("xpiqqob")}, + // Checksum: to.Ptr("gpzumvbzfnhhmuehveanctiamr"), + // Dependencies: []*string{ + // to.Ptr("zrtted")}, + // Environments: []*string{ + // to.Ptr("afhprevtcx")}, + // InstanceCount: to.Ptr[int32](5), + // Instances: []*armspringappdiscovery.SpringbootappsPropertiesInstancesItem{ + // { + // InstanceCount: to.Ptr[int32](5), + // JvmMemoryInMB: to.Ptr[int32](128), + // MachineArmID: to.Ptr("lsstlommxuskyhnwyxh"), + // }}, + // JarFileLocation: to.Ptr("wfptqclncaqycyfbfih"), + // JvmMemoryInMB: to.Ptr[int32](1), + // JvmOptions: []*string{ + // to.Ptr("nytejjoytevmvlgnfwb")}, + // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:28:24.094Z"); return t}()), + // MachineArmIDs: []*string{ + // to.Ptr("lsstlommxuskyhnwyxh")}, + // Miscs: []*armspringappdiscovery.SpringbootappsPropertiesMiscsItem{ + // { + // Key: to.Ptr("fobsfetkynfmkziei"), + // Value: to.Ptr("k"), + // }}, + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // RuntimeJdkVersion: to.Ptr("eblzujbsulpeilykqyjso"), + // Servers: []*string{ + // to.Ptr("gvfhsohasdx")}, + // SiteName: to.Ptr("nzzyrevhsz"), + // SpringBootVersion: to.Ptr("euggigfiii"), + // StaticContentLocations: []*string{ + // to.Ptr("wvvajfkbtmjftir")}, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootapps_ListBySubscription_MinimumSet_Gen.json +func ExampleSpringbootappsClient_NewListBySubscriptionPager_springbootappsListBySubscriptionMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpringbootappsClient().NewListBySubscriptionPager("pdfosfhtemfsaglvwjdyqlyeipucrd", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpringbootappsListResult = armspringappdiscovery.SpringbootappsListResult{ + // } + } +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootservers_client.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootservers_client.go new file mode 100644 index 000000000000..4ccdcb43d108 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootservers_client.go @@ -0,0 +1,480 @@ +//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 armspringappdiscovery + +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" +) + +// SpringbootserversClient contains the methods for the Springbootservers group. +// Don't use this type directly, use NewSpringbootserversClient() instead. +type SpringbootserversClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSpringbootserversClient creates a new instance of SpringbootserversClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSpringbootserversClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SpringbootserversClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SpringbootserversClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create springbootservers resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - The springbootsites name. +// - springbootserversName - The springbootservers name. +// - springbootservers - Create a springbootservers payload. +// - options - SpringbootserversClientCreateOrUpdateOptions contains the optional parameters for the SpringbootserversClient.CreateOrUpdate +// method. +func (client *SpringbootserversClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, springbootservers SpringbootserversModel, options *SpringbootserversClientCreateOrUpdateOptions) (SpringbootserversClientCreateOrUpdateResponse, error) { + var err error + const operationName = "SpringbootserversClient.CreateOrUpdate" + 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, siteName, springbootserversName, springbootservers, options) + if err != nil { + return SpringbootserversClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SpringbootserversClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SpringbootserversClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SpringbootserversClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, springbootservers SpringbootserversModel, options *SpringbootserversClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/springbootservers/{springbootserversName}" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if springbootserversName == "" { + return nil, errors.New("parameter springbootserversName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{springbootserversName}", url.PathEscape(springbootserversName)) + 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-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, springbootservers); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *SpringbootserversClient) createOrUpdateHandleResponse(resp *http.Response) (SpringbootserversClientCreateOrUpdateResponse, error) { + result := SpringbootserversClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SpringbootserversModel); err != nil { + return SpringbootserversClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Delete springbootservers resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - The springbootsites name. +// - springbootserversName - The springbootservers name. +// - options - SpringbootserversClientBeginDeleteOptions contains the optional parameters for the SpringbootserversClient.BeginDelete +// method. +func (client *SpringbootserversClient) BeginDelete(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, options *SpringbootserversClientBeginDeleteOptions) (*runtime.Poller[SpringbootserversClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, siteName, springbootserversName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SpringbootserversClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SpringbootserversClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete springbootservers resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +func (client *SpringbootserversClient) deleteOperation(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, options *SpringbootserversClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "SpringbootserversClient.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, siteName, springbootserversName, 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 *SpringbootserversClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, options *SpringbootserversClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/springbootservers/{springbootserversName}" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if springbootserversName == "" { + return nil, errors.New("parameter springbootserversName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{springbootserversName}", url.PathEscape(springbootserversName)) + 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-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - List springbootservers resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - The springbootsites name. +// - springbootserversName - The springbootservers name. +// - options - SpringbootserversClientGetOptions contains the optional parameters for the SpringbootserversClient.Get method. +func (client *SpringbootserversClient) Get(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, options *SpringbootserversClientGetOptions) (SpringbootserversClientGetResponse, error) { + var err error + const operationName = "SpringbootserversClient.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, siteName, springbootserversName, options) + if err != nil { + return SpringbootserversClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SpringbootserversClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SpringbootserversClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SpringbootserversClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, options *SpringbootserversClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/springbootservers/{springbootserversName}" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if springbootserversName == "" { + return nil, errors.New("parameter springbootserversName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{springbootserversName}", url.PathEscape(springbootserversName)) + 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-01-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 *SpringbootserversClient) getHandleResponse(resp *http.Response) (SpringbootserversClientGetResponse, error) { + result := SpringbootserversClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SpringbootserversModel); err != nil { + return SpringbootserversClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List springbootservers resource by resourceGroup +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - The springbootsites name. +// - options - SpringbootserversClientListByResourceGroupOptions contains the optional parameters for the SpringbootserversClient.NewListByResourceGroupPager +// method. +func (client *SpringbootserversClient) NewListByResourceGroupPager(resourceGroupName string, siteName string, options *SpringbootserversClientListByResourceGroupOptions) *runtime.Pager[SpringbootserversClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SpringbootserversClientListByResourceGroupResponse]{ + More: func(page SpringbootserversClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SpringbootserversClientListByResourceGroupResponse) (SpringbootserversClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SpringbootserversClient.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, siteName, options) + }, nil) + if err != nil { + return SpringbootserversClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SpringbootserversClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *SpringbootserversClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/springbootservers" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + 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-01-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 *SpringbootserversClient) listByResourceGroupHandleResponse(resp *http.Response) (SpringbootserversClientListByResourceGroupResponse, error) { + result := SpringbootserversClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SpringbootserversListResult); err != nil { + return SpringbootserversClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List springbootservers resource by subscription +// +// Generated from API version 2023-01-01-preview +// - siteName - The springbootsites name. +// - options - SpringbootserversClientListBySubscriptionOptions contains the optional parameters for the SpringbootserversClient.NewListBySubscriptionPager +// method. +func (client *SpringbootserversClient) NewListBySubscriptionPager(siteName string, options *SpringbootserversClientListBySubscriptionOptions) *runtime.Pager[SpringbootserversClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[SpringbootserversClientListBySubscriptionResponse]{ + More: func(page SpringbootserversClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SpringbootserversClientListBySubscriptionResponse) (SpringbootserversClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SpringbootserversClient.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, siteName, options) + }, nil) + if err != nil { + return SpringbootserversClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *SpringbootserversClient) listBySubscriptionCreateRequest(ctx context.Context, siteName string, options *SpringbootserversClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/springbootservers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + 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-01-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 *SpringbootserversClient) listBySubscriptionHandleResponse(resp *http.Response) (SpringbootserversClientListBySubscriptionResponse, error) { + result := SpringbootserversClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SpringbootserversListResult); err != nil { + return SpringbootserversClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update springbootservers resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - The springbootsites name. +// - springbootserversName - The springbootservers name. +// - springbootservers - Update a springbootservers payload. +// - options - SpringbootserversClientBeginUpdateOptions contains the optional parameters for the SpringbootserversClient.BeginUpdate +// method. +func (client *SpringbootserversClient) BeginUpdate(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, springbootservers SpringbootserversPatch, options *SpringbootserversClientBeginUpdateOptions) (*runtime.Poller[SpringbootserversClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, siteName, springbootserversName, springbootservers, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SpringbootserversClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SpringbootserversClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update springbootservers resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +func (client *SpringbootserversClient) update(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, springbootservers SpringbootserversPatch, options *SpringbootserversClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SpringbootserversClient.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, siteName, springbootserversName, springbootservers, 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 *SpringbootserversClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, springbootserversName string, springbootservers SpringbootserversPatch, options *SpringbootserversClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/springbootservers/{springbootserversName}" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if springbootserversName == "" { + return nil, errors.New("parameter springbootserversName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{springbootserversName}", url.PathEscape(springbootserversName)) + 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-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, springbootservers); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootservers_client_example_test.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootservers_client_example_test.go new file mode 100644 index 000000000000..fddd81ba5fbc --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootservers_client_example_test.go @@ -0,0 +1,442 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armspringappdiscovery_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/springappdiscovery/armspringappdiscovery" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootservers_Get_MaximumSet_Gen.json +func ExampleSpringbootserversClient_Get_springbootserversGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSpringbootserversClient().Get(ctx, "rgspringbootservers", "hlkrzldhyobavtabgpubtjbhlslnjmsvkthwcfboriwyxndacjypzbj", "zkarbqnwnxeozvjrkpdqmgnwedwgtwcmmyqwaijkn", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootserversModel = armspringappdiscovery.SpringbootserversModel{ + // Name: to.Ptr("licrobomiqalwnrti"), + // Type: to.Ptr("wlmmljjoqbqnhbotk"), + // ID: to.Ptr("xsfjeazznmryzgjsuvymj"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:00:31.448Z"); return t}()), + // CreatedBy: to.Ptr("wnkpkjmpusyo"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:00:31.448Z"); return t}()), + // LastModifiedBy: to.Ptr("pbpaajxtbivcftbnhqtngytbx"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Properties: &armspringappdiscovery.SpringbootserversProperties{ + // Errors: []*armspringappdiscovery.Error{ + // }, + // FqdnAndIPAddressList: []*string{ + // }, + // MachineArmID: to.Ptr("fvfkiapbqsprnbzczdfmuryknrna"), + // Port: to.Ptr[int32](10), + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // Server: to.Ptr("thhuxocfyqpeluqcgnypi"), + // SpringBootApps: to.Ptr[int32](17), + // TotalApps: to.Ptr[int32](5), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootservers_Get_MinimumSet_Gen.json +func ExampleSpringbootserversClient_Get_springbootserversGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSpringbootserversClient().Get(ctx, "rgspringbootservers", "hlkrzldhyobavtabgpubtjbhlslnjmsvkthwcfboriwyxndacjypzbj", "zkarbqnwnxeozvjrkpdqmgnwedwgtwcmmyqwaijkn", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootserversModel = armspringappdiscovery.SpringbootserversModel{ + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.OffAzureSpringBoot/springbootsites/testsite1/springbootservers/server1"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootservers_CreateOrUpdate_MaximumSet_Gen.json +func ExampleSpringbootserversClient_CreateOrUpdate_springbootserversCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSpringbootserversClient().CreateOrUpdate(ctx, "rgspringbootservers", "hlkrzldhyobavtabgpubtjbhlslnjmsvkthwcfboriwyxndacjypzbj", "zkarbqnwnxeozvjrkpdqmgnwedwgtwcmmyqwaijkn", armspringappdiscovery.SpringbootserversModel{ + Properties: &armspringappdiscovery.SpringbootserversProperties{ + Errors: []*armspringappdiscovery.Error{}, + FqdnAndIPAddressList: []*string{}, + MachineArmID: to.Ptr("fvfkiapbqsprnbzczdfmuryknrna"), + Port: to.Ptr[int32](10), + Server: to.Ptr("thhuxocfyqpeluqcgnypi"), + SpringBootApps: to.Ptr[int32](17), + TotalApps: to.Ptr[int32](5), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootserversModel = armspringappdiscovery.SpringbootserversModel{ + // Name: to.Ptr("licrobomiqalwnrti"), + // Type: to.Ptr("wlmmljjoqbqnhbotk"), + // ID: to.Ptr("xsfjeazznmryzgjsuvymj"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:00:31.448Z"); return t}()), + // CreatedBy: to.Ptr("wnkpkjmpusyo"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:00:31.448Z"); return t}()), + // LastModifiedBy: to.Ptr("pbpaajxtbivcftbnhqtngytbx"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Properties: &armspringappdiscovery.SpringbootserversProperties{ + // Errors: []*armspringappdiscovery.Error{ + // }, + // FqdnAndIPAddressList: []*string{ + // }, + // MachineArmID: to.Ptr("fvfkiapbqsprnbzczdfmuryknrna"), + // Port: to.Ptr[int32](10), + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // Server: to.Ptr("thhuxocfyqpeluqcgnypi"), + // SpringBootApps: to.Ptr[int32](17), + // TotalApps: to.Ptr[int32](5), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootservers_CreateOrUpdate_MinimumSet_Gen.json +func ExampleSpringbootserversClient_CreateOrUpdate_springbootserversCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSpringbootserversClient().CreateOrUpdate(ctx, "rgspringbootservers", "hlkrzldhyobavtabgpubtjbhlslnjmsvkthwcfboriwyxndacjypzbj", "zkarbqnwnxeozvjrkpdqmgnwedwgtwcmmyqwaijkn", armspringappdiscovery.SpringbootserversModel{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootserversModel = armspringappdiscovery.SpringbootserversModel{ + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.OffAzureSpringBoot/springbootsites/testsite1/springbootservers/server1"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootservers_Delete_MaximumSet_Gen.json +func ExampleSpringbootserversClient_BeginDelete_springbootserversDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpringbootserversClient().BeginDelete(ctx, "rgspringbootservers", "hlkrzldhyobavtabgpubtjbhlslnjmsvkthwcfboriwyxndacjypzbj", "zkarbqnwnxeozvjrkpdqmgnwedwgtwcmmyqwaijkn", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootservers_Delete_MinimumSet_Gen.json +func ExampleSpringbootserversClient_BeginDelete_springbootserversDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpringbootserversClient().BeginDelete(ctx, "rgspringbootservers", "hlkrzldhyobavtabgpubtjbhlslnjmsvkthwcfboriwyxndacjypzbj", "zkarbqnwnxeozvjrkpdqmgnwedwgtwcmmyqwaijkn", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootservers_Update_MaximumSet_Gen.json +func ExampleSpringbootserversClient_BeginUpdate_springbootserversUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpringbootserversClient().BeginUpdate(ctx, "rgspringbootservers", "hlkrzldhyobavtabgpubtjbhlslnjmsvkthwcfboriwyxndacjypzbj", "zkarbqnwnxeozvjrkpdqmgnwedwgtwcmmyqwaijkn", armspringappdiscovery.SpringbootserversPatch{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootserversModel = armspringappdiscovery.SpringbootserversModel{ + // Name: to.Ptr("licrobomiqalwnrti"), + // Type: to.Ptr("wlmmljjoqbqnhbotk"), + // ID: to.Ptr("xsfjeazznmryzgjsuvymj"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:00:31.448Z"); return t}()), + // CreatedBy: to.Ptr("wnkpkjmpusyo"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:00:31.448Z"); return t}()), + // LastModifiedBy: to.Ptr("pbpaajxtbivcftbnhqtngytbx"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Properties: &armspringappdiscovery.SpringbootserversProperties{ + // Errors: []*armspringappdiscovery.Error{ + // }, + // FqdnAndIPAddressList: []*string{ + // }, + // MachineArmID: to.Ptr("fvfkiapbqsprnbzczdfmuryknrna"), + // Port: to.Ptr[int32](10), + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // Server: to.Ptr("thhuxocfyqpeluqcgnypi"), + // SpringBootApps: to.Ptr[int32](17), + // TotalApps: to.Ptr[int32](5), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootservers_Update_MinimumSet_Gen.json +func ExampleSpringbootserversClient_BeginUpdate_springbootserversUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpringbootserversClient().BeginUpdate(ctx, "rgspringbootservers", "hlkrzldhyobavtabgpubtjbhlslnjmsvkthwcfboriwyxndacjypzbj", "zkarbqnwnxeozvjrkpdqmgnwedwgtwcmmyqwaijkn", armspringappdiscovery.SpringbootserversPatch{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootserversModel = armspringappdiscovery.SpringbootserversModel{ + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootservers_ListByResourceGroup_MaximumSet_Gen.json +func ExampleSpringbootserversClient_NewListByResourceGroupPager_springbootserversListByResourceGroupMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpringbootserversClient().NewListByResourceGroupPager("rgspringbootservers", "hlkrzldhyobavtabgpubtjbhlslnjmsvkthwcfboriwyxndacjypzbj", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpringbootserversListResult = armspringappdiscovery.SpringbootserversListResult{ + // Value: []*armspringappdiscovery.SpringbootserversModel{ + // { + // Name: to.Ptr("licrobomiqalwnrti"), + // Type: to.Ptr("wlmmljjoqbqnhbotk"), + // ID: to.Ptr("xsfjeazznmryzgjsuvymj"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:00:31.448Z"); return t}()), + // CreatedBy: to.Ptr("wnkpkjmpusyo"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:00:31.448Z"); return t}()), + // LastModifiedBy: to.Ptr("pbpaajxtbivcftbnhqtngytbx"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Properties: &armspringappdiscovery.SpringbootserversProperties{ + // Errors: []*armspringappdiscovery.Error{ + // }, + // FqdnAndIPAddressList: []*string{ + // }, + // MachineArmID: to.Ptr("fvfkiapbqsprnbzczdfmuryknrna"), + // Port: to.Ptr[int32](10), + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // Server: to.Ptr("thhuxocfyqpeluqcgnypi"), + // SpringBootApps: to.Ptr[int32](17), + // TotalApps: to.Ptr[int32](5), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootservers_ListByResourceGroup_MinimumSet_Gen.json +func ExampleSpringbootserversClient_NewListByResourceGroupPager_springbootserversListByResourceGroupMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpringbootserversClient().NewListByResourceGroupPager("rgspringbootservers", "hlkrzldhyobavtabgpubtjbhlslnjmsvkthwcfboriwyxndacjypzbj", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpringbootserversListResult = armspringappdiscovery.SpringbootserversListResult{ + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootservers_ListBySubscription_MaximumSet_Gen.json +func ExampleSpringbootserversClient_NewListBySubscriptionPager_springbootserversListBySubscriptionMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpringbootserversClient().NewListBySubscriptionPager("hlkrzldhyobavtabgpubtjbhlslnjmsvkthwcfboriwyxndacjypzbj", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpringbootserversListResult = armspringappdiscovery.SpringbootserversListResult{ + // Value: []*armspringappdiscovery.SpringbootserversModel{ + // { + // Name: to.Ptr("licrobomiqalwnrti"), + // Type: to.Ptr("wlmmljjoqbqnhbotk"), + // ID: to.Ptr("xsfjeazznmryzgjsuvymj"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:00:31.448Z"); return t}()), + // CreatedBy: to.Ptr("wnkpkjmpusyo"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T09:00:31.448Z"); return t}()), + // LastModifiedBy: to.Ptr("pbpaajxtbivcftbnhqtngytbx"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Properties: &armspringappdiscovery.SpringbootserversProperties{ + // Errors: []*armspringappdiscovery.Error{ + // }, + // FqdnAndIPAddressList: []*string{ + // }, + // MachineArmID: to.Ptr("fvfkiapbqsprnbzczdfmuryknrna"), + // Port: to.Ptr[int32](10), + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // Server: to.Ptr("thhuxocfyqpeluqcgnypi"), + // SpringBootApps: to.Ptr[int32](17), + // TotalApps: to.Ptr[int32](5), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootservers_ListBySubscription_MinimumSet_Gen.json +func ExampleSpringbootserversClient_NewListBySubscriptionPager_springbootserversListBySubscriptionMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpringbootserversClient().NewListBySubscriptionPager("hlkrzldhyobavtabgpubtjbhlslnjmsvkthwcfboriwyxndacjypzbj", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpringbootserversListResult = armspringappdiscovery.SpringbootserversListResult{ + // } + } +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootsites_client.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootsites_client.go new file mode 100644 index 000000000000..0a7d61ec3858 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootsites_client.go @@ -0,0 +1,527 @@ +//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 armspringappdiscovery + +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" +) + +// SpringbootsitesClient contains the methods for the Springbootsites group. +// Don't use this type directly, use NewSpringbootsitesClient() instead. +type SpringbootsitesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSpringbootsitesClient creates a new instance of SpringbootsitesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSpringbootsitesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SpringbootsitesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SpringbootsitesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a springbootsites resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - springbootsitesName - The springbootsites name. +// - springbootsites - Create a springbootsites payload. +// - options - SpringbootsitesClientCreateOrUpdateOptions contains the optional parameters for the SpringbootsitesClient.CreateOrUpdate +// method. +func (client *SpringbootsitesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, springbootsitesName string, springbootsites SpringbootsitesModel, options *SpringbootsitesClientCreateOrUpdateOptions) (SpringbootsitesClientCreateOrUpdateResponse, error) { + var err error + const operationName = "SpringbootsitesClient.CreateOrUpdate" + 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, springbootsitesName, springbootsites, options) + if err != nil { + return SpringbootsitesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SpringbootsitesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SpringbootsitesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SpringbootsitesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, springbootsitesName string, springbootsites SpringbootsitesModel, options *SpringbootsitesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{springbootsitesName}" + 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 springbootsitesName == "" { + return nil, errors.New("parameter springbootsitesName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{springbootsitesName}", url.PathEscape(springbootsitesName)) + 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-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, springbootsites); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *SpringbootsitesClient) createOrUpdateHandleResponse(resp *http.Response) (SpringbootsitesClientCreateOrUpdateResponse, error) { + result := SpringbootsitesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SpringbootsitesModel); err != nil { + return SpringbootsitesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Delete a springbootsites resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - springbootsitesName - The springbootsites name. +// - options - SpringbootsitesClientBeginDeleteOptions contains the optional parameters for the SpringbootsitesClient.BeginDelete +// method. +func (client *SpringbootsitesClient) BeginDelete(ctx context.Context, resourceGroupName string, springbootsitesName string, options *SpringbootsitesClientBeginDeleteOptions) (*runtime.Poller[SpringbootsitesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, springbootsitesName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SpringbootsitesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SpringbootsitesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a springbootsites resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +func (client *SpringbootsitesClient) deleteOperation(ctx context.Context, resourceGroupName string, springbootsitesName string, options *SpringbootsitesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "SpringbootsitesClient.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, springbootsitesName, 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 *SpringbootsitesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, springbootsitesName string, options *SpringbootsitesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{springbootsitesName}" + 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 springbootsitesName == "" { + return nil, errors.New("parameter springbootsitesName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{springbootsitesName}", url.PathEscape(springbootsitesName)) + 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-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a springbootsites resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - springbootsitesName - The springbootsites name. +// - options - SpringbootsitesClientGetOptions contains the optional parameters for the SpringbootsitesClient.Get method. +func (client *SpringbootsitesClient) Get(ctx context.Context, resourceGroupName string, springbootsitesName string, options *SpringbootsitesClientGetOptions) (SpringbootsitesClientGetResponse, error) { + var err error + const operationName = "SpringbootsitesClient.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, springbootsitesName, options) + if err != nil { + return SpringbootsitesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SpringbootsitesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SpringbootsitesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SpringbootsitesClient) getCreateRequest(ctx context.Context, resourceGroupName string, springbootsitesName string, options *SpringbootsitesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{springbootsitesName}" + 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 springbootsitesName == "" { + return nil, errors.New("parameter springbootsitesName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{springbootsitesName}", url.PathEscape(springbootsitesName)) + 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-01-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 *SpringbootsitesClient) getHandleResponse(resp *http.Response) (SpringbootsitesClientGetResponse, error) { + result := SpringbootsitesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SpringbootsitesModel); err != nil { + return SpringbootsitesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List springbootsites resource by resourceGroup. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - SpringbootsitesClientListByResourceGroupOptions contains the optional parameters for the SpringbootsitesClient.NewListByResourceGroupPager +// method. +func (client *SpringbootsitesClient) NewListByResourceGroupPager(resourceGroupName string, options *SpringbootsitesClientListByResourceGroupOptions) *runtime.Pager[SpringbootsitesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SpringbootsitesClientListByResourceGroupResponse]{ + More: func(page SpringbootsitesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SpringbootsitesClientListByResourceGroupResponse) (SpringbootsitesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SpringbootsitesClient.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 SpringbootsitesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SpringbootsitesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SpringbootsitesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites" + 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-01-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 *SpringbootsitesClient) listByResourceGroupHandleResponse(resp *http.Response) (SpringbootsitesClientListByResourceGroupResponse, error) { + result := SpringbootsitesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SpringbootsitesListResult); err != nil { + return SpringbootsitesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List springbootsites resource by subscription +// +// Generated from API version 2023-01-01-preview +// - options - SpringbootsitesClientListBySubscriptionOptions contains the optional parameters for the SpringbootsitesClient.NewListBySubscriptionPager +// method. +func (client *SpringbootsitesClient) NewListBySubscriptionPager(options *SpringbootsitesClientListBySubscriptionOptions) *runtime.Pager[SpringbootsitesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[SpringbootsitesClientListBySubscriptionResponse]{ + More: func(page SpringbootsitesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SpringbootsitesClientListBySubscriptionResponse) (SpringbootsitesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SpringbootsitesClient.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 SpringbootsitesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *SpringbootsitesClient) listBySubscriptionCreateRequest(ctx context.Context, options *SpringbootsitesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.OffAzureSpringBoot/springbootsites" + 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-01-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 *SpringbootsitesClient) listBySubscriptionHandleResponse(resp *http.Response) (SpringbootsitesClientListBySubscriptionResponse, error) { + result := SpringbootsitesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SpringbootsitesListResult); err != nil { + return SpringbootsitesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginTriggerRefreshSite - Trigger refresh springbootsites action +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - springbootsitesName - The springbootsites name. +// - options - SpringbootsitesClientBeginTriggerRefreshSiteOptions contains the optional parameters for the SpringbootsitesClient.BeginTriggerRefreshSite +// method. +func (client *SpringbootsitesClient) BeginTriggerRefreshSite(ctx context.Context, resourceGroupName string, springbootsitesName string, options *SpringbootsitesClientBeginTriggerRefreshSiteOptions) (*runtime.Poller[SpringbootsitesClientTriggerRefreshSiteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.triggerRefreshSite(ctx, resourceGroupName, springbootsitesName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SpringbootsitesClientTriggerRefreshSiteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SpringbootsitesClientTriggerRefreshSiteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// TriggerRefreshSite - Trigger refresh springbootsites action +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +func (client *SpringbootsitesClient) triggerRefreshSite(ctx context.Context, resourceGroupName string, springbootsitesName string, options *SpringbootsitesClientBeginTriggerRefreshSiteOptions) (*http.Response, error) { + var err error + const operationName = "SpringbootsitesClient.BeginTriggerRefreshSite" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.triggerRefreshSiteCreateRequest(ctx, resourceGroupName, springbootsitesName, 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) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// triggerRefreshSiteCreateRequest creates the TriggerRefreshSite request. +func (client *SpringbootsitesClient) triggerRefreshSiteCreateRequest(ctx context.Context, resourceGroupName string, springbootsitesName string, options *SpringbootsitesClientBeginTriggerRefreshSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{springbootsitesName}/refreshSite" + 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 springbootsitesName == "" { + return nil, errors.New("parameter springbootsitesName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{springbootsitesName}", url.PathEscape(springbootsitesName)) + 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-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Update a springbootsites resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - springbootsitesName - The springbootsites name. +// - springbootsites - Update a springbootsites payload. +// - options - SpringbootsitesClientBeginUpdateOptions contains the optional parameters for the SpringbootsitesClient.BeginUpdate +// method. +func (client *SpringbootsitesClient) BeginUpdate(ctx context.Context, resourceGroupName string, springbootsitesName string, springbootsites SpringbootsitesPatch, options *SpringbootsitesClientBeginUpdateOptions) (*runtime.Poller[SpringbootsitesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, springbootsitesName, springbootsites, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SpringbootsitesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SpringbootsitesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a springbootsites resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +func (client *SpringbootsitesClient) update(ctx context.Context, resourceGroupName string, springbootsitesName string, springbootsites SpringbootsitesPatch, options *SpringbootsitesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SpringbootsitesClient.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, springbootsitesName, springbootsites, 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 *SpringbootsitesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, springbootsitesName string, springbootsites SpringbootsitesPatch, options *SpringbootsitesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{springbootsitesName}" + 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 springbootsitesName == "" { + return nil, errors.New("parameter springbootsitesName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{springbootsitesName}", url.PathEscape(springbootsitesName)) + 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-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, springbootsites); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootsites_client_example_test.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootsites_client_example_test.go new file mode 100644 index 000000000000..2e296a0c3013 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/springbootsites_client_example_test.go @@ -0,0 +1,504 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armspringappdiscovery_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/springappdiscovery/armspringappdiscovery" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_Get_MaximumSet_Gen.json +func ExampleSpringbootsitesClient_Get_springbootsitesGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSpringbootsitesClient().Get(ctx, "rgspringbootsites", "xrmzlavpewxtfeitghdrj", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootsitesModel = armspringappdiscovery.SpringbootsitesModel{ + // Name: to.Ptr("jjyngfg"), + // Type: to.Ptr("jnhikchnunglggvsuyy"), + // ID: to.Ptr("dynfdywpzysyqnfgdddj"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T11:53:09.096Z"); return t}()), + // CreatedBy: to.Ptr("cqwftvyr"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T11:53:09.096Z"); return t}()), + // LastModifiedBy: to.Ptr("yezjizjfobybuslq"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Location: to.Ptr("tgobtvxktootwhhvjtsmpddvlqlrq"), + // Tags: map[string]*string{ + // "key3558": to.Ptr("xeuhtglamqzj"), + // }, + // ExtendedLocation: &armspringappdiscovery.SpringbootsitesModelExtendedLocation{ + // Name: to.Ptr("rywvpbfsqovhlfirtwisugsdsfsgf"), + // Type: to.Ptr("lvsb"), + // }, + // Properties: &armspringappdiscovery.SpringbootsitesProperties{ + // MasterSiteID: to.Ptr("xsoimrgshsactearljwuljmi"), + // MigrateProjectID: to.Ptr("wwuattybgco"), + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_Get_MinimumSet_Gen.json +func ExampleSpringbootsitesClient_Get_springbootsitesGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSpringbootsitesClient().Get(ctx, "rgspringbootsites", "xrmzlavpewxtfeitghdrj", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootsitesModel = armspringappdiscovery.SpringbootsitesModel{ + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.OffAzureSpringBoot/springbootsites/testsite1"), + // Location: to.Ptr("tgobtvxktootwhhvjtsmpddvlqlrq"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_CreateOrUpdate_MaximumSet_Gen.json +func ExampleSpringbootsitesClient_CreateOrUpdate_springbootsitesCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSpringbootsitesClient().CreateOrUpdate(ctx, "rgspringbootsites", "xrmzlavpewxtfeitghdrj", armspringappdiscovery.SpringbootsitesModel{ + Location: to.Ptr("tgobtvxktootwhhvjtsmpddvlqlrq"), + Tags: map[string]*string{ + "key3558": to.Ptr("xeuhtglamqzj"), + }, + ExtendedLocation: &armspringappdiscovery.SpringbootsitesModelExtendedLocation{ + Name: to.Ptr("rywvpbfsqovhlfirtwisugsdsfsgf"), + Type: to.Ptr("lvsb"), + }, + Properties: &armspringappdiscovery.SpringbootsitesProperties{ + MasterSiteID: to.Ptr("xsoimrgshsactearljwuljmi"), + MigrateProjectID: to.Ptr("wwuattybgco"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootsitesModel = armspringappdiscovery.SpringbootsitesModel{ + // Name: to.Ptr("jjyngfg"), + // Type: to.Ptr("jnhikchnunglggvsuyy"), + // ID: to.Ptr("dynfdywpzysyqnfgdddj"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T11:53:09.096Z"); return t}()), + // CreatedBy: to.Ptr("cqwftvyr"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T11:53:09.096Z"); return t}()), + // LastModifiedBy: to.Ptr("yezjizjfobybuslq"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Location: to.Ptr("tgobtvxktootwhhvjtsmpddvlqlrq"), + // Tags: map[string]*string{ + // "key3558": to.Ptr("xeuhtglamqzj"), + // }, + // ExtendedLocation: &armspringappdiscovery.SpringbootsitesModelExtendedLocation{ + // Name: to.Ptr("rywvpbfsqovhlfirtwisugsdsfsgf"), + // Type: to.Ptr("lvsb"), + // }, + // Properties: &armspringappdiscovery.SpringbootsitesProperties{ + // MasterSiteID: to.Ptr("xsoimrgshsactearljwuljmi"), + // MigrateProjectID: to.Ptr("wwuattybgco"), + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_CreateOrUpdate_MinimumSet_Gen.json +func ExampleSpringbootsitesClient_CreateOrUpdate_springbootsitesCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSpringbootsitesClient().CreateOrUpdate(ctx, "rgspringbootsites", "xrmzlavpewxtfeitghdrj", armspringappdiscovery.SpringbootsitesModel{ + Location: to.Ptr("tgobtvxktootwhhvjtsmpddvlqlrq"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootsitesModel = armspringappdiscovery.SpringbootsitesModel{ + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.OffAzureSpringBoot/springbootsites/testsite1"), + // Location: to.Ptr("tgobtvxktootwhhvjtsmpddvlqlrq"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_Delete_MaximumSet_Gen.json +func ExampleSpringbootsitesClient_BeginDelete_springbootsitesDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpringbootsitesClient().BeginDelete(ctx, "rgspringbootsites", "xrmzlavpewxtfeitghdrj", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_Delete_MinimumSet_Gen.json +func ExampleSpringbootsitesClient_BeginDelete_springbootsitesDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpringbootsitesClient().BeginDelete(ctx, "rgspringbootsites", "xrmzlavpewxtfeitghdrj", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_Update_MaximumSet_Gen.json +func ExampleSpringbootsitesClient_BeginUpdate_springbootsitesUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpringbootsitesClient().BeginUpdate(ctx, "rgspringbootsites", "xrmzlavpewxtfeitghdrj", armspringappdiscovery.SpringbootsitesPatch{ + Location: to.Ptr("icnumzvzzeqhuxtcefuqdcro"), + Tags: map[string]*string{ + "key9581": to.Ptr("cgdqvbknjrwcwuesquddsxu"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootsitesModel = armspringappdiscovery.SpringbootsitesModel{ + // Name: to.Ptr("jjyngfg"), + // Type: to.Ptr("jnhikchnunglggvsuyy"), + // ID: to.Ptr("dynfdywpzysyqnfgdddj"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T11:53:09.096Z"); return t}()), + // CreatedBy: to.Ptr("cqwftvyr"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T11:53:09.096Z"); return t}()), + // LastModifiedBy: to.Ptr("yezjizjfobybuslq"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Location: to.Ptr("tgobtvxktootwhhvjtsmpddvlqlrq"), + // Tags: map[string]*string{ + // "key3558": to.Ptr("xeuhtglamqzj"), + // }, + // ExtendedLocation: &armspringappdiscovery.SpringbootsitesModelExtendedLocation{ + // Name: to.Ptr("rywvpbfsqovhlfirtwisugsdsfsgf"), + // Type: to.Ptr("lvsb"), + // }, + // Properties: &armspringappdiscovery.SpringbootsitesProperties{ + // MasterSiteID: to.Ptr("xsoimrgshsactearljwuljmi"), + // MigrateProjectID: to.Ptr("wwuattybgco"), + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_Update_MinimumSet_Gen.json +func ExampleSpringbootsitesClient_BeginUpdate_springbootsitesUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpringbootsitesClient().BeginUpdate(ctx, "rgspringbootsites", "xrmzlavpewxtfeitghdrj", armspringappdiscovery.SpringbootsitesPatch{ + Location: to.Ptr("icnumzvzzeqhuxtcefuqdcro"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SpringbootsitesModel = armspringappdiscovery.SpringbootsitesModel{ + // Location: to.Ptr("tgobtvxktootwhhvjtsmpddvlqlrq"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_TriggerRefreshSite_MaximumSet_Gen.json +func ExampleSpringbootsitesClient_BeginTriggerRefreshSite_springbootsitesTriggerRefreshSiteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpringbootsitesClient().BeginTriggerRefreshSite(ctx, "rgspringbootsites", "czarpuxwoafaqsuptutcwyu", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_TriggerRefreshSite_MinimumSet_Gen.json +func ExampleSpringbootsitesClient_BeginTriggerRefreshSite_springbootsitesTriggerRefreshSiteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpringbootsitesClient().BeginTriggerRefreshSite(ctx, "rgspringbootsites", "czarpuxwoafaqsuptutcwyu", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_ListByResourceGroup_MaximumSet_Gen.json +func ExampleSpringbootsitesClient_NewListByResourceGroupPager_springbootsitesListByResourceGroupMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpringbootsitesClient().NewListByResourceGroupPager("rgspringbootsites", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpringbootsitesListResult = armspringappdiscovery.SpringbootsitesListResult{ + // Value: []*armspringappdiscovery.SpringbootsitesModel{ + // { + // Name: to.Ptr("jjyngfg"), + // Type: to.Ptr("jnhikchnunglggvsuyy"), + // ID: to.Ptr("dynfdywpzysyqnfgdddj"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T11:53:09.096Z"); return t}()), + // CreatedBy: to.Ptr("cqwftvyr"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T11:53:09.096Z"); return t}()), + // LastModifiedBy: to.Ptr("yezjizjfobybuslq"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Location: to.Ptr("tgobtvxktootwhhvjtsmpddvlqlrq"), + // Tags: map[string]*string{ + // "key3558": to.Ptr("xeuhtglamqzj"), + // }, + // ExtendedLocation: &armspringappdiscovery.SpringbootsitesModelExtendedLocation{ + // Name: to.Ptr("rywvpbfsqovhlfirtwisugsdsfsgf"), + // Type: to.Ptr("lvsb"), + // }, + // Properties: &armspringappdiscovery.SpringbootsitesProperties{ + // MasterSiteID: to.Ptr("xsoimrgshsactearljwuljmi"), + // MigrateProjectID: to.Ptr("wwuattybgco"), + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_ListByResourceGroup_MinimumSet_Gen.json +func ExampleSpringbootsitesClient_NewListByResourceGroupPager_springbootsitesListByResourceGroupMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpringbootsitesClient().NewListByResourceGroupPager("rgspringbootsites", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpringbootsitesListResult = armspringappdiscovery.SpringbootsitesListResult{ + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_ListBySubscription_MaximumSet_Gen.json +func ExampleSpringbootsitesClient_NewListBySubscriptionPager_springbootsitesListBySubscriptionMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpringbootsitesClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpringbootsitesListResult = armspringappdiscovery.SpringbootsitesListResult{ + // Value: []*armspringappdiscovery.SpringbootsitesModel{ + // { + // Name: to.Ptr("jjyngfg"), + // Type: to.Ptr("jnhikchnunglggvsuyy"), + // ID: to.Ptr("dynfdywpzysyqnfgdddj"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T11:53:09.096Z"); return t}()), + // CreatedBy: to.Ptr("cqwftvyr"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-02T11:53:09.096Z"); return t}()), + // LastModifiedBy: to.Ptr("yezjizjfobybuslq"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Location: to.Ptr("tgobtvxktootwhhvjtsmpddvlqlrq"), + // Tags: map[string]*string{ + // "key3558": to.Ptr("xeuhtglamqzj"), + // }, + // ExtendedLocation: &armspringappdiscovery.SpringbootsitesModelExtendedLocation{ + // Name: to.Ptr("rywvpbfsqovhlfirtwisugsdsfsgf"), + // Type: to.Ptr("lvsb"), + // }, + // Properties: &armspringappdiscovery.SpringbootsitesProperties{ + // MasterSiteID: to.Ptr("xsoimrgshsactearljwuljmi"), + // MigrateProjectID: to.Ptr("wwuattybgco"), + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/springbootsites_ListBySubscription_MinimumSet_Gen.json +func ExampleSpringbootsitesClient_NewListBySubscriptionPager_springbootsitesListBySubscriptionMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpringbootsitesClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpringbootsitesListResult = armspringappdiscovery.SpringbootsitesListResult{ + // } + } +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/summaries_client.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/summaries_client.go new file mode 100644 index 000000000000..bfdd641ec3e6 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/summaries_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 armspringappdiscovery + +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" +) + +// SummariesClient contains the methods for the Summaries group. +// Don't use this type directly, use NewSummariesClient() instead. +type SummariesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSummariesClient creates a new instance of SummariesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSummariesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SummariesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SummariesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets the Summaries resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - The springbootsites name. +// - summaryName - The name of summary +// - options - SummariesClientGetOptions contains the optional parameters for the SummariesClient.Get method. +func (client *SummariesClient) Get(ctx context.Context, resourceGroupName string, siteName string, summaryName string, options *SummariesClientGetOptions) (SummariesClientGetResponse, error) { + var err error + const operationName = "SummariesClient.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, siteName, summaryName, options) + if err != nil { + return SummariesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SummariesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SummariesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SummariesClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, summaryName string, options *SummariesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/summaries/{summaryName}" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if summaryName == "" { + return nil, errors.New("parameter summaryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{summaryName}", url.PathEscape(summaryName)) + 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-01-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 *SummariesClient) getHandleResponse(resp *http.Response) (SummariesClientGetResponse, error) { + result := SummariesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Summary); err != nil { + return SummariesClientGetResponse{}, err + } + return result, nil +} + +// NewListBySitePager - Lists the Summaries resource in springbootsites. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - The springbootsites name. +// - options - SummariesClientListBySiteOptions contains the optional parameters for the SummariesClient.NewListBySitePager +// method. +func (client *SummariesClient) NewListBySitePager(resourceGroupName string, siteName string, options *SummariesClientListBySiteOptions) *runtime.Pager[SummariesClientListBySiteResponse] { + return runtime.NewPager(runtime.PagingHandler[SummariesClientListBySiteResponse]{ + More: func(page SummariesClientListBySiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SummariesClientListBySiteResponse) (SummariesClientListBySiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SummariesClient.NewListBySitePager") + 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.listBySiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return SummariesClientListBySiteResponse{}, err + } + return client.listBySiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySiteCreateRequest creates the ListBySite request. +func (client *SummariesClient) listBySiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *SummariesClientListBySiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzureSpringBoot/springbootsites/{siteName}/summaries" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + 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-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySiteHandleResponse handles the ListBySite response. +func (client *SummariesClient) listBySiteHandleResponse(resp *http.Response) (SummariesClientListBySiteResponse, error) { + result := SummariesClientListBySiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SummaryList); err != nil { + return SummariesClientListBySiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/summaries_client_example_test.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/summaries_client_example_test.go new file mode 100644 index 000000000000..d62520c70aa0 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/summaries_client_example_test.go @@ -0,0 +1,158 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armspringappdiscovery_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/springappdiscovery/armspringappdiscovery" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/Summaries_Get_MaximumSet_Gen.json +func ExampleSummariesClient_Get_summariesGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSummariesClient().Get(ctx, "rgspringbootdiscovery", "xxkzlvbihwxunadjcpjpjmghmhxrqyvghtpfps", "vjB", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Summary = armspringappdiscovery.Summary{ + // Name: to.Ptr("gntlsuizarosogjemzapadnhu"), + // Type: to.Ptr("patxegcogfdxwobof"), + // ID: to.Ptr("flpga"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T16:44:32.561Z"); return t}()), + // CreatedBy: to.Ptr("ztjtyfhicmxcpqszeovgojwzceagbc"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T16:44:32.562Z"); return t}()), + // LastModifiedBy: to.Ptr("isjllzvqodp"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Properties: &armspringappdiscovery.SummariesProperties{ + // DiscoveredApps: to.Ptr[int64](24), + // DiscoveredServers: to.Ptr[int64](22), + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key9287": to.Ptr("utoxkd"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/Summaries_Get_MinimumSet_Gen.json +func ExampleSummariesClient_Get_summariesGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSummariesClient().Get(ctx, "rgspringbootdiscovery", "xxkzlvbihwxunadjcpjpjmghmhxrqyvghtpfps", "vjB", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Summary = armspringappdiscovery.Summary{ + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.OffAzureSpringBoot/springbootsites/testsite1/summaries/default"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/Summaries_ListBySite_MaximumSet_Gen.json +func ExampleSummariesClient_NewListBySitePager_summariesListBySiteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSummariesClient().NewListBySitePager("rgspringbootdiscovery", "xxkzlvbihwxunadjcpjpjmghmhxrqyvghtpfps", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SummaryList = armspringappdiscovery.SummaryList{ + // Value: []*armspringappdiscovery.Summary{ + // { + // Name: to.Ptr("gntlsuizarosogjemzapadnhu"), + // Type: to.Ptr("patxegcogfdxwobof"), + // ID: to.Ptr("flpga"), + // SystemData: &armspringappdiscovery.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T16:44:32.561Z"); return t}()), + // CreatedBy: to.Ptr("ztjtyfhicmxcpqszeovgojwzceagbc"), + // CreatedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T16:44:32.562Z"); return t}()), + // LastModifiedBy: to.Ptr("isjllzvqodp"), + // LastModifiedByType: to.Ptr(armspringappdiscovery.CreatedByTypeUser), + // }, + // Properties: &armspringappdiscovery.SummariesProperties{ + // DiscoveredApps: to.Ptr[int64](24), + // DiscoveredServers: to.Ptr[int64](22), + // ProvisioningState: to.Ptr(armspringappdiscovery.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key9287": to.Ptr("utoxkd"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/offazurespringboot/resource-manager/Microsoft.OffAzureSpringBoot/preview/2023-01-01-preview/examples/Summaries_ListBySite_MinimumSet_Gen.json +func ExampleSummariesClient_NewListBySitePager_summariesListBySiteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armspringappdiscovery.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSummariesClient().NewListBySitePager("rgspringbootdiscovery", "xxkzlvbihwxunadjcpjpjmghmhxrqyvghtpfps", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SummaryList = armspringappdiscovery.SummaryList{ + // } + } +} diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/time_rfc3339.go b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/time_rfc3339.go new file mode 100644 index 000000000000..04247f696ef2 --- /dev/null +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/time_rfc3339.go @@ -0,0 +1,86 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armspringappdiscovery + +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 ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +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 { + layout := utcDateTimeJSON + if tzOffsetRegex.Match(data) { + layout = dateTimeJSON + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + 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 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 || strings.EqualFold(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 +} From e567f7078c0337dfdaaab49ae5514ebb1e504a05 Mon Sep 17 00:00:00 2001 From: Peng Jiahui <46921893+Alancere@users.noreply.github.com> Date: Thu, 1 Feb 2024 10:30:06 +0800 Subject: [PATCH 2/2] Update release date --- .../springappdiscovery/armspringappdiscovery/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/CHANGELOG.md b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/CHANGELOG.md index 79659c640a39..cf27a3eef7bd 100644 --- a/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/CHANGELOG.md +++ b/sdk/resourcemanager/springappdiscovery/armspringappdiscovery/CHANGELOG.md @@ -1,7 +1,7 @@ # Release History -## 0.1.0 (2024-01-26) +## 0.1.0 (2024-02-01) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/springappdiscovery/armspringappdiscovery` 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 +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt).