From 5272016acb5ca0f3ed72968b6056e03823c64a05 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 2 Nov 2022 07:42:52 +0000 Subject: [PATCH] CodeGen from PR 20791 in Azure/azure-rest-api-specs Utkarshjain/elastic private repo sync 09 2022 (#20791) * Base commit 1 * Added version 2022-05-05-preview * base commit 2 * Added version 2022-07-01-preview * Updating readme * Updating default tag * Fix CI isssues * Revert "Fix CI isssues" This reverts commit d41723396e473d7b207ae14ebfc85180dddbf07e. * Update readme.md * Update readme.python.md * fixing version in examples * Arm change request 1 Co-authored-by: Utkarsh Jain Co-authored-by: Yuchao Yan --- .../elastic/armelastic/CHANGELOG.md | 79 + .../armelastic/alltrafficfilters_client.go | 120 ++ .../associatetrafficfilter_client.go | 130 ++ .../elastic/armelastic/autorest.md | 6 +- ...zz_generated_constants.go => constants.go} | 40 +- .../createandassociateipfilter_client.go | 133 ++ .../createandassociateplfilter_client.go | 136 ++ ...nfo_client.go => deploymentinfo_client.go} | 5 +- .../detachanddeletetrafficfilter_client.go | 115 ++ .../armelastic/detachtrafficfilter_client.go | 130 ++ .../elastic/armelastic/externaluser_client.go | 125 ++ sdk/resourcemanager/elastic/armelastic/go.mod | 14 +- sdk/resourcemanager/elastic/armelastic/go.sum | 24 +- .../listassociatedtrafficfilters_client.go | 121 ++ .../{zz_generated_models.go => models.go} | 176 +++ .../elastic/armelastic/models_serde.go | 1353 +++++++++++++++++ .../elastic/armelastic/monitor_client.go | 129 ++ ...client.go => monitoredresources_client.go} | 6 +- ..._monitors_client.go => monitors_client.go} | 31 +- ...rations_client.go => operations_client.go} | 6 +- ...ed_response_types.go => response_types.go} | 56 + ..._tagrules_client.go => tagrules_client.go} | 20 +- ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + .../armelastic/trafficfilters_client.go | 114 ++ .../armelastic/upgradableversions_client.go | 121 ++ ...ction_client.go => vmcollection_client.go} | 5 +- ...ated_vmhost_client.go => vmhost_client.go} | 6 +- ...estion_client.go => vmingestion_client.go} | 5 +- ...ated_example_deploymentinfo_client_test.go | 39 - ..._example_monitoredresources_client_test.go | 43 - ..._generated_example_monitors_client_test.go | 160 -- ...enerated_example_operations_client_test.go | 41 - ..._generated_example_tagrules_client_test.go | 114 -- ...erated_example_vmcollection_client_test.go | 37 - ...ze_generated_example_vmhost_client_test.go | 43 - ...nerated_example_vmingestion_client_test.go | 39 - .../armelastic/zz_generated_models_serde.go | 123 -- 37 files changed, 3130 insertions(+), 716 deletions(-) create mode 100644 sdk/resourcemanager/elastic/armelastic/alltrafficfilters_client.go create mode 100644 sdk/resourcemanager/elastic/armelastic/associatetrafficfilter_client.go rename sdk/resourcemanager/elastic/armelastic/{zz_generated_constants.go => constants.go} (81%) create mode 100644 sdk/resourcemanager/elastic/armelastic/createandassociateipfilter_client.go create mode 100644 sdk/resourcemanager/elastic/armelastic/createandassociateplfilter_client.go rename sdk/resourcemanager/elastic/armelastic/{zz_generated_deploymentinfo_client.go => deploymentinfo_client.go} (97%) create mode 100644 sdk/resourcemanager/elastic/armelastic/detachanddeletetrafficfilter_client.go create mode 100644 sdk/resourcemanager/elastic/armelastic/detachtrafficfilter_client.go create mode 100644 sdk/resourcemanager/elastic/armelastic/externaluser_client.go create mode 100644 sdk/resourcemanager/elastic/armelastic/listassociatedtrafficfilters_client.go rename sdk/resourcemanager/elastic/armelastic/{zz_generated_models.go => models.go} (74%) create mode 100644 sdk/resourcemanager/elastic/armelastic/models_serde.go create mode 100644 sdk/resourcemanager/elastic/armelastic/monitor_client.go rename sdk/resourcemanager/elastic/armelastic/{zz_generated_monitoredresources_client.go => monitoredresources_client.go} (97%) rename sdk/resourcemanager/elastic/armelastic/{zz_generated_monitors_client.go => monitors_client.go} (95%) rename sdk/resourcemanager/elastic/armelastic/{zz_generated_operations_client.go => operations_client.go} (96%) rename sdk/resourcemanager/elastic/armelastic/{zz_generated_response_types.go => response_types.go} (60%) rename sdk/resourcemanager/elastic/armelastic/{zz_generated_tagrules_client.go => tagrules_client.go} (96%) rename sdk/resourcemanager/elastic/armelastic/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) create mode 100644 sdk/resourcemanager/elastic/armelastic/trafficfilters_client.go create mode 100644 sdk/resourcemanager/elastic/armelastic/upgradableversions_client.go rename sdk/resourcemanager/elastic/armelastic/{zz_generated_vmcollection_client.go => vmcollection_client.go} (97%) rename sdk/resourcemanager/elastic/armelastic/{zz_generated_vmhost_client.go => vmhost_client.go} (97%) rename sdk/resourcemanager/elastic/armelastic/{zz_generated_vmingestion_client.go => vmingestion_client.go} (97%) delete mode 100644 sdk/resourcemanager/elastic/armelastic/ze_generated_example_deploymentinfo_client_test.go delete mode 100644 sdk/resourcemanager/elastic/armelastic/ze_generated_example_monitoredresources_client_test.go delete mode 100644 sdk/resourcemanager/elastic/armelastic/ze_generated_example_monitors_client_test.go delete mode 100644 sdk/resourcemanager/elastic/armelastic/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/elastic/armelastic/ze_generated_example_tagrules_client_test.go delete mode 100644 sdk/resourcemanager/elastic/armelastic/ze_generated_example_vmcollection_client_test.go delete mode 100644 sdk/resourcemanager/elastic/armelastic/ze_generated_example_vmhost_client_test.go delete mode 100644 sdk/resourcemanager/elastic/armelastic/ze_generated_example_vmingestion_client_test.go delete mode 100644 sdk/resourcemanager/elastic/armelastic/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/elastic/armelastic/CHANGELOG.md b/sdk/resourcemanager/elastic/armelastic/CHANGELOG.md index 64034ee4d82e..17e5c612dfee 100644 --- a/sdk/resourcemanager/elastic/armelastic/CHANGELOG.md +++ b/sdk/resourcemanager/elastic/armelastic/CHANGELOG.md @@ -1,5 +1,84 @@ # Release History +## 0.6.0 (2022-11-02) +### Features Added + +- New const `APIVersionParameterTwoThousandTwenty0701` +- New const `TypeAzurePrivateEndpoint` +- New const `APIVersionParameterTwoThousandTwentyOne0901Preview` +- New const `APIVersionParameterTwoThousandTwentyOne1001Preview` +- New const `TypeIP` +- New const `APIVersionParameterTwoThousandTwentyTwo0505Preview` +- New const `APIVersionParameterTwoThousandTwenty0701Preview` +- New type alias `APIVersionParameter` +- New type alias `Type` +- New function `*ListAssociatedTrafficFiltersClient.List(context.Context, string, string, *ListAssociatedTrafficFiltersClientListOptions) (ListAssociatedTrafficFiltersClientListResponse, error)` +- New function `NewListAssociatedTrafficFiltersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ListAssociatedTrafficFiltersClient, error)` +- New function `NewAssociateTrafficFilterClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AssociateTrafficFilterClient, error)` +- New function `*AllTrafficFiltersClient.List(context.Context, string, string, *AllTrafficFiltersClientListOptions) (AllTrafficFiltersClientListResponse, error)` +- New function `*MonitorClient.BeginUpgrade(context.Context, string, string, *MonitorClientBeginUpgradeOptions) (*runtime.Poller[MonitorClientUpgradeResponse], error)` +- New function `NewUpgradableVersionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*UpgradableVersionsClient, error)` +- New function `*UpgradableVersionsClient.Details(context.Context, string, string, *UpgradableVersionsClientDetailsOptions) (UpgradableVersionsClientDetailsResponse, error)` +- New function `*CreateAndAssociateIPFilterClient.BeginCreate(context.Context, string, string, *CreateAndAssociateIPFilterClientBeginCreateOptions) (*runtime.Poller[CreateAndAssociateIPFilterClientCreateResponse], error)` +- New function `*ExternalUserClient.CreateOrUpdate(context.Context, string, string, *ExternalUserClientCreateOrUpdateOptions) (ExternalUserClientCreateOrUpdateResponse, error)` +- New function `*DetachAndDeleteTrafficFilterClient.Delete(context.Context, string, string, *DetachAndDeleteTrafficFilterClientDeleteOptions) (DetachAndDeleteTrafficFilterClientDeleteResponse, error)` +- New function `NewDetachTrafficFilterClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DetachTrafficFilterClient, error)` +- New function `NewDetachAndDeleteTrafficFilterClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DetachAndDeleteTrafficFilterClient, error)` +- New function `PossibleTypeValues() []Type` +- New function `*CreateAndAssociatePLFilterClient.BeginCreate(context.Context, string, string, *CreateAndAssociatePLFilterClientBeginCreateOptions) (*runtime.Poller[CreateAndAssociatePLFilterClientCreateResponse], error)` +- New function `*DetachTrafficFilterClient.BeginUpdate(context.Context, string, string, *DetachTrafficFilterClientBeginUpdateOptions) (*runtime.Poller[DetachTrafficFilterClientUpdateResponse], error)` +- New function `NewMonitorClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MonitorClient, error)` +- New function `*TrafficFiltersClient.Delete(context.Context, string, string, *TrafficFiltersClientDeleteOptions) (TrafficFiltersClientDeleteResponse, error)` +- New function `NewTrafficFiltersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TrafficFiltersClient, error)` +- New function `PossibleAPIVersionParameterValues() []APIVersionParameter` +- New function `*AssociateTrafficFilterClient.BeginAssociate(context.Context, string, string, *AssociateTrafficFilterClientBeginAssociateOptions) (*runtime.Poller[AssociateTrafficFilterClientAssociateResponse], error)` +- New function `NewExternalUserClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ExternalUserClient, error)` +- New function `NewCreateAndAssociatePLFilterClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CreateAndAssociatePLFilterClient, error)` +- New function `NewAllTrafficFiltersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AllTrafficFiltersClient, error)` +- New function `NewCreateAndAssociateIPFilterClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CreateAndAssociateIPFilterClient, error)` +- New struct `AllTrafficFiltersClient` +- New struct `AllTrafficFiltersClientListOptions` +- New struct `AllTrafficFiltersClientListResponse` +- New struct `AssociateTrafficFilterClient` +- New struct `AssociateTrafficFilterClientAssociateResponse` +- New struct `AssociateTrafficFilterClientBeginAssociateOptions` +- New struct `CreateAndAssociateIPFilterClient` +- New struct `CreateAndAssociateIPFilterClientBeginCreateOptions` +- New struct `CreateAndAssociateIPFilterClientCreateResponse` +- New struct `CreateAndAssociatePLFilterClient` +- New struct `CreateAndAssociatePLFilterClientBeginCreateOptions` +- New struct `CreateAndAssociatePLFilterClientCreateResponse` +- New struct `DetachAndDeleteTrafficFilterClient` +- New struct `DetachAndDeleteTrafficFilterClientDeleteOptions` +- New struct `DetachAndDeleteTrafficFilterClientDeleteResponse` +- New struct `DetachTrafficFilterClient` +- New struct `DetachTrafficFilterClientBeginUpdateOptions` +- New struct `DetachTrafficFilterClientUpdateResponse` +- New struct `ExternalUserClient` +- New struct `ExternalUserClientCreateOrUpdateOptions` +- New struct `ExternalUserClientCreateOrUpdateResponse` +- New struct `ExternalUserCreationResponse` +- New struct `ExternalUserInfo` +- New struct `ListAssociatedTrafficFiltersClient` +- New struct `ListAssociatedTrafficFiltersClientListOptions` +- New struct `ListAssociatedTrafficFiltersClientListResponse` +- New struct `MonitorClient` +- New struct `MonitorClientBeginUpgradeOptions` +- New struct `MonitorClientUpgradeResponse` +- New struct `MonitorUpgrade` +- New struct `TrafficFilter` +- New struct `TrafficFilterResponse` +- New struct `TrafficFilterRule` +- New struct `TrafficFiltersClient` +- New struct `TrafficFiltersClientDeleteOptions` +- New struct `TrafficFiltersClientDeleteResponse` +- New struct `UpgradableVersionsClient` +- New struct `UpgradableVersionsClientDetailsOptions` +- New struct `UpgradableVersionsClientDetailsResponse` +- New struct `UpgradableVersionsList` +- New field `Version` in struct `MonitorProperties` + + ## 0.5.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.5.0, which contains breaking changes. diff --git a/sdk/resourcemanager/elastic/armelastic/alltrafficfilters_client.go b/sdk/resourcemanager/elastic/armelastic/alltrafficfilters_client.go new file mode 100644 index 000000000000..36587b1a2bed --- /dev/null +++ b/sdk/resourcemanager/elastic/armelastic/alltrafficfilters_client.go @@ -0,0 +1,120 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// 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 armelastic + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AllTrafficFiltersClient contains the methods for the AllTrafficFilters group. +// Don't use this type directly, use NewAllTrafficFiltersClient() instead. +type AllTrafficFiltersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAllTrafficFiltersClient creates a new instance of AllTrafficFiltersClient with the specified values. +// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAllTrafficFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AllTrafficFiltersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AllTrafficFiltersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// List - Get the list of all traffic filters for the account. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group to which the Elastic resource belongs. +// monitorName - Monitor resource name +// options - AllTrafficFiltersClientListOptions contains the optional parameters for the AllTrafficFiltersClient.List method. +func (client *AllTrafficFiltersClient) List(ctx context.Context, resourceGroupName string, monitorName string, options *AllTrafficFiltersClientListOptions) (AllTrafficFiltersClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return AllTrafficFiltersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AllTrafficFiltersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AllTrafficFiltersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *AllTrafficFiltersClient) listCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *AllTrafficFiltersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAllTrafficFilters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-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 *AllTrafficFiltersClient) listHandleResponse(resp *http.Response) (AllTrafficFiltersClientListResponse, error) { + result := AllTrafficFiltersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TrafficFilterResponse); err != nil { + return AllTrafficFiltersClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/elastic/armelastic/associatetrafficfilter_client.go b/sdk/resourcemanager/elastic/armelastic/associatetrafficfilter_client.go new file mode 100644 index 000000000000..8faf175a506e --- /dev/null +++ b/sdk/resourcemanager/elastic/armelastic/associatetrafficfilter_client.go @@ -0,0 +1,130 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// 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 armelastic + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AssociateTrafficFilterClient contains the methods for the AssociateTrafficFilter group. +// Don't use this type directly, use NewAssociateTrafficFilterClient() instead. +type AssociateTrafficFilterClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAssociateTrafficFilterClient creates a new instance of AssociateTrafficFilterClient with the specified values. +// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAssociateTrafficFilterClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssociateTrafficFilterClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AssociateTrafficFilterClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginAssociate - Associate traffic filter for the given deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group to which the Elastic resource belongs. +// monitorName - Monitor resource name +// options - AssociateTrafficFilterClientBeginAssociateOptions contains the optional parameters for the AssociateTrafficFilterClient.BeginAssociate +// method. +func (client *AssociateTrafficFilterClient) BeginAssociate(ctx context.Context, resourceGroupName string, monitorName string, options *AssociateTrafficFilterClientBeginAssociateOptions) (*runtime.Poller[AssociateTrafficFilterClientAssociateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.associate(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[AssociateTrafficFilterClientAssociateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[AssociateTrafficFilterClientAssociateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Associate - Associate traffic filter for the given deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +func (client *AssociateTrafficFilterClient) associate(ctx context.Context, resourceGroupName string, monitorName string, options *AssociateTrafficFilterClientBeginAssociateOptions) (*http.Response, error) { + req, err := client.associateCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// associateCreateRequest creates the Associate request. +func (client *AssociateTrafficFilterClient) associateCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *AssociateTrafficFilterClientBeginAssociateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/associateTrafficFilter" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + if options != nil && options.RulesetID != nil { + reqQP.Set("rulesetId", *options.RulesetID) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/elastic/armelastic/autorest.md b/sdk/resourcemanager/elastic/armelastic/autorest.md index 9311e0e06e4d..5d4a0281336a 100644 --- a/sdk/resourcemanager/elastic/armelastic/autorest.md +++ b/sdk/resourcemanager/elastic/armelastic/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/elastic/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/elastic/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/elastic/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/elastic/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.5.0 +module-version: 0.6.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/elastic/armelastic/zz_generated_constants.go b/sdk/resourcemanager/elastic/armelastic/constants.go similarity index 81% rename from sdk/resourcemanager/elastic/armelastic/zz_generated_constants.go rename to sdk/resourcemanager/elastic/armelastic/constants.go index db00a64bd48a..ac14f15bc84c 100644 --- a/sdk/resourcemanager/elastic/armelastic/zz_generated_constants.go +++ b/sdk/resourcemanager/elastic/armelastic/constants.go @@ -13,14 +13,36 @@ // limitations under the License. // 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 armelastic const ( moduleName = "armelastic" - moduleVersion = "v0.5.0" + moduleVersion = "v0.6.0" ) +type APIVersionParameter string + +const ( + APIVersionParameterTwoThousandTwenty0701 APIVersionParameter = "2020-07-01" + APIVersionParameterTwoThousandTwenty0701Preview APIVersionParameter = "2020-07-01-preview" + APIVersionParameterTwoThousandTwentyOne0901Preview APIVersionParameter = "2021-09-01-preview" + APIVersionParameterTwoThousandTwentyOne1001Preview APIVersionParameter = "2021-10-01-preview" + APIVersionParameterTwoThousandTwentyTwo0505Preview APIVersionParameter = "2022-05-05-preview" +) + +// PossibleAPIVersionParameterValues returns the possible values for the APIVersionParameter const type. +func PossibleAPIVersionParameterValues() []APIVersionParameter { + return []APIVersionParameter{ + APIVersionParameterTwoThousandTwenty0701, + APIVersionParameterTwoThousandTwenty0701Preview, + APIVersionParameterTwoThousandTwentyOne0901Preview, + APIVersionParameterTwoThousandTwentyOne1001Preview, + APIVersionParameterTwoThousandTwentyTwo0505Preview, + } +} + // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -179,3 +201,19 @@ func PossibleTagActionValues() []TagAction { TagActionInclude, } } + +// Type - Type of the elastic filter +type Type string + +const ( + TypeAzurePrivateEndpoint Type = "azure_private_endpoint" + TypeIP Type = "ip" +) + +// PossibleTypeValues returns the possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{ + TypeAzurePrivateEndpoint, + TypeIP, + } +} diff --git a/sdk/resourcemanager/elastic/armelastic/createandassociateipfilter_client.go b/sdk/resourcemanager/elastic/armelastic/createandassociateipfilter_client.go new file mode 100644 index 000000000000..91540e714e30 --- /dev/null +++ b/sdk/resourcemanager/elastic/armelastic/createandassociateipfilter_client.go @@ -0,0 +1,133 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// 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 armelastic + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CreateAndAssociateIPFilterClient contains the methods for the CreateAndAssociateIPFilter group. +// Don't use this type directly, use NewCreateAndAssociateIPFilterClient() instead. +type CreateAndAssociateIPFilterClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCreateAndAssociateIPFilterClient creates a new instance of CreateAndAssociateIPFilterClient with the specified values. +// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCreateAndAssociateIPFilterClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CreateAndAssociateIPFilterClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CreateAndAssociateIPFilterClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreate - Create and Associate IP traffic filter for the given deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group to which the Elastic resource belongs. +// monitorName - Monitor resource name +// options - CreateAndAssociateIPFilterClientBeginCreateOptions contains the optional parameters for the CreateAndAssociateIPFilterClient.BeginCreate +// method. +func (client *CreateAndAssociateIPFilterClient) BeginCreate(ctx context.Context, resourceGroupName string, monitorName string, options *CreateAndAssociateIPFilterClientBeginCreateOptions) (*runtime.Poller[CreateAndAssociateIPFilterClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CreateAndAssociateIPFilterClientCreateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CreateAndAssociateIPFilterClientCreateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Create - Create and Associate IP traffic filter for the given deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +func (client *CreateAndAssociateIPFilterClient) create(ctx context.Context, resourceGroupName string, monitorName string, options *CreateAndAssociateIPFilterClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *CreateAndAssociateIPFilterClient) createCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *CreateAndAssociateIPFilterClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociateIPFilter" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + if options != nil && options.IPs != nil { + reqQP.Set("ips", *options.IPs) + } + if options != nil && options.Name != nil { + reqQP.Set("name", *options.Name) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/elastic/armelastic/createandassociateplfilter_client.go b/sdk/resourcemanager/elastic/armelastic/createandassociateplfilter_client.go new file mode 100644 index 000000000000..41621a95a63c --- /dev/null +++ b/sdk/resourcemanager/elastic/armelastic/createandassociateplfilter_client.go @@ -0,0 +1,136 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// 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 armelastic + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CreateAndAssociatePLFilterClient contains the methods for the CreateAndAssociatePLFilter group. +// Don't use this type directly, use NewCreateAndAssociatePLFilterClient() instead. +type CreateAndAssociatePLFilterClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCreateAndAssociatePLFilterClient creates a new instance of CreateAndAssociatePLFilterClient with the specified values. +// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCreateAndAssociatePLFilterClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CreateAndAssociatePLFilterClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CreateAndAssociatePLFilterClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreate - Create and Associate private link traffic filter for the given deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group to which the Elastic resource belongs. +// monitorName - Monitor resource name +// options - CreateAndAssociatePLFilterClientBeginCreateOptions contains the optional parameters for the CreateAndAssociatePLFilterClient.BeginCreate +// method. +func (client *CreateAndAssociatePLFilterClient) BeginCreate(ctx context.Context, resourceGroupName string, monitorName string, options *CreateAndAssociatePLFilterClientBeginCreateOptions) (*runtime.Poller[CreateAndAssociatePLFilterClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CreateAndAssociatePLFilterClientCreateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CreateAndAssociatePLFilterClientCreateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Create - Create and Associate private link traffic filter for the given deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +func (client *CreateAndAssociatePLFilterClient) create(ctx context.Context, resourceGroupName string, monitorName string, options *CreateAndAssociatePLFilterClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *CreateAndAssociatePLFilterClient) createCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *CreateAndAssociatePLFilterClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociatePLFilter" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + if options != nil && options.Name != nil { + reqQP.Set("name", *options.Name) + } + if options != nil && options.PrivateEndpointGUID != nil { + reqQP.Set("privateEndpointGuid", *options.PrivateEndpointGUID) + } + if options != nil && options.PrivateEndpointName != nil { + reqQP.Set("privateEndpointName", *options.PrivateEndpointName) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/elastic/armelastic/zz_generated_deploymentinfo_client.go b/sdk/resourcemanager/elastic/armelastic/deploymentinfo_client.go similarity index 97% rename from sdk/resourcemanager/elastic/armelastic/zz_generated_deploymentinfo_client.go rename to sdk/resourcemanager/elastic/armelastic/deploymentinfo_client.go index d65028113f90..863b871ce7ec 100644 --- a/sdk/resourcemanager/elastic/armelastic/zz_generated_deploymentinfo_client.go +++ b/sdk/resourcemanager/elastic/armelastic/deploymentinfo_client.go @@ -13,6 +13,7 @@ // limitations under the License. // 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 armelastic @@ -64,7 +65,7 @@ func NewDeploymentInfoClient(subscriptionID string, credential azcore.TokenCrede // List - Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // monitorName - Monitor resource name // options - DeploymentInfoClientListOptions contains the optional parameters for the DeploymentInfoClient.List method. @@ -103,7 +104,7 @@ func (client *DeploymentInfoClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/elastic/armelastic/detachanddeletetrafficfilter_client.go b/sdk/resourcemanager/elastic/armelastic/detachanddeletetrafficfilter_client.go new file mode 100644 index 000000000000..580fdfabe04c --- /dev/null +++ b/sdk/resourcemanager/elastic/armelastic/detachanddeletetrafficfilter_client.go @@ -0,0 +1,115 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// 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 armelastic + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DetachAndDeleteTrafficFilterClient contains the methods for the DetachAndDeleteTrafficFilter group. +// Don't use this type directly, use NewDetachAndDeleteTrafficFilterClient() instead. +type DetachAndDeleteTrafficFilterClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDetachAndDeleteTrafficFilterClient creates a new instance of DetachAndDeleteTrafficFilterClient with the specified values. +// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDetachAndDeleteTrafficFilterClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DetachAndDeleteTrafficFilterClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DetachAndDeleteTrafficFilterClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Delete - Detach and Delete traffic filter from the given deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group to which the Elastic resource belongs. +// monitorName - Monitor resource name +// options - DetachAndDeleteTrafficFilterClientDeleteOptions contains the optional parameters for the DetachAndDeleteTrafficFilterClient.Delete +// method. +func (client *DetachAndDeleteTrafficFilterClient) Delete(ctx context.Context, resourceGroupName string, monitorName string, options *DetachAndDeleteTrafficFilterClientDeleteOptions) (DetachAndDeleteTrafficFilterClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return DetachAndDeleteTrafficFilterClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DetachAndDeleteTrafficFilterClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DetachAndDeleteTrafficFilterClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return DetachAndDeleteTrafficFilterClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DetachAndDeleteTrafficFilterClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *DetachAndDeleteTrafficFilterClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachAndDeleteTrafficFilter" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + if options != nil && options.RulesetID != nil { + reqQP.Set("rulesetId", *options.RulesetID) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/elastic/armelastic/detachtrafficfilter_client.go b/sdk/resourcemanager/elastic/armelastic/detachtrafficfilter_client.go new file mode 100644 index 000000000000..f5b6d2b96871 --- /dev/null +++ b/sdk/resourcemanager/elastic/armelastic/detachtrafficfilter_client.go @@ -0,0 +1,130 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// 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 armelastic + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DetachTrafficFilterClient contains the methods for the DetachTrafficFilter group. +// Don't use this type directly, use NewDetachTrafficFilterClient() instead. +type DetachTrafficFilterClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDetachTrafficFilterClient creates a new instance of DetachTrafficFilterClient with the specified values. +// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDetachTrafficFilterClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DetachTrafficFilterClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DetachTrafficFilterClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginUpdate - Detach traffic filter for the given deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group to which the Elastic resource belongs. +// monitorName - Monitor resource name +// options - DetachTrafficFilterClientBeginUpdateOptions contains the optional parameters for the DetachTrafficFilterClient.BeginUpdate +// method. +func (client *DetachTrafficFilterClient) BeginUpdate(ctx context.Context, resourceGroupName string, monitorName string, options *DetachTrafficFilterClientBeginUpdateOptions) (*runtime.Poller[DetachTrafficFilterClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DetachTrafficFilterClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DetachTrafficFilterClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Detach traffic filter for the given deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +func (client *DetachTrafficFilterClient) update(ctx context.Context, resourceGroupName string, monitorName string, options *DetachTrafficFilterClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *DetachTrafficFilterClient) updateCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *DetachTrafficFilterClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachTrafficFilter" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + if options != nil && options.RulesetID != nil { + reqQP.Set("rulesetId", *options.RulesetID) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/elastic/armelastic/externaluser_client.go b/sdk/resourcemanager/elastic/armelastic/externaluser_client.go new file mode 100644 index 000000000000..d04280112650 --- /dev/null +++ b/sdk/resourcemanager/elastic/armelastic/externaluser_client.go @@ -0,0 +1,125 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// 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 armelastic + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExternalUserClient contains the methods for the ExternalUser group. +// Don't use this type directly, use NewExternalUserClient() instead. +type ExternalUserClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExternalUserClient creates a new instance of ExternalUserClient with the specified values. +// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExternalUserClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExternalUserClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExternalUserClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create User inside elastic deployment which are used by customers to perform operations on the elastic +// deployment +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group to which the Elastic resource belongs. +// monitorName - Monitor resource name +// options - ExternalUserClientCreateOrUpdateOptions contains the optional parameters for the ExternalUserClient.CreateOrUpdate +// method. +func (client *ExternalUserClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, options *ExternalUserClientCreateOrUpdateOptions) (ExternalUserClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return ExternalUserClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExternalUserClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExternalUserClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ExternalUserClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *ExternalUserClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createOrUpdateExternalUser" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ExternalUserClient) createOrUpdateHandleResponse(resp *http.Response) (ExternalUserClientCreateOrUpdateResponse, error) { + result := ExternalUserClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExternalUserCreationResponse); err != nil { + return ExternalUserClientCreateOrUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/elastic/armelastic/go.mod b/sdk/resourcemanager/elastic/armelastic/go.mod index 0d8b890c442a..625e7e37a024 100644 --- a/sdk/resourcemanager/elastic/armelastic/go.mod +++ b/sdk/resourcemanager/elastic/armelastic/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/elastic/armelastic/go.sum b/sdk/resourcemanager/elastic/armelastic/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/elastic/armelastic/go.sum +++ b/sdk/resourcemanager/elastic/armelastic/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.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/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/elastic/armelastic/listassociatedtrafficfilters_client.go b/sdk/resourcemanager/elastic/armelastic/listassociatedtrafficfilters_client.go new file mode 100644 index 000000000000..869134347ff8 --- /dev/null +++ b/sdk/resourcemanager/elastic/armelastic/listassociatedtrafficfilters_client.go @@ -0,0 +1,121 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// 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 armelastic + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ListAssociatedTrafficFiltersClient contains the methods for the ListAssociatedTrafficFilters group. +// Don't use this type directly, use NewListAssociatedTrafficFiltersClient() instead. +type ListAssociatedTrafficFiltersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewListAssociatedTrafficFiltersClient creates a new instance of ListAssociatedTrafficFiltersClient with the specified values. +// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewListAssociatedTrafficFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ListAssociatedTrafficFiltersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ListAssociatedTrafficFiltersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// List - Get the list of all associated traffic filters for the given deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group to which the Elastic resource belongs. +// monitorName - Monitor resource name +// options - ListAssociatedTrafficFiltersClientListOptions contains the optional parameters for the ListAssociatedTrafficFiltersClient.List +// method. +func (client *ListAssociatedTrafficFiltersClient) List(ctx context.Context, resourceGroupName string, monitorName string, options *ListAssociatedTrafficFiltersClientListOptions) (ListAssociatedTrafficFiltersClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return ListAssociatedTrafficFiltersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ListAssociatedTrafficFiltersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ListAssociatedTrafficFiltersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *ListAssociatedTrafficFiltersClient) listCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *ListAssociatedTrafficFiltersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAssociatedTrafficFilters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-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 *ListAssociatedTrafficFiltersClient) listHandleResponse(resp *http.Response) (ListAssociatedTrafficFiltersClientListResponse, error) { + result := ListAssociatedTrafficFiltersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TrafficFilterResponse); err != nil { + return ListAssociatedTrafficFiltersClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/elastic/armelastic/zz_generated_models.go b/sdk/resourcemanager/elastic/armelastic/models.go similarity index 74% rename from sdk/resourcemanager/elastic/armelastic/zz_generated_models.go rename to sdk/resourcemanager/elastic/armelastic/models.go index 4206a53da629..ba1e43087891 100644 --- a/sdk/resourcemanager/elastic/armelastic/zz_generated_models.go +++ b/sdk/resourcemanager/elastic/armelastic/models.go @@ -13,11 +13,26 @@ // limitations under the License. // 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 armelastic import "time" +// AllTrafficFiltersClientListOptions contains the optional parameters for the AllTrafficFiltersClient.List method. +type AllTrafficFiltersClientListOptions struct { + // placeholder for future optional parameters +} + +// AssociateTrafficFilterClientBeginAssociateOptions contains the optional parameters for the AssociateTrafficFilterClient.BeginAssociate +// method. +type AssociateTrafficFilterClientBeginAssociateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // Ruleset Id of the filter + RulesetID *string +} + // CloudDeployment - Details of the user's elastic deployment associated with the monitor resource. type CloudDeployment struct { // READ-ONLY; Associated Azure subscription Id for the elastic deployment. @@ -72,6 +87,30 @@ type CompanyInfo struct { State *string `json:"state,omitempty"` } +// CreateAndAssociateIPFilterClientBeginCreateOptions contains the optional parameters for the CreateAndAssociateIPFilterClient.BeginCreate +// method. +type CreateAndAssociateIPFilterClientBeginCreateOptions struct { + // List of ips + IPs *string + // Name of the traffic filter + Name *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CreateAndAssociatePLFilterClientBeginCreateOptions contains the optional parameters for the CreateAndAssociatePLFilterClient.BeginCreate +// method. +type CreateAndAssociatePLFilterClientBeginCreateOptions struct { + // Name of the traffic filter + Name *string + // Guid of the private endpoint + PrivateEndpointGUID *string + // Name of the private endpoint + PrivateEndpointName *string + // Resumes the LRO from the provided token. + ResumeToken string +} + // DeploymentInfoClientListOptions contains the optional parameters for the DeploymentInfoClient.List method. type DeploymentInfoClientListOptions struct { // placeholder for future optional parameters @@ -92,6 +131,22 @@ type DeploymentInfoResponse struct { Version *string `json:"version,omitempty" azure:"ro"` } +// DetachAndDeleteTrafficFilterClientDeleteOptions contains the optional parameters for the DetachAndDeleteTrafficFilterClient.Delete +// method. +type DetachAndDeleteTrafficFilterClientDeleteOptions struct { + // Ruleset Id of the filter + RulesetID *string +} + +// DetachTrafficFilterClientBeginUpdateOptions contains the optional parameters for the DetachTrafficFilterClient.BeginUpdate +// method. +type DetachTrafficFilterClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // Ruleset Id of the filter + RulesetID *string +} + // ErrorResponseBody - Error response body. type ErrorResponseBody struct { // Error code. @@ -107,6 +162,36 @@ type ErrorResponseBody struct { Target *string `json:"target,omitempty"` } +// ExternalUserClientCreateOrUpdateOptions contains the optional parameters for the ExternalUserClient.CreateOrUpdate method. +type ExternalUserClientCreateOrUpdateOptions struct { + // Elastic External User Creation Parameters + Body *ExternalUserInfo +} + +// ExternalUserCreationResponse - The properties of the response we got from elastic while creating external user +type ExternalUserCreationResponse struct { + // READ-ONLY; Shows if user is created or updated + Created *bool `json:"created,omitempty" azure:"ro"` +} + +// ExternalUserInfo - The properties of the request required for creating user on elastic side +type ExternalUserInfo struct { + // Email id of the user to be created or updated + EmailID *string `json:"emailId,omitempty"` + + // Full name of the user to be created or updated + FullName *string `json:"fullName,omitempty"` + + // Password of the user to be created or updated + Password *string `json:"password,omitempty"` + + // Roles to be assigned for created or updated user + Roles []*string `json:"roles,omitempty"` + + // Username of the user to be created or updated + UserName *string `json:"userName,omitempty"` +} + // FilteringTag - The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them // from being monitored. type FilteringTag struct { @@ -132,6 +217,12 @@ type IdentityProperties struct { TenantID *string `json:"tenantId,omitempty" azure:"ro"` } +// ListAssociatedTrafficFiltersClientListOptions contains the optional parameters for the ListAssociatedTrafficFiltersClient.List +// method. +type ListAssociatedTrafficFiltersClientListOptions struct { + // placeholder for future optional parameters +} + // LogRules - Set of rules for sending logs for the Monitor resource. type LogRules struct { // List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, @@ -150,6 +241,14 @@ type LogRules struct { SendSubscriptionLogs *bool `json:"sendSubscriptionLogs,omitempty"` } +// MonitorClientBeginUpgradeOptions contains the optional parameters for the MonitorClient.BeginUpgrade method. +type MonitorClientBeginUpgradeOptions struct { + // Elastic Monitor Upgrade Parameters + Body *MonitorUpgrade + // Resumes the LRO from the provided token. + ResumeToken string +} + // MonitorProperties - Properties specific to the monitor resource. type MonitorProperties struct { // Elastic cloud properties. @@ -164,6 +263,9 @@ type MonitorProperties struct { // User information. UserInfo *UserInfo `json:"userInfo,omitempty"` + // Version of elastic of the monitor resource + Version *string `json:"version,omitempty"` + // READ-ONLY LiftrResourceCategory *LiftrResourceCategories `json:"liftrResourceCategory,omitempty" azure:"ro"` @@ -216,6 +318,12 @@ type MonitorResourceUpdateParameters struct { Tags map[string]*string `json:"tags,omitempty"` } +// MonitorUpgrade - Upgrade elastic monitor version +type MonitorUpgrade struct { + // Version to which the elastic monitor should be upgraded to + Version *string `json:"version,omitempty"` +} + // MonitoredResource - The properties of a resource currently being monitored by the Elastic monitor resource. type MonitoredResource struct { // The ARM id of the resource. @@ -421,6 +529,74 @@ type TagRulesClientListOptions struct { // placeholder for future optional parameters } +// TrafficFilter - Elastic traffic filter object +type TrafficFilter struct { + // Description of the elastic filter + Description *string `json:"description,omitempty"` + + // Id of the elastic filter + ID *string `json:"id,omitempty"` + + // IncludeByDefault for the elastic filter + IncludeByDefault *bool `json:"includeByDefault,omitempty"` + + // Name of the elastic filter + Name *string `json:"name,omitempty"` + + // Region of the elastic filter + Region *string `json:"region,omitempty"` + + // Rules in the elastic filter + Rules []*TrafficFilterRule `json:"rules,omitempty"` + + // Type of the elastic filter + Type *Type `json:"type,omitempty"` +} + +// TrafficFilterResponse - List of elastic traffic filters in the account +type TrafficFilterResponse struct { + // List of elastic traffic filters in the account + Rulesets []*TrafficFilter `json:"rulesets,omitempty"` +} + +// TrafficFilterRule - Elastic traffic filter rule object +type TrafficFilterRule struct { + // Guid of Private Endpoint in the elastic filter rule + AzureEndpointGUID *string `json:"azureEndpointGuid,omitempty"` + + // Name of the Private Endpoint in the elastic filter rule + AzureEndpointName *string `json:"azureEndpointName,omitempty"` + + // Description of the elastic filter rule + Description *string `json:"description,omitempty"` + + // Id of the elastic filter rule + ID *string `json:"id,omitempty"` + + // IP of the elastic filter rule + Source *string `json:"source,omitempty"` +} + +// TrafficFiltersClientDeleteOptions contains the optional parameters for the TrafficFiltersClient.Delete method. +type TrafficFiltersClientDeleteOptions struct { + // Ruleset Id of the filter + RulesetID *string +} + +// UpgradableVersionsClientDetailsOptions contains the optional parameters for the UpgradableVersionsClient.Details method. +type UpgradableVersionsClientDetailsOptions struct { + // placeholder for future optional parameters +} + +// UpgradableVersionsList - Stack Versions that this version can upgrade to +type UpgradableVersionsList struct { + // Current version of the elastic monitor + CurrentVersion *string `json:"currentVersion,omitempty"` + + // Stack Versions that this version can upgrade to + UpgradableVersions []*string `json:"upgradableVersions,omitempty"` +} + // UserInfo - User Information to be passed to partners. type UserInfo struct { // Company information of the user to be passed to partners. diff --git a/sdk/resourcemanager/elastic/armelastic/models_serde.go b/sdk/resourcemanager/elastic/armelastic/models_serde.go new file mode 100644 index 000000000000..8ba1f6bc9688 --- /dev/null +++ b/sdk/resourcemanager/elastic/armelastic/models_serde.go @@ -0,0 +1,1353 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// 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 armelastic + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type CloudDeployment. +func (c CloudDeployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureSubscriptionId", c.AzureSubscriptionID) + populate(objectMap, "deploymentId", c.DeploymentID) + populate(objectMap, "elasticsearchRegion", c.ElasticsearchRegion) + populate(objectMap, "elasticsearchServiceUrl", c.ElasticsearchServiceURL) + populate(objectMap, "kibanaServiceUrl", c.KibanaServiceURL) + populate(objectMap, "kibanaSsoUrl", c.KibanaSsoURL) + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudDeployment. +func (c *CloudDeployment) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureSubscriptionId": + err = unpopulate(val, "AzureSubscriptionID", &c.AzureSubscriptionID) + delete(rawMsg, key) + case "deploymentId": + err = unpopulate(val, "DeploymentID", &c.DeploymentID) + delete(rawMsg, key) + case "elasticsearchRegion": + err = unpopulate(val, "ElasticsearchRegion", &c.ElasticsearchRegion) + delete(rawMsg, key) + case "elasticsearchServiceUrl": + err = unpopulate(val, "ElasticsearchServiceURL", &c.ElasticsearchServiceURL) + delete(rawMsg, key) + case "kibanaServiceUrl": + err = unpopulate(val, "KibanaServiceURL", &c.KibanaServiceURL) + delete(rawMsg, key) + case "kibanaSsoUrl": + err = unpopulate(val, "KibanaSsoURL", &c.KibanaSsoURL) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudUser. +func (c CloudUser) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "elasticCloudSsoDefaultUrl", c.ElasticCloudSsoDefaultURL) + populate(objectMap, "emailAddress", c.EmailAddress) + populate(objectMap, "id", c.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudUser. +func (c *CloudUser) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "elasticCloudSsoDefaultUrl": + err = unpopulate(val, "ElasticCloudSsoDefaultURL", &c.ElasticCloudSsoDefaultURL) + delete(rawMsg, key) + case "emailAddress": + err = unpopulate(val, "EmailAddress", &c.EmailAddress) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CompanyInfo. +func (c CompanyInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "business", c.Business) + populate(objectMap, "country", c.Country) + populate(objectMap, "domain", c.Domain) + populate(objectMap, "employeesNumber", c.EmployeesNumber) + populate(objectMap, "state", c.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CompanyInfo. +func (c *CompanyInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "business": + err = unpopulate(val, "Business", &c.Business) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &c.Country) + delete(rawMsg, key) + case "domain": + err = unpopulate(val, "Domain", &c.Domain) + delete(rawMsg, key) + case "employeesNumber": + err = unpopulate(val, "EmployeesNumber", &c.EmployeesNumber) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeploymentInfoResponse. +func (d DeploymentInfoResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskCapacity", d.DiskCapacity) + populate(objectMap, "memoryCapacity", d.MemoryCapacity) + populate(objectMap, "status", d.Status) + populate(objectMap, "version", d.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentInfoResponse. +func (d *DeploymentInfoResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskCapacity": + err = unpopulate(val, "DiskCapacity", &d.DiskCapacity) + delete(rawMsg, key) + case "memoryCapacity": + err = unpopulate(val, "MemoryCapacity", &d.MemoryCapacity) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &d.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseBody. +func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseBody. +func (e *ErrorResponseBody) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + 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 ExternalUserCreationResponse. +func (e ExternalUserCreationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "created", e.Created) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExternalUserCreationResponse. +func (e *ExternalUserCreationResponse) UnmarshalJSON(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 "created": + err = unpopulate(val, "Created", &e.Created) + 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 ExternalUserInfo. +func (e ExternalUserInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "emailId", e.EmailID) + populate(objectMap, "fullName", e.FullName) + populate(objectMap, "password", e.Password) + populate(objectMap, "roles", e.Roles) + populate(objectMap, "userName", e.UserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExternalUserInfo. +func (e *ExternalUserInfo) UnmarshalJSON(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 "emailId": + err = unpopulate(val, "EmailID", &e.EmailID) + delete(rawMsg, key) + case "fullName": + err = unpopulate(val, "FullName", &e.FullName) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &e.Password) + delete(rawMsg, key) + case "roles": + err = unpopulate(val, "Roles", &e.Roles) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &e.UserName) + 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 FilteringTag. +func (f FilteringTag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", f.Action) + populate(objectMap, "name", f.Name) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FilteringTag. +func (f *FilteringTag) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &f.Action) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IdentityProperties. +func (i IdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProperties. +func (i *IdentityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogRules. +func (l LogRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filteringTags", l.FilteringTags) + populate(objectMap, "sendAadLogs", l.SendAADLogs) + populate(objectMap, "sendActivityLogs", l.SendActivityLogs) + populate(objectMap, "sendSubscriptionLogs", l.SendSubscriptionLogs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogRules. +func (l *LogRules) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filteringTags": + err = unpopulate(val, "FilteringTags", &l.FilteringTags) + delete(rawMsg, key) + case "sendAadLogs": + err = unpopulate(val, "SendAADLogs", &l.SendAADLogs) + delete(rawMsg, key) + case "sendActivityLogs": + err = unpopulate(val, "SendActivityLogs", &l.SendActivityLogs) + delete(rawMsg, key) + case "sendSubscriptionLogs": + err = unpopulate(val, "SendSubscriptionLogs", &l.SendSubscriptionLogs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorProperties. +func (m MonitorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "elasticProperties", m.ElasticProperties) + populate(objectMap, "liftrResourceCategory", m.LiftrResourceCategory) + populate(objectMap, "liftrResourcePreference", m.LiftrResourcePreference) + populate(objectMap, "monitoringStatus", m.MonitoringStatus) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "userInfo", m.UserInfo) + populate(objectMap, "version", m.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorProperties. +func (m *MonitorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "elasticProperties": + err = unpopulate(val, "ElasticProperties", &m.ElasticProperties) + delete(rawMsg, key) + case "liftrResourceCategory": + err = unpopulate(val, "LiftrResourceCategory", &m.LiftrResourceCategory) + delete(rawMsg, key) + case "liftrResourcePreference": + err = unpopulate(val, "LiftrResourcePreference", &m.LiftrResourcePreference) + delete(rawMsg, key) + case "monitoringStatus": + err = unpopulate(val, "MonitoringStatus", &m.MonitoringStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "userInfo": + err = unpopulate(val, "UserInfo", &m.UserInfo) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &m.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorResource. +func (m MonitorResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "sku", m.SKU) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorResource. +func (m *MonitorResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &m.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorResourceListResponse. +func (m MonitorResourceListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorResourceListResponse. +func (m *MonitorResourceListResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorResourceUpdateParameters. +func (m MonitorResourceUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorResourceUpdateParameters. +func (m *MonitorResourceUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorUpgrade. +func (m MonitorUpgrade) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "version", m.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorUpgrade. +func (m *MonitorUpgrade) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "version": + err = unpopulate(val, "Version", &m.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitoredResource. +func (m MonitoredResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "reasonForLogsStatus", m.ReasonForLogsStatus) + populate(objectMap, "sendingLogs", m.SendingLogs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitoredResource. +func (m *MonitoredResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "reasonForLogsStatus": + err = unpopulate(val, "ReasonForLogsStatus", &m.ReasonForLogsStatus) + delete(rawMsg, key) + case "sendingLogs": + err = unpopulate(val, "SendingLogs", &m.SendingLogs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitoredResourceListResponse. +func (m MonitoredResourceListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitoredResourceListResponse. +func (m *MonitoredResourceListResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitoringTagRules. +func (m MonitoringTagRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitoringTagRules. +func (m *MonitoringTagRules) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitoringTagRulesListResponse. +func (m MonitoringTagRulesListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitoringTagRulesListResponse. +func (m *MonitoringTagRulesListResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitoringTagRulesProperties. +func (m MonitoringTagRulesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logRules", m.LogRules) + populate(objectMap, "provisioningState", m.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitoringTagRulesProperties. +func (m *MonitoringTagRulesProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logRules": + err = unpopulate(val, "LogRules", &m.LogRules) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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 OperationResult. +func (o OperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 OperationResult. +func (o *OperationResult) UnmarshalJSON(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 "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 Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "elasticCloudDeployment", p.ElasticCloudDeployment) + populate(objectMap, "elasticCloudUser", p.ElasticCloudUser) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. +func (p *Properties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "elasticCloudDeployment": + err = unpopulate(val, "ElasticCloudDeployment", &p.ElasticCloudDeployment) + delete(rawMsg, key) + case "elasticCloudUser": + err = unpopulate(val, "ElasticCloudUser", &p.ElasticCloudUser) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceProviderDefaultErrorResponse. +func (r ResourceProviderDefaultErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", r.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderDefaultErrorResponse. +func (r *ResourceProviderDefaultErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &r.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKU. +func (r ResourceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKU. +func (r *ResourceSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrafficFilter. +func (t TrafficFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", t.Description) + populate(objectMap, "id", t.ID) + populate(objectMap, "includeByDefault", t.IncludeByDefault) + populate(objectMap, "name", t.Name) + populate(objectMap, "region", t.Region) + populate(objectMap, "rules", t.Rules) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrafficFilter. +func (t *TrafficFilter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &t.Description) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "includeByDefault": + err = unpopulate(val, "IncludeByDefault", &t.IncludeByDefault) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &t.Region) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &t.Rules) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrafficFilterResponse. +func (t TrafficFilterResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "rulesets", t.Rulesets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrafficFilterResponse. +func (t *TrafficFilterResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "rulesets": + err = unpopulate(val, "Rulesets", &t.Rulesets) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrafficFilterRule. +func (t TrafficFilterRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureEndpointGuid", t.AzureEndpointGUID) + populate(objectMap, "azureEndpointName", t.AzureEndpointName) + populate(objectMap, "description", t.Description) + populate(objectMap, "id", t.ID) + populate(objectMap, "source", t.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrafficFilterRule. +func (t *TrafficFilterRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureEndpointGuid": + err = unpopulate(val, "AzureEndpointGUID", &t.AzureEndpointGUID) + delete(rawMsg, key) + case "azureEndpointName": + err = unpopulate(val, "AzureEndpointName", &t.AzureEndpointName) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &t.Description) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &t.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpgradableVersionsList. +func (u UpgradableVersionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentVersion", u.CurrentVersion) + populate(objectMap, "upgradableVersions", u.UpgradableVersions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpgradableVersionsList. +func (u *UpgradableVersionsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentVersion": + err = unpopulate(val, "CurrentVersion", &u.CurrentVersion) + delete(rawMsg, key) + case "upgradableVersions": + err = unpopulate(val, "UpgradableVersions", &u.UpgradableVersions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserInfo. +func (u UserInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "companyInfo", u.CompanyInfo) + populate(objectMap, "companyName", u.CompanyName) + populate(objectMap, "emailAddress", u.EmailAddress) + populate(objectMap, "firstName", u.FirstName) + populate(objectMap, "lastName", u.LastName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserInfo. +func (u *UserInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "companyInfo": + err = unpopulate(val, "CompanyInfo", &u.CompanyInfo) + delete(rawMsg, key) + case "companyName": + err = unpopulate(val, "CompanyName", &u.CompanyName) + delete(rawMsg, key) + case "emailAddress": + err = unpopulate(val, "EmailAddress", &u.EmailAddress) + delete(rawMsg, key) + case "firstName": + err = unpopulate(val, "FirstName", &u.FirstName) + delete(rawMsg, key) + case "lastName": + err = unpopulate(val, "LastName", &u.LastName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMCollectionUpdate. +func (v VMCollectionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "operationName", v.OperationName) + populate(objectMap, "vmResourceId", v.VMResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMCollectionUpdate. +func (v *VMCollectionUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operationName": + err = unpopulate(val, "OperationName", &v.OperationName) + delete(rawMsg, key) + case "vmResourceId": + err = unpopulate(val, "VMResourceID", &v.VMResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMHostListResponse. +func (v VMHostListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMHostListResponse. +func (v *VMHostListResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMIngestionDetailsResponse. +func (v VMIngestionDetailsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudId", v.CloudID) + populate(objectMap, "ingestionKey", v.IngestionKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMIngestionDetailsResponse. +func (v *VMIngestionDetailsResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cloudId": + err = unpopulate(val, "CloudID", &v.CloudID) + delete(rawMsg, key) + case "ingestionKey": + err = unpopulate(val, "IngestionKey", &v.IngestionKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMResources. +func (v VMResources) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "vmResourceId", v.VMResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMResources. +func (v *VMResources) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vmResourceId": + err = unpopulate(val, "VMResourceID", &v.VMResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) 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/elastic/armelastic/monitor_client.go b/sdk/resourcemanager/elastic/armelastic/monitor_client.go new file mode 100644 index 000000000000..01b9dbf28896 --- /dev/null +++ b/sdk/resourcemanager/elastic/armelastic/monitor_client.go @@ -0,0 +1,129 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// 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 armelastic + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// MonitorClient contains the methods for the Monitor group. +// Don't use this type directly, use NewMonitorClient() instead. +type MonitorClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewMonitorClient creates a new instance of MonitorClient with the specified values. +// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewMonitorClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MonitorClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &MonitorClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginUpgrade - Upgradable version for a monitor resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group to which the Elastic resource belongs. +// monitorName - Monitor resource name +// options - MonitorClientBeginUpgradeOptions contains the optional parameters for the MonitorClient.BeginUpgrade method. +func (client *MonitorClient) BeginUpgrade(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorClientBeginUpgradeOptions) (*runtime.Poller[MonitorClientUpgradeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.upgrade(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[MonitorClientUpgradeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[MonitorClientUpgradeResponse](options.ResumeToken, client.pl, nil) + } +} + +// Upgrade - Upgradable version for a monitor resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +func (client *MonitorClient) upgrade(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorClientBeginUpgradeOptions) (*http.Response, error) { + req, err := client.upgradeCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// upgradeCreateRequest creates the Upgrade request. +func (client *MonitorClient) upgradeCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorClientBeginUpgradeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/upgrade" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } + return req, nil +} diff --git a/sdk/resourcemanager/elastic/armelastic/zz_generated_monitoredresources_client.go b/sdk/resourcemanager/elastic/armelastic/monitoredresources_client.go similarity index 97% rename from sdk/resourcemanager/elastic/armelastic/zz_generated_monitoredresources_client.go rename to sdk/resourcemanager/elastic/armelastic/monitoredresources_client.go index 69274de65d4f..de5ac0575378 100644 --- a/sdk/resourcemanager/elastic/armelastic/zz_generated_monitoredresources_client.go +++ b/sdk/resourcemanager/elastic/armelastic/monitoredresources_client.go @@ -13,6 +13,7 @@ // limitations under the License. // 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 armelastic @@ -63,8 +64,7 @@ func NewMonitoredResourcesClient(subscriptionID string, credential azcore.TokenC } // NewListPager - List the resources currently being monitored by the Elastic monitor resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // monitorName - Monitor resource name // options - MonitoredResourcesClientListOptions contains the optional parameters for the MonitoredResourcesClient.List method. @@ -116,7 +116,7 @@ func (client *MonitoredResourcesClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/elastic/armelastic/zz_generated_monitors_client.go b/sdk/resourcemanager/elastic/armelastic/monitors_client.go similarity index 95% rename from sdk/resourcemanager/elastic/armelastic/zz_generated_monitors_client.go rename to sdk/resourcemanager/elastic/armelastic/monitors_client.go index c4e79266667b..10c91254f3e3 100644 --- a/sdk/resourcemanager/elastic/armelastic/zz_generated_monitors_client.go +++ b/sdk/resourcemanager/elastic/armelastic/monitors_client.go @@ -13,6 +13,7 @@ // limitations under the License. // 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 armelastic @@ -64,7 +65,7 @@ func NewMonitorsClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Create a monitor resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // monitorName - Monitor resource name // options - MonitorsClientBeginCreateOptions contains the optional parameters for the MonitorsClient.BeginCreate method. @@ -84,7 +85,7 @@ func (client *MonitorsClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Create a monitor resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview func (client *MonitorsClient) create(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, monitorName, options) if err != nil { @@ -120,7 +121,7 @@ func (client *MonitorsClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -131,7 +132,7 @@ func (client *MonitorsClient) createCreateRequest(ctx context.Context, resourceG // BeginDelete - Delete a monitor resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // monitorName - Monitor resource name // options - MonitorsClientBeginDeleteOptions contains the optional parameters for the MonitorsClient.BeginDelete method. @@ -149,7 +150,7 @@ func (client *MonitorsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete a monitor resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview func (client *MonitorsClient) deleteOperation(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, monitorName, options) if err != nil { @@ -185,7 +186,7 @@ func (client *MonitorsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,7 +194,7 @@ func (client *MonitorsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get the properties of a specific monitor resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // monitorName - Monitor resource name // options - MonitorsClientGetOptions contains the optional parameters for the MonitorsClient.Get method. @@ -232,7 +233,7 @@ func (client *MonitorsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,8 +249,7 @@ func (client *MonitorsClient) getHandleResponse(resp *http.Response) (MonitorsCl } // NewListPager - List all monitors under the specified subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // options - MonitorsClientListOptions contains the optional parameters for the MonitorsClient.List method. func (client *MonitorsClient) NewListPager(options *MonitorsClientListOptions) *runtime.Pager[MonitorsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[MonitorsClientListResponse]{ @@ -291,7 +291,7 @@ func (client *MonitorsClient) listCreateRequest(ctx context.Context, options *Mo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -307,8 +307,7 @@ func (client *MonitorsClient) listHandleResponse(resp *http.Response) (MonitorsC } // NewListByResourceGroupPager - List all monitors under the specified resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // options - MonitorsClientListByResourceGroupOptions contains the optional parameters for the MonitorsClient.ListByResourceGroup // method. @@ -356,7 +355,7 @@ func (client *MonitorsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -373,7 +372,7 @@ func (client *MonitorsClient) listByResourceGroupHandleResponse(resp *http.Respo // Update - Update a monitor resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // monitorName - Monitor resource name // options - MonitorsClientUpdateOptions contains the optional parameters for the MonitorsClient.Update method. @@ -412,7 +411,7 @@ func (client *MonitorsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { diff --git a/sdk/resourcemanager/elastic/armelastic/zz_generated_operations_client.go b/sdk/resourcemanager/elastic/armelastic/operations_client.go similarity index 96% rename from sdk/resourcemanager/elastic/armelastic/zz_generated_operations_client.go rename to sdk/resourcemanager/elastic/armelastic/operations_client.go index 48ad0fd8ce34..be3f5e8cd80a 100644 --- a/sdk/resourcemanager/elastic/armelastic/zz_generated_operations_client.go +++ b/sdk/resourcemanager/elastic/armelastic/operations_client.go @@ -13,6 +13,7 @@ // limitations under the License. // 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 armelastic @@ -57,8 +58,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - List all operations provided by Microsoft.Elastic. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -96,7 +96,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/elastic/armelastic/zz_generated_response_types.go b/sdk/resourcemanager/elastic/armelastic/response_types.go similarity index 60% rename from sdk/resourcemanager/elastic/armelastic/zz_generated_response_types.go rename to sdk/resourcemanager/elastic/armelastic/response_types.go index 57db3c4e98ab..9bafdd026e51 100644 --- a/sdk/resourcemanager/elastic/armelastic/zz_generated_response_types.go +++ b/sdk/resourcemanager/elastic/armelastic/response_types.go @@ -13,14 +13,60 @@ // limitations under the License. // 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 armelastic +// AllTrafficFiltersClientListResponse contains the response from method AllTrafficFiltersClient.List. +type AllTrafficFiltersClientListResponse struct { + TrafficFilterResponse +} + +// AssociateTrafficFilterClientAssociateResponse contains the response from method AssociateTrafficFilterClient.Associate. +type AssociateTrafficFilterClientAssociateResponse struct { + // placeholder for future response values +} + +// CreateAndAssociateIPFilterClientCreateResponse contains the response from method CreateAndAssociateIPFilterClient.Create. +type CreateAndAssociateIPFilterClientCreateResponse struct { + // placeholder for future response values +} + +// CreateAndAssociatePLFilterClientCreateResponse contains the response from method CreateAndAssociatePLFilterClient.Create. +type CreateAndAssociatePLFilterClientCreateResponse struct { + // placeholder for future response values +} + // DeploymentInfoClientListResponse contains the response from method DeploymentInfoClient.List. type DeploymentInfoClientListResponse struct { DeploymentInfoResponse } +// DetachAndDeleteTrafficFilterClientDeleteResponse contains the response from method DetachAndDeleteTrafficFilterClient.Delete. +type DetachAndDeleteTrafficFilterClientDeleteResponse struct { + // placeholder for future response values +} + +// DetachTrafficFilterClientUpdateResponse contains the response from method DetachTrafficFilterClient.Update. +type DetachTrafficFilterClientUpdateResponse struct { + // placeholder for future response values +} + +// ExternalUserClientCreateOrUpdateResponse contains the response from method ExternalUserClient.CreateOrUpdate. +type ExternalUserClientCreateOrUpdateResponse struct { + ExternalUserCreationResponse +} + +// ListAssociatedTrafficFiltersClientListResponse contains the response from method ListAssociatedTrafficFiltersClient.List. +type ListAssociatedTrafficFiltersClientListResponse struct { + TrafficFilterResponse +} + +// MonitorClientUpgradeResponse contains the response from method MonitorClient.Upgrade. +type MonitorClientUpgradeResponse struct { + // placeholder for future response values +} + // MonitoredResourcesClientListResponse contains the response from method MonitoredResourcesClient.List. type MonitoredResourcesClientListResponse struct { MonitoredResourceListResponse @@ -81,6 +127,16 @@ type TagRulesClientListResponse struct { MonitoringTagRulesListResponse } +// TrafficFiltersClientDeleteResponse contains the response from method TrafficFiltersClient.Delete. +type TrafficFiltersClientDeleteResponse struct { + // placeholder for future response values +} + +// UpgradableVersionsClientDetailsResponse contains the response from method UpgradableVersionsClient.Details. +type UpgradableVersionsClientDetailsResponse struct { + UpgradableVersionsList +} + // VMCollectionClientUpdateResponse contains the response from method VMCollectionClient.Update. type VMCollectionClientUpdateResponse struct { // placeholder for future response values diff --git a/sdk/resourcemanager/elastic/armelastic/zz_generated_tagrules_client.go b/sdk/resourcemanager/elastic/armelastic/tagrules_client.go similarity index 96% rename from sdk/resourcemanager/elastic/armelastic/zz_generated_tagrules_client.go rename to sdk/resourcemanager/elastic/armelastic/tagrules_client.go index 858cb44e6e4b..33ec9c128a81 100644 --- a/sdk/resourcemanager/elastic/armelastic/zz_generated_tagrules_client.go +++ b/sdk/resourcemanager/elastic/armelastic/tagrules_client.go @@ -13,6 +13,7 @@ // limitations under the License. // 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 armelastic @@ -64,7 +65,7 @@ func NewTagRulesClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Create or update a tag rule set for a given monitor resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // monitorName - Monitor resource name // ruleSetName - Tag Rule Set resource name @@ -108,7 +109,7 @@ func (client *TagRulesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -128,7 +129,7 @@ func (client *TagRulesClient) createOrUpdateHandleResponse(resp *http.Response) // BeginDelete - Delete a tag rule set for a given monitor resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // monitorName - Monitor resource name // ruleSetName - Tag Rule Set resource name @@ -147,7 +148,7 @@ func (client *TagRulesClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete a tag rule set for a given monitor resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview func (client *TagRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, options *TagRulesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, monitorName, ruleSetName, options) if err != nil { @@ -187,7 +188,7 @@ func (client *TagRulesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -195,7 +196,7 @@ func (client *TagRulesClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get a tag rule set for a given monitor resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // monitorName - Monitor resource name // ruleSetName - Tag Rule Set resource name @@ -239,7 +240,7 @@ func (client *TagRulesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,8 +256,7 @@ func (client *TagRulesClient) getHandleResponse(resp *http.Response) (TagRulesCl } // NewListPager - List the tag rules for a given monitor resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // monitorName - Monitor resource name // options - TagRulesClientListOptions contains the optional parameters for the TagRulesClient.List method. @@ -308,7 +308,7 @@ func (client *TagRulesClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/elastic/armelastic/zz_generated_time_rfc3339.go b/sdk/resourcemanager/elastic/armelastic/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/elastic/armelastic/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/elastic/armelastic/time_rfc3339.go index 1269c79e5295..90e750315192 100644 --- a/sdk/resourcemanager/elastic/armelastic/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/elastic/armelastic/time_rfc3339.go @@ -13,6 +13,7 @@ // limitations under the License. // 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 armelastic diff --git a/sdk/resourcemanager/elastic/armelastic/trafficfilters_client.go b/sdk/resourcemanager/elastic/armelastic/trafficfilters_client.go new file mode 100644 index 000000000000..9e985e23b41a --- /dev/null +++ b/sdk/resourcemanager/elastic/armelastic/trafficfilters_client.go @@ -0,0 +1,114 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// 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 armelastic + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TrafficFiltersClient contains the methods for the TrafficFilters group. +// Don't use this type directly, use NewTrafficFiltersClient() instead. +type TrafficFiltersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewTrafficFiltersClient creates a new instance of TrafficFiltersClient with the specified values. +// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewTrafficFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TrafficFiltersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &TrafficFiltersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Delete - Delete traffic filter from the account. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group to which the Elastic resource belongs. +// monitorName - Monitor resource name +// options - TrafficFiltersClientDeleteOptions contains the optional parameters for the TrafficFiltersClient.Delete method. +func (client *TrafficFiltersClient) Delete(ctx context.Context, resourceGroupName string, monitorName string, options *TrafficFiltersClientDeleteOptions) (TrafficFiltersClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return TrafficFiltersClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TrafficFiltersClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TrafficFiltersClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return TrafficFiltersClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TrafficFiltersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *TrafficFiltersClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/deleteTrafficFilter" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + if options != nil && options.RulesetID != nil { + reqQP.Set("rulesetId", *options.RulesetID) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/elastic/armelastic/upgradableversions_client.go b/sdk/resourcemanager/elastic/armelastic/upgradableversions_client.go new file mode 100644 index 000000000000..2756ca2a8488 --- /dev/null +++ b/sdk/resourcemanager/elastic/armelastic/upgradableversions_client.go @@ -0,0 +1,121 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// 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 armelastic + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// UpgradableVersionsClient contains the methods for the UpgradableVersions group. +// Don't use this type directly, use NewUpgradableVersionsClient() instead. +type UpgradableVersionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewUpgradableVersionsClient creates a new instance of UpgradableVersionsClient with the specified values. +// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewUpgradableVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpgradableVersionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &UpgradableVersionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Details - List of upgradable versions for a given monitor resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group to which the Elastic resource belongs. +// monitorName - Monitor resource name +// options - UpgradableVersionsClientDetailsOptions contains the optional parameters for the UpgradableVersionsClient.Details +// method. +func (client *UpgradableVersionsClient) Details(ctx context.Context, resourceGroupName string, monitorName string, options *UpgradableVersionsClientDetailsOptions) (UpgradableVersionsClientDetailsResponse, error) { + req, err := client.detailsCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return UpgradableVersionsClientDetailsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UpgradableVersionsClientDetailsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UpgradableVersionsClientDetailsResponse{}, runtime.NewResponseError(resp) + } + return client.detailsHandleResponse(resp) +} + +// detailsCreateRequest creates the Details request. +func (client *UpgradableVersionsClient) detailsCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *UpgradableVersionsClientDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listUpgradableVersions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// detailsHandleResponse handles the Details response. +func (client *UpgradableVersionsClient) detailsHandleResponse(resp *http.Response) (UpgradableVersionsClientDetailsResponse, error) { + result := UpgradableVersionsClientDetailsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpgradableVersionsList); err != nil { + return UpgradableVersionsClientDetailsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/elastic/armelastic/zz_generated_vmcollection_client.go b/sdk/resourcemanager/elastic/armelastic/vmcollection_client.go similarity index 97% rename from sdk/resourcemanager/elastic/armelastic/zz_generated_vmcollection_client.go rename to sdk/resourcemanager/elastic/armelastic/vmcollection_client.go index 503d347247f3..9d408c9e3954 100644 --- a/sdk/resourcemanager/elastic/armelastic/zz_generated_vmcollection_client.go +++ b/sdk/resourcemanager/elastic/armelastic/vmcollection_client.go @@ -13,6 +13,7 @@ // limitations under the License. // 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 armelastic @@ -64,7 +65,7 @@ func NewVMCollectionClient(subscriptionID string, credential azcore.TokenCredent // Update - Update the vm details that will be monitored by the Elastic monitor resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // monitorName - Monitor resource name // options - VMCollectionClientUpdateOptions contains the optional parameters for the VMCollectionClient.Update method. @@ -103,7 +104,7 @@ func (client *VMCollectionClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { diff --git a/sdk/resourcemanager/elastic/armelastic/zz_generated_vmhost_client.go b/sdk/resourcemanager/elastic/armelastic/vmhost_client.go similarity index 97% rename from sdk/resourcemanager/elastic/armelastic/zz_generated_vmhost_client.go rename to sdk/resourcemanager/elastic/armelastic/vmhost_client.go index c9e54e04bde9..5fcce2e69f40 100644 --- a/sdk/resourcemanager/elastic/armelastic/zz_generated_vmhost_client.go +++ b/sdk/resourcemanager/elastic/armelastic/vmhost_client.go @@ -13,6 +13,7 @@ // limitations under the License. // 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 armelastic @@ -63,8 +64,7 @@ func NewVMHostClient(subscriptionID string, credential azcore.TokenCredential, o } // NewListPager - List the vm resources currently being monitored by the Elastic monitor resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // monitorName - Monitor resource name // options - VMHostClientListOptions contains the optional parameters for the VMHostClient.List method. @@ -116,7 +116,7 @@ func (client *VMHostClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/elastic/armelastic/zz_generated_vmingestion_client.go b/sdk/resourcemanager/elastic/armelastic/vmingestion_client.go similarity index 97% rename from sdk/resourcemanager/elastic/armelastic/zz_generated_vmingestion_client.go rename to sdk/resourcemanager/elastic/armelastic/vmingestion_client.go index 13892e92edcc..7c3d1b9734c4 100644 --- a/sdk/resourcemanager/elastic/armelastic/zz_generated_vmingestion_client.go +++ b/sdk/resourcemanager/elastic/armelastic/vmingestion_client.go @@ -13,6 +13,7 @@ // limitations under the License. // 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 armelastic @@ -64,7 +65,7 @@ func NewVMIngestionClient(subscriptionID string, credential azcore.TokenCredenti // Details - List the vm ingestion details that will be monitored by the Elastic monitor resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-07-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - The name of the resource group to which the Elastic resource belongs. // monitorName - Monitor resource name // options - VMIngestionClientDetailsOptions contains the optional parameters for the VMIngestionClient.Details method. @@ -103,7 +104,7 @@ func (client *VMIngestionClient) detailsCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-07-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_deploymentinfo_client_test.go b/sdk/resourcemanager/elastic/armelastic/ze_generated_example_deploymentinfo_client_test.go deleted file mode 100644 index 5849c715a1dc..000000000000 --- a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_deploymentinfo_client_test.go +++ /dev/null @@ -1,39 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armelastic_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/DeploymentInfo_List.json -func ExampleDeploymentInfoClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewDeploymentInfoClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "myResourceGroup", - "myMonitor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_monitoredresources_client_test.go b/sdk/resourcemanager/elastic/armelastic/ze_generated_example_monitoredresources_client_test.go deleted file mode 100644 index 6fccd9f874a1..000000000000 --- a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_monitoredresources_client_test.go +++ /dev/null @@ -1,43 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armelastic_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/MonitoredResources_List.json -func ExampleMonitoredResourcesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewMonitoredResourcesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myMonitor", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_monitors_client_test.go b/sdk/resourcemanager/elastic/armelastic/ze_generated_example_monitors_client_test.go deleted file mode 100644 index 920b1f5afad8..000000000000 --- a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_monitors_client_test.go +++ /dev/null @@ -1,160 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armelastic_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/Monitors_List.json -func ExampleMonitorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/Monitors_ListByResourceGroup.json -func ExampleMonitorsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/Monitors_Get.json -func ExampleMonitorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myMonitor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/Monitors_Create.json -func ExampleMonitorsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "myResourceGroup", - "myMonitor", - &armelastic.MonitorsClientBeginCreateOptions{Body: 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/Monitors_Update.json -func ExampleMonitorsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "myResourceGroup", - "myMonitor", - &armelastic.MonitorsClientUpdateOptions{Body: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/Monitors_Delete.json -func ExampleMonitorsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myMonitor", - 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) - } -} diff --git a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/elastic/armelastic/ze_generated_example_operations_client_test.go deleted file mode 100644 index 7a56ee7416eb..000000000000 --- a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armelastic_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_tagrules_client_test.go b/sdk/resourcemanager/elastic/armelastic/ze_generated_example_tagrules_client_test.go deleted file mode 100644 index 0736fd214548..000000000000 --- a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_tagrules_client_test.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armelastic_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/TagRules_List.json -func ExampleTagRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myMonitor", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/TagRules_CreateOrUpdate.json -func ExampleTagRulesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "myResourceGroup", - "myMonitor", - "default", - &armelastic.TagRulesClientCreateOrUpdateOptions{Body: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/TagRules_Get.json -func ExampleTagRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myMonitor", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/TagRules_Delete.json -func ExampleTagRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myMonitor", - "default", - 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) - } -} diff --git a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_vmcollection_client_test.go b/sdk/resourcemanager/elastic/armelastic/ze_generated_example_vmcollection_client_test.go deleted file mode 100644 index e79268683d89..000000000000 --- a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_vmcollection_client_test.go +++ /dev/null @@ -1,37 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armelastic_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/VMCollection_Update.json -func ExampleVMCollectionClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewVMCollectionClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Update(ctx, - "myResourceGroup", - "myMonitor", - &armelastic.VMCollectionClientUpdateOptions{Body: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_vmhost_client_test.go b/sdk/resourcemanager/elastic/armelastic/ze_generated_example_vmhost_client_test.go deleted file mode 100644 index c7b257a34350..000000000000 --- a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_vmhost_client_test.go +++ /dev/null @@ -1,43 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armelastic_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/VMHost_List.json -func ExampleVMHostClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewVMHostClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myMonitor", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_vmingestion_client_test.go b/sdk/resourcemanager/elastic/armelastic/ze_generated_example_vmingestion_client_test.go deleted file mode 100644 index ddac18f58640..000000000000 --- a/sdk/resourcemanager/elastic/armelastic/ze_generated_example_vmingestion_client_test.go +++ /dev/null @@ -1,39 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armelastic_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/VMIngestion_Details.json -func ExampleVMIngestionClient_Details() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armelastic.NewVMIngestionClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Details(ctx, - "myResourceGroup", - "myMonitor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/elastic/armelastic/zz_generated_models_serde.go b/sdk/resourcemanager/elastic/armelastic/zz_generated_models_serde.go deleted file mode 100644 index 963e6bb00408..000000000000 --- a/sdk/resourcemanager/elastic/armelastic/zz_generated_models_serde.go +++ /dev/null @@ -1,123 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code -// is regenerated. - -package armelastic - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type LogRules. -func (l LogRules) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filteringTags", l.FilteringTags) - populate(objectMap, "sendAadLogs", l.SendAADLogs) - populate(objectMap, "sendActivityLogs", l.SendActivityLogs) - populate(objectMap, "sendSubscriptionLogs", l.SendSubscriptionLogs) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MonitorResource. -func (m MonitorResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - populate(objectMap, "identity", m.Identity) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "sku", m.SKU) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MonitorResourceUpdateParameters. -func (m MonitorResourceUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", m.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) 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 -}