From f4ae221b9a8d5f5282c61f1eecd751732536acbc Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 13 Feb 2023 05:02:33 +0000 Subject: [PATCH] CodeGen from PR 22566 in Azure/azure-rest-api-specs Merge 7a774fdc4daaa71a46f5878ab6e3e1ca07befe95 into 47d1d82108a0db0395ed4eca106622becee7fbb4 --- .../edgeorder/armedgeorder/CHANGELOG.md | 133 + .../armedgeorder/addresses_client.go | 460 +++ .../edgeorder/armedgeorder/autorest.md | 6 +- ...zz_generated_constants.go => constants.go} | 125 +- .../edgeorder/armedgeorder/go.mod | 16 +- .../edgeorder/armedgeorder/go.sum | 24 +- .../{zz_generated_models.go => models.go} | 807 +++-- .../edgeorder/armedgeorder/models_serde.go | 3152 +++++++++++++++++ .../armedgeorder/operations_client.go | 105 + .../armedgeorder/orderitems_client.go | 579 +++ .../edgeorder/armedgeorder/orders_client.go | 256 ++ ...phic_helpers.go => polymorphic_helpers.go} | 3 +- .../productsandconfigurations_client.go | 250 ++ .../edgeorder/armedgeorder/response_types.go | 115 + ...erated_time_rfc3339.go => time_rfc3339.go} | 3 +- ...e_edgeordermanagementclient_client_test.go | 667 ---- .../zz_generated_management_client.go | 1403 -------- .../armedgeorder/zz_generated_models_serde.go | 431 --- .../zz_generated_response_types.go | 114 - 19 files changed, 5646 insertions(+), 3003 deletions(-) create mode 100644 sdk/resourcemanager/edgeorder/armedgeorder/addresses_client.go rename sdk/resourcemanager/edgeorder/armedgeorder/{zz_generated_constants.go => constants.go} (82%) rename sdk/resourcemanager/edgeorder/armedgeorder/{zz_generated_models.go => models.go} (66%) create mode 100644 sdk/resourcemanager/edgeorder/armedgeorder/models_serde.go create mode 100644 sdk/resourcemanager/edgeorder/armedgeorder/operations_client.go create mode 100644 sdk/resourcemanager/edgeorder/armedgeorder/orderitems_client.go create mode 100644 sdk/resourcemanager/edgeorder/armedgeorder/orders_client.go rename sdk/resourcemanager/edgeorder/armedgeorder/{zz_generated_polymorphic_helpers.go => polymorphic_helpers.go} (95%) create mode 100644 sdk/resourcemanager/edgeorder/armedgeorder/productsandconfigurations_client.go create mode 100644 sdk/resourcemanager/edgeorder/armedgeorder/response_types.go rename sdk/resourcemanager/edgeorder/armedgeorder/{zz_generated_time_rfc3339.go => time_rfc3339.go} (96%) delete mode 100644 sdk/resourcemanager/edgeorder/armedgeorder/ze_generated_example_edgeordermanagementclient_client_test.go delete mode 100644 sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_management_client.go delete mode 100644 sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_models_serde.go delete mode 100644 sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_response_types.go diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/CHANGELOG.md b/sdk/resourcemanager/edgeorder/armedgeorder/CHANGELOG.md index 8ed24bf0247e..700a7e2b1ea1 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/CHANGELOG.md +++ b/sdk/resourcemanager/edgeorder/armedgeorder/CHANGELOG.md @@ -1,5 +1,138 @@ # Release History +## 2.0.0-beta.1 (2023-02-13) +### Breaking Changes + +- Function `NewManagementClient` has been removed +- Function `*ManagementClient.CancelOrderItem` has been removed +- Function `*ManagementClient.BeginCreateAddress` has been removed +- Function `*ManagementClient.BeginCreateOrderItem` has been removed +- Function `*ManagementClient.BeginDeleteAddressByName` has been removed +- Function `*ManagementClient.BeginDeleteOrderItemByName` has been removed +- Function `*ManagementClient.GetAddressByName` has been removed +- Function `*ManagementClient.GetOrderByName` has been removed +- Function `*ManagementClient.GetOrderItemByName` has been removed +- Function `*ManagementClient.NewListAddressesAtResourceGroupLevelPager` has been removed +- Function `*ManagementClient.NewListAddressesAtSubscriptionLevelPager` has been removed +- Function `*ManagementClient.NewListConfigurationsPager` has been removed +- Function `*ManagementClient.NewListOperationsPager` has been removed +- Function `*ManagementClient.NewListOrderAtResourceGroupLevelPager` has been removed +- Function `*ManagementClient.NewListOrderAtSubscriptionLevelPager` has been removed +- Function `*ManagementClient.NewListOrderItemsAtResourceGroupLevelPager` has been removed +- Function `*ManagementClient.NewListOrderItemsAtSubscriptionLevelPager` has been removed +- Function `*ManagementClient.NewListProductFamiliesMetadataPager` has been removed +- Function `*ManagementClient.NewListProductFamiliesPager` has been removed +- Function `*ManagementClient.BeginReturnOrderItem` has been removed +- Function `*ManagementClient.BeginUpdateAddress` has been removed +- Function `*ManagementClient.BeginUpdateOrderItem` has been removed +- Struct `ConfigurationFilters` has been removed +- Struct `ManagementClient` has been removed +- Struct `ManagementClientCreateAddressResponse` has been removed +- Struct `ManagementClientCreateOrderItemResponse` has been removed +- Struct `ManagementClientDeleteAddressByNameResponse` has been removed +- Struct `ManagementClientDeleteOrderItemByNameResponse` has been removed +- Struct `ManagementClientListAddressesAtResourceGroupLevelResponse` has been removed +- Struct `ManagementClientListAddressesAtSubscriptionLevelResponse` has been removed +- Struct `ManagementClientListConfigurationsResponse` has been removed +- Struct `ManagementClientListOperationsResponse` has been removed +- Struct `ManagementClientListOrderAtResourceGroupLevelResponse` has been removed +- Struct `ManagementClientListOrderAtSubscriptionLevelResponse` has been removed +- Struct `ManagementClientListOrderItemsAtResourceGroupLevelResponse` has been removed +- Struct `ManagementClientListOrderItemsAtSubscriptionLevelResponse` has been removed +- Struct `ManagementClientListProductFamiliesMetadataResponse` has been removed +- Struct `ManagementClientListProductFamiliesResponse` has been removed +- Struct `ManagementClientReturnOrderItemResponse` has been removed +- Struct `ManagementClientUpdateAddressResponse` has been removed +- Struct `ManagementClientUpdateOrderItemResponse` has been removed +- Struct `ResourceIdentity` has been removed +- Struct `ShippingDetails` has been removed +- Field `ConfigurationFilters` of struct `ConfigurationsRequest` has been removed +- Field `ManagementRpDetails` of struct `OrderItemDetails` has been removed +- Field `Count` of struct `ProductDetails` has been removed +- Field `DeviceDetails` of struct `ProductDetails` has been removed + +### Features Added + +- New value `AvailabilityStageDiscoverable` added to type alias `AvailabilityStage` +- New value `LinkTypeDiscoverable` added to type alias `LinkType` +- New type alias `ChildConfigurationType` with values `ChildConfigurationTypeAdditionalConfiguration`, `ChildConfigurationTypeDeviceConfiguration` +- New type alias `FulfillmentType` with values `FulfillmentTypeExternal`, `FulfillmentTypeMicrosoft` +- New type alias `IdentificationType` with values `IdentificationTypeNotSupported`, `IdentificationTypeSerialNumber` +- New type alias `OrderMode` with values `OrderModeDefault`, `OrderModeDoNotFulfill` +- New function `NewAddressesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AddressesClient, error)` +- New function `*AddressesClient.BeginCreate(context.Context, string, string, AddressResource, *AddressesClientBeginCreateOptions) (*runtime.Poller[AddressesClientCreateResponse], error)` +- New function `*AddressesClient.BeginDelete(context.Context, string, string, *AddressesClientBeginDeleteOptions) (*runtime.Poller[AddressesClientDeleteResponse], error)` +- New function `*AddressesClient.Get(context.Context, string, string, *AddressesClientGetOptions) (AddressesClientGetResponse, error)` +- New function `*AddressesClient.NewListByResourceGroupPager(string, *AddressesClientListByResourceGroupOptions) *runtime.Pager[AddressesClientListByResourceGroupResponse]` +- New function `*AddressesClient.NewListBySubscriptionPager(*AddressesClientListBySubscriptionOptions) *runtime.Pager[AddressesClientListBySubscriptionResponse]` +- New function `*AddressesClient.BeginUpdate(context.Context, string, string, AddressUpdateParameter, *AddressesClientBeginUpdateOptions) (*runtime.Poller[AddressesClientUpdateResponse], error)` +- New function `NewOperationsClient(azcore.TokenCredential, *arm.ClientOptions) (*OperationsClient, error)` +- New function `*OperationsClient.NewListPager(*OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]` +- New function `NewOrderItemsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OrderItemsClient, error)` +- New function `*OrderItemsClient.Cancel(context.Context, string, string, CancellationReason, *OrderItemsClientCancelOptions) (OrderItemsClientCancelResponse, error)` +- New function `*OrderItemsClient.BeginCreate(context.Context, string, string, OrderItemResource, *OrderItemsClientBeginCreateOptions) (*runtime.Poller[OrderItemsClientCreateResponse], error)` +- New function `*OrderItemsClient.BeginDelete(context.Context, string, string, *OrderItemsClientBeginDeleteOptions) (*runtime.Poller[OrderItemsClientDeleteResponse], error)` +- New function `*OrderItemsClient.Get(context.Context, string, string, *OrderItemsClientGetOptions) (OrderItemsClientGetResponse, error)` +- New function `*OrderItemsClient.NewListByResourceGroupPager(string, *OrderItemsClientListByResourceGroupOptions) *runtime.Pager[OrderItemsClientListByResourceGroupResponse]` +- New function `*OrderItemsClient.NewListBySubscriptionPager(*OrderItemsClientListBySubscriptionOptions) *runtime.Pager[OrderItemsClientListBySubscriptionResponse]` +- New function `*OrderItemsClient.BeginReturn(context.Context, string, string, ReturnOrderItemDetails, *OrderItemsClientBeginReturnOptions) (*runtime.Poller[OrderItemsClientReturnResponse], error)` +- New function `*OrderItemsClient.BeginUpdate(context.Context, string, string, OrderItemUpdateParameter, *OrderItemsClientBeginUpdateOptions) (*runtime.Poller[OrderItemsClientUpdateResponse], error)` +- New function `NewOrdersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OrdersClient, error)` +- New function `*OrdersClient.Get(context.Context, string, string, string, *OrdersClientGetOptions) (OrdersClientGetResponse, error)` +- New function `*OrdersClient.NewListByResourceGroupPager(string, *OrdersClientListByResourceGroupOptions) *runtime.Pager[OrdersClientListByResourceGroupResponse]` +- New function `*OrdersClient.NewListBySubscriptionPager(*OrdersClientListBySubscriptionOptions) *runtime.Pager[OrdersClientListBySubscriptionResponse]` +- New function `NewProductsAndConfigurationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProductsAndConfigurationsClient, error)` +- New function `*ProductsAndConfigurationsClient.NewListConfigurationsPager(ConfigurationsRequest, *ProductsAndConfigurationsClientListConfigurationsOptions) *runtime.Pager[ProductsAndConfigurationsClientListConfigurationsResponse]` +- New function `*ProductsAndConfigurationsClient.NewListProductFamiliesMetadataPager(*ProductsAndConfigurationsClientListProductFamiliesMetadataOptions) *runtime.Pager[ProductsAndConfigurationsClientListProductFamiliesMetadataResponse]` +- New function `*ProductsAndConfigurationsClient.NewListProductFamiliesPager(ProductFamiliesRequest, *ProductsAndConfigurationsClientListProductFamiliesOptions) *runtime.Pager[ProductsAndConfigurationsClientListProductFamiliesResponse]` +- New struct `AdditionalConfiguration` +- New struct `AddressesClient` +- New struct `AddressesClientCreateResponse` +- New struct `AddressesClientDeleteResponse` +- New struct `AddressesClientListByResourceGroupResponse` +- New struct `AddressesClientListBySubscriptionResponse` +- New struct `AddressesClientUpdateResponse` +- New struct `CategoryInformation` +- New struct `ChildConfiguration` +- New struct `ChildConfigurationFilter` +- New struct `ChildConfigurationProperties` +- New struct `ConfigurationDeviceDetails` +- New struct `ConfigurationFilter` +- New struct `GroupedChildConfigurations` +- New struct `OperationsClient` +- New struct `OperationsClientListResponse` +- New struct `OrderItemsClient` +- New struct `OrderItemsClientCreateResponse` +- New struct `OrderItemsClientDeleteResponse` +- New struct `OrderItemsClientListByResourceGroupResponse` +- New struct `OrderItemsClientListBySubscriptionResponse` +- New struct `OrderItemsClientReturnResponse` +- New struct `OrderItemsClientUpdateResponse` +- New struct `OrdersClient` +- New struct `OrdersClientListByResourceGroupResponse` +- New struct `OrdersClientListBySubscriptionResponse` +- New struct `ProductsAndConfigurationsClient` +- New struct `ProductsAndConfigurationsClientListConfigurationsResponse` +- New struct `ProductsAndConfigurationsClientListProductFamiliesMetadataResponse` +- New struct `ProductsAndConfigurationsClientListProductFamiliesResponse` +- New struct `ResourceMoveRequest` +- New field `FulfilledBy` in struct `BasicInformation` +- New field `FulfilledBy` in struct `CommonProperties` +- New field `ChildConfigurationTypes` in struct `ConfigurationProperties` +- New field `FulfilledBy` in struct `ConfigurationProperties` +- New field `GroupedChildConfigurations` in struct `ConfigurationProperties` +- New field `ConfigurationFilter` in struct `ConfigurationsRequest` +- New field `OrderItemMode` in struct `OrderItemDetails` +- New field `OrderMode` in struct `OrderProperties` +- New field `ChildConfigurationDeviceDetails` in struct `ProductDetails` +- New field `IdentificationType` in struct `ProductDetails` +- New field `OptInAdditionalConfigurations` in struct `ProductDetails` +- New field `ParentDeviceDetails` in struct `ProductDetails` +- New field `FulfilledBy` in struct `ProductFamilyProperties` +- New field `FulfilledBy` in struct `ProductLineProperties` +- New field `FulfilledBy` in struct `ProductProperties` + + ## 1.0.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/addresses_client.go b/sdk/resourcemanager/edgeorder/armedgeorder/addresses_client.go new file mode 100644 index 000000000000..b063781ea28e --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/addresses_client.go @@ -0,0 +1,460 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armedgeorder + +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" + "strconv" + "strings" +) + +// AddressesClient contains the methods for the Addresses group. +// Don't use this type directly, use NewAddressesClient() instead. +type AddressesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAddressesClient creates a new instance of AddressesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAddressesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AddressesClient, 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 := &AddressesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreate - Create a new address with the specified parameters. Existing address cannot be updated with this API and +// should instead be updated with the Update address API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - addressName - The name of the address Resource within the specified resource group. address names must be between 3 and +// 24 characters in length and use any alphanumeric and underscore only. +// - addressResource - Address details from request body. +// - options - AddressesClientBeginCreateOptions contains the optional parameters for the AddressesClient.BeginCreate method. +func (client *AddressesClient) BeginCreate(ctx context.Context, resourceGroupName string, addressName string, addressResource AddressResource, options *AddressesClientBeginCreateOptions) (*runtime.Poller[AddressesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, addressName, addressResource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[AddressesClientCreateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[AddressesClientCreateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Create - Create a new address with the specified parameters. Existing address cannot be updated with this API and should +// instead be updated with the Update address API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +func (client *AddressesClient) create(ctx context.Context, resourceGroupName string, addressName string, addressResource AddressResource, options *AddressesClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, addressName, addressResource, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *AddressesClient) createCreateRequest(ctx context.Context, resourceGroupName string, addressName string, addressResource AddressResource, options *AddressesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" + 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 addressName == "" { + return nil, errors.New("parameter addressName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{addressName}", url.PathEscape(addressName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, addressResource) +} + +// BeginDelete - Delete an address. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - addressName - The name of the address Resource within the specified resource group. address names must be between 3 and +// 24 characters in length and use any alphanumeric and underscore only. +// - options - AddressesClientBeginDeleteOptions contains the optional parameters for the AddressesClient.BeginDelete method. +func (client *AddressesClient) BeginDelete(ctx context.Context, resourceGroupName string, addressName string, options *AddressesClientBeginDeleteOptions) (*runtime.Poller[AddressesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, addressName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[AddressesClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[AddressesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete an address. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +func (client *AddressesClient) deleteOperation(ctx context.Context, resourceGroupName string, addressName string, options *AddressesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, addressName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AddressesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, addressName string, options *AddressesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" + 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 addressName == "" { + return nil, errors.New("parameter addressName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{addressName}", url.PathEscape(addressName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get information about the specified address. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - addressName - The name of the address Resource within the specified resource group. address names must be between 3 and +// 24 characters in length and use any alphanumeric and underscore only. +// - options - AddressesClientGetOptions contains the optional parameters for the AddressesClient.Get method. +func (client *AddressesClient) Get(ctx context.Context, resourceGroupName string, addressName string, options *AddressesClientGetOptions) (AddressesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, addressName, options) + if err != nil { + return AddressesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AddressesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AddressesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AddressesClient) getCreateRequest(ctx context.Context, resourceGroupName string, addressName string, options *AddressesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" + 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 addressName == "" { + return nil, errors.New("parameter addressName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{addressName}", url.PathEscape(addressName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AddressesClient) getHandleResponse(resp *http.Response) (AddressesClientGetResponse, error) { + result := AddressesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AddressResource); err != nil { + return AddressesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all the addresses available under the given resource group. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AddressesClientListByResourceGroupOptions contains the optional parameters for the AddressesClient.NewListByResourceGroupPager +// method. +func (client *AddressesClient) NewListByResourceGroupPager(resourceGroupName string, options *AddressesClientListByResourceGroupOptions) *runtime.Pager[AddressesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AddressesClientListByResourceGroupResponse]{ + More: func(page AddressesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AddressesClientListByResourceGroupResponse) (AddressesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AddressesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AddressesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AddressesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *AddressesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AddressesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *AddressesClient) listByResourceGroupHandleResponse(resp *http.Response) (AddressesClientListByResourceGroupResponse, error) { + result := AddressesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AddressResourceList); err != nil { + return AddressesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List all the addresses available under the subscription. +// +// Generated from API version 2022-05-01-preview +// - options - AddressesClientListBySubscriptionOptions contains the optional parameters for the AddressesClient.NewListBySubscriptionPager +// method. +func (client *AddressesClient) NewListBySubscriptionPager(options *AddressesClientListBySubscriptionOptions) *runtime.Pager[AddressesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AddressesClientListBySubscriptionResponse]{ + More: func(page AddressesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AddressesClientListBySubscriptionResponse) (AddressesClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AddressesClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AddressesClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AddressesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *AddressesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AddressesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/addresses" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *AddressesClient) listBySubscriptionHandleResponse(resp *http.Response) (AddressesClientListBySubscriptionResponse, error) { + result := AddressesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AddressResourceList); err != nil { + return AddressesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update the properties of an existing address. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - addressName - The name of the address Resource within the specified resource group. address names must be between 3 and +// 24 characters in length and use any alphanumeric and underscore only. +// - addressUpdateParameter - Address update parameters from request body. +// - options - AddressesClientBeginUpdateOptions contains the optional parameters for the AddressesClient.BeginUpdate method. +func (client *AddressesClient) BeginUpdate(ctx context.Context, resourceGroupName string, addressName string, addressUpdateParameter AddressUpdateParameter, options *AddressesClientBeginUpdateOptions) (*runtime.Poller[AddressesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, addressName, addressUpdateParameter, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[AddressesClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[AddressesClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Update the properties of an existing address. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +func (client *AddressesClient) update(ctx context.Context, resourceGroupName string, addressName string, addressUpdateParameter AddressUpdateParameter, options *AddressesClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, addressName, addressUpdateParameter, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *AddressesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, addressName string, addressUpdateParameter AddressUpdateParameter, options *AddressesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" + 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 addressName == "" { + return nil, errors.New("parameter addressName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{addressName}", url.PathEscape(addressName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, addressUpdateParameter) +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/autorest.md b/sdk/resourcemanager/edgeorder/armedgeorder/autorest.md index 316ec0823a61..36baa73d1b73 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/autorest.md +++ b/sdk/resourcemanager/edgeorder/armedgeorder/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/edgeorder/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/edgeorder/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/edgeorder/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/edgeorder/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_constants.go b/sdk/resourcemanager/edgeorder/armedgeorder/constants.go similarity index 82% rename from sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_constants.go rename to sdk/resourcemanager/edgeorder/armedgeorder/constants.go index 1733249b4d37..f96b47feeacb 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_constants.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/constants.go @@ -5,12 +5,13 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armedgeorder const ( moduleName = "armedgeorder" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0-beta.1" ) // ActionStatusEnum - Describes whether the order item is deletable or not. @@ -66,7 +67,7 @@ func PossibleAddressTypeValues() []AddressType { } } -// AddressValidationStatus - Status of address validation +// AddressValidationStatus - Status of address validation. type AddressValidationStatus string const ( @@ -87,7 +88,7 @@ func PossibleAddressValidationStatusValues() []AddressValidationStatus { } } -// AvailabilityStage - Current availability stage of the product. Availability stage +// AvailabilityStage - Current availability stage of the product. type AvailabilityStage string const ( @@ -97,6 +98,8 @@ const ( AvailabilityStageComingSoon AvailabilityStage = "ComingSoon" // AvailabilityStageDeprecated - Product is deprecated. AvailabilityStageDeprecated AvailabilityStage = "Deprecated" + // AvailabilityStageDiscoverable - Product is not available in our service but can be discovered from other sources. + AvailabilityStageDiscoverable AvailabilityStage = "Discoverable" // AvailabilityStagePreview - Product is in preview. AvailabilityStagePreview AvailabilityStage = "Preview" // AvailabilityStageSignup - Product is available only on signup. @@ -111,6 +114,7 @@ func PossibleAvailabilityStageValues() []AvailabilityStage { AvailabilityStageAvailable, AvailabilityStageComingSoon, AvailabilityStageDeprecated, + AvailabilityStageDiscoverable, AvailabilityStagePreview, AvailabilityStageSignup, AvailabilityStageUnavailable, @@ -153,6 +157,23 @@ func PossibleChargingTypeValues() []ChargingType { } } +type ChildConfigurationType string + +const ( + // ChildConfigurationTypeAdditionalConfiguration - Child configuration is an additional configuration. + ChildConfigurationTypeAdditionalConfiguration ChildConfigurationType = "AdditionalConfiguration" + // ChildConfigurationTypeDeviceConfiguration - Child configuration is a device configuration. + ChildConfigurationTypeDeviceConfiguration ChildConfigurationType = "DeviceConfiguration" +) + +// PossibleChildConfigurationTypeValues returns the possible values for the ChildConfigurationType const type. +func PossibleChildConfigurationTypeValues() []ChildConfigurationType { + return []ChildConfigurationType{ + ChildConfigurationTypeAdditionalConfiguration, + ChildConfigurationTypeDeviceConfiguration, + } +} + // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -230,9 +251,9 @@ func PossibleDisabledReasonValues() []DisabledReason { type DoubleEncryptionStatus string const ( - // DoubleEncryptionStatusDisabled - Double encryption is disabled + // DoubleEncryptionStatusDisabled - Double encryption is disabled. DoubleEncryptionStatusDisabled DoubleEncryptionStatus = "Disabled" - // DoubleEncryptionStatusEnabled - Double encryption is enabled + // DoubleEncryptionStatusEnabled - Double encryption is enabled. DoubleEncryptionStatusEnabled DoubleEncryptionStatus = "Enabled" ) @@ -244,7 +265,44 @@ func PossibleDoubleEncryptionStatusValues() []DoubleEncryptionStatus { } } -// ImageType - Type of the image +// FulfillmentType - The entity responsible for fulfillment of the item at the given hierarchy level. +type FulfillmentType string + +const ( + // FulfillmentTypeExternal - The fulfillment (the whole journey of the product offering) is handled by external third party + // entities. + FulfillmentTypeExternal FulfillmentType = "External" + // FulfillmentTypeMicrosoft - The fulfillment (the whole journey of the product offering) is handled by microsoft. + FulfillmentTypeMicrosoft FulfillmentType = "Microsoft" +) + +// PossibleFulfillmentTypeValues returns the possible values for the FulfillmentType const type. +func PossibleFulfillmentTypeValues() []FulfillmentType { + return []FulfillmentType{ + FulfillmentTypeExternal, + FulfillmentTypeMicrosoft, + } +} + +// IdentificationType - Identification type of the configuration. +type IdentificationType string + +const ( + // IdentificationTypeNotSupported - Product does not have any explicit identifier. + IdentificationTypeNotSupported IdentificationType = "NotSupported" + // IdentificationTypeSerialNumber - Product is identifiable by serial number. + IdentificationTypeSerialNumber IdentificationType = "SerialNumber" +) + +// PossibleIdentificationTypeValues returns the possible values for the IdentificationType const type. +func PossibleIdentificationTypeValues() []IdentificationType { + return []IdentificationType{ + IdentificationTypeNotSupported, + IdentificationTypeSerialNumber, + } +} + +// ImageType - Type of the image. type ImageType string const ( @@ -283,17 +341,19 @@ func PossibleLengthHeightUnitValues() []LengthHeightUnit { } } -// LinkType - Type of link +// LinkType - Type of link. type LinkType string const ( - // LinkTypeDocumentation - Link to product documentation + // LinkTypeDiscoverable - Link to order the product from another source and not from Azure Edge Hardware Center. + LinkTypeDiscoverable LinkType = "Discoverable" + // LinkTypeDocumentation - Link to product documentation. LinkTypeDocumentation LinkType = "Documentation" // LinkTypeGeneric - Generic link. LinkTypeGeneric LinkType = "Generic" - // LinkTypeKnowMore - Link to know more + // LinkTypeKnowMore - Link to know more. LinkTypeKnowMore LinkType = "KnowMore" - // LinkTypeSignUp - Link to sign up for products + // LinkTypeSignUp - Link to sign up for products. LinkTypeSignUp LinkType = "SignUp" // LinkTypeSpecification - Link to product specification. LinkTypeSpecification LinkType = "Specification" @@ -304,6 +364,7 @@ const ( // PossibleLinkTypeValues returns the possible values for the LinkType const type. func PossibleLinkTypeValues() []LinkType { return []LinkType{ + LinkTypeDiscoverable, LinkTypeDocumentation, LinkTypeGeneric, LinkTypeKnowMore, @@ -313,7 +374,7 @@ func PossibleLinkTypeValues() []LinkType { } } -// MeteringType - Represents Metering type (eg one-time or recurrent) +// MeteringType - Represents Metering type (eg one-time or recurrent). type MeteringType string const ( @@ -412,6 +473,24 @@ func PossibleOrderItemTypeValues() []OrderItemType { } } +// OrderMode - Defines the mode of the Order item. +type OrderMode string + +const ( + // OrderModeDefault - Default Order mode. + OrderModeDefault OrderMode = "Default" + // OrderModeDoNotFulfill - Mode in which the Order will not be fulfilled. + OrderModeDoNotFulfill OrderMode = "DoNotFulfill" +) + +// PossibleOrderModeValues returns the possible values for the OrderMode const type. +func PossibleOrderModeValues() []OrderMode { + return []OrderMode{ + OrderModeDefault, + OrderModeDoNotFulfill, + } +} + // Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default // value is "user,system" type Origin string @@ -431,33 +510,33 @@ func PossibleOriginValues() []Origin { } } -// StageName - Stage name +// StageName - Stage name. type StageName string const ( // StageNameCancelled - Order has been cancelled. StageNameCancelled StageName = "Cancelled" - // StageNameConfirmed - Order is confirmed + // StageNameConfirmed - Order is confirmed. StageNameConfirmed StageName = "Confirmed" - // StageNameDelivered - Order is delivered to customer + // StageNameDelivered - Order is delivered to customer. StageNameDelivered StageName = "Delivered" - // StageNameInReview - Order is currently in draft mode and can still be cancelled + // StageNameInReview - Order is currently in draft mode and can still be cancelled. StageNameInReview StageName = "InReview" - // StageNameInUse - Order is in use at customer site + // StageNameInUse - Order is in use at customer site. StageNameInUse StageName = "InUse" - // StageNamePlaced - Currently in draft mode and can still be cancelled + // StageNamePlaced - Currently in draft mode and can still be cancelled. StageNamePlaced StageName = "Placed" - // StageNameReadyToShip - Order is ready to ship + // StageNameReadyToShip - Order is ready to ship. StageNameReadyToShip StageName = "ReadyToShip" // StageNameReturnCompleted - Return has now completed. StageNameReturnCompleted StageName = "ReturnCompleted" // StageNameReturnInitiated - Return has been initiated by customer. StageNameReturnInitiated StageName = "ReturnInitiated" - // StageNameReturnPickedUp - Order is in transit from customer to microsoft. + // StageNameReturnPickedUp - Order is in transit from customer to Microsoft. StageNameReturnPickedUp StageName = "ReturnPickedUp" - // StageNameReturnedToMicrosoft - Order has been received back to microsoft. + // StageNameReturnedToMicrosoft - Order has been received back to Microsoft. StageNameReturnedToMicrosoft StageName = "ReturnedToMicrosoft" - // StageNameShipped - Order is in transit to customer + // StageNameShipped - Order is in transit to customer. StageNameShipped StageName = "Shipped" ) @@ -513,9 +592,9 @@ func PossibleStageStatusValues() []StageStatus { type SupportedFilterTypes string const ( - // SupportedFilterTypesDoubleEncryptionStatus - Double encryption status + // SupportedFilterTypesDoubleEncryptionStatus - Double encryption status. SupportedFilterTypesDoubleEncryptionStatus SupportedFilterTypes = "DoubleEncryptionStatus" - // SupportedFilterTypesShipToCountries - Ship to country + // SupportedFilterTypesShipToCountries - Ship to country. SupportedFilterTypesShipToCountries SupportedFilterTypes = "ShipToCountries" ) diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/go.mod b/sdk/resourcemanager/edgeorder/armedgeorder/go.mod index eac604f28f4d..061d2cd1df31 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/go.mod +++ b/sdk/resourcemanager/edgeorder/armedgeorder/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder/v2 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/edgeorder/armedgeorder/go.sum b/sdk/resourcemanager/edgeorder/armedgeorder/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/go.sum +++ b/sdk/resourcemanager/edgeorder/armedgeorder/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/edgeorder/armedgeorder/zz_generated_models.go b/sdk/resourcemanager/edgeorder/armedgeorder/models.go similarity index 66% rename from sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_models.go rename to sdk/resourcemanager/edgeorder/armedgeorder/models.go index fd2d8afb2490..a8d20d2f5c30 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_models.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/models.go @@ -5,29 +5,39 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armedgeorder import "time" +// AdditionalConfiguration - Additional Configuration details. +type AdditionalConfiguration struct { + // REQUIRED; Hierarchy of the product which uniquely identifies the configuration. + HierarchyInformation *HierarchyInformation `json:"hierarchyInformation,omitempty"` + + // REQUIRED; Quantity of the product. + Quantity *int32 `json:"quantity,omitempty"` +} + // AddressDetails - Address details for an order item. type AddressDetails struct { - // REQUIRED; Customer address and contact details. It should be address resource + // REQUIRED; Customer address and contact details. ForwardAddress *AddressProperties `json:"forwardAddress,omitempty"` - // READ-ONLY; Return shipping address + // READ-ONLY; Return shipping address. ReturnAddress *AddressProperties `json:"returnAddress,omitempty" azure:"ro"` } -// AddressProperties - Address Properties +// AddressProperties - Address Properties. type AddressProperties struct { - // REQUIRED; Contact details for the address + // REQUIRED; Contact details for the address. ContactDetails *ContactDetails `json:"contactDetails,omitempty"` - // Shipping details for the address + // Shipping details for the address. ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"` - // READ-ONLY; Status of address validation + // READ-ONLY; Status of address validation. AddressValidationStatus *AddressValidationStatus `json:"addressValidationStatus,omitempty" azure:"ro"` } @@ -48,14 +58,14 @@ type AddressResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; Represents resource creation and update time + // READ-ONLY; Represents resource creation and update time. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } -// AddressResourceList - Address Resource Collection +// AddressResourceList - Address Resource Collection. type AddressResourceList struct { // Link for the next set of job resources. NextLink *string `json:"nextLink,omitempty"` @@ -64,9 +74,9 @@ type AddressResourceList struct { Value []*AddressResource `json:"value,omitempty" azure:"ro"` } -// AddressUpdateParameter - The Address update parameters +// AddressUpdateParameter - The Address update parameters. type AddressUpdateParameter struct { - // Properties of a address to be updated. + // Properties of an address to be updated. Properties *AddressUpdateProperties `json:"properties,omitempty"` // The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across @@ -74,18 +84,67 @@ type AddressUpdateParameter struct { Tags map[string]*string `json:"tags,omitempty"` } -// AddressUpdateProperties - Address Properties +// AddressUpdateProperties - Address Update Properties. type AddressUpdateProperties struct { - // Contact details for the address + // Contact details for the address. ContactDetails *ContactDetails `json:"contactDetails,omitempty"` - // Shipping details for the address + // Shipping details for the address. ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"` } +// AddressesClientBeginCreateOptions contains the optional parameters for the AddressesClient.BeginCreate method. +type AddressesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AddressesClientBeginDeleteOptions contains the optional parameters for the AddressesClient.BeginDelete method. +type AddressesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AddressesClientBeginUpdateOptions contains the optional parameters for the AddressesClient.BeginUpdate method. +type AddressesClientBeginUpdateOptions struct { + // Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. + IfMatch *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AddressesClientGetOptions contains the optional parameters for the AddressesClient.Get method. +type AddressesClientGetOptions struct { + // placeholder for future optional parameters +} + +// AddressesClientListByResourceGroupOptions contains the optional parameters for the AddressesClient.NewListByResourceGroupPager +// method. +type AddressesClientListByResourceGroupOptions struct { + // $filter is supported to filter based on shipping address properties. Filter supports only equals operation. + Filter *string + // $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + SkipToken *string + // $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to + // the API caller. + Top *int32 +} + +// AddressesClientListBySubscriptionOptions contains the optional parameters for the AddressesClient.NewListBySubscriptionPager +// method. +type AddressesClientListBySubscriptionOptions struct { + // $filter is supported to filter based on shipping address properties. Filter supports only equals operation. + Filter *string + // $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + SkipToken *string + // $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to + // the API caller. + Top *int32 +} + // AvailabilityInformation - Availability information of a product system. type AvailabilityInformation struct { - // READ-ONLY; Current availability stage of the product. Availability stage + // READ-ONLY; Current availability stage of the product. AvailabilityStage *AvailabilityStage `json:"availabilityStage,omitempty" azure:"ro"` // READ-ONLY; Reason why the product is disabled. @@ -95,7 +154,7 @@ type AvailabilityInformation struct { DisabledReasonMessage *string `json:"disabledReasonMessage,omitempty" azure:"ro"` } -// BasicInformation - Basic information for any product system +// BasicInformation - Basic information for any product system. type BasicInformation struct { // READ-ONLY; Availability information of the product system. AvailabilityInformation *AvailabilityInformation `json:"availabilityInformation,omitempty" azure:"ro"` @@ -109,6 +168,9 @@ type BasicInformation struct { // READ-ONLY; Display Name for the product system. DisplayName *string `json:"displayName,omitempty" azure:"ro"` + // READ-ONLY; The entity responsible for fulfillment of the item at the given hierarchy level. + FulfilledBy *FulfillmentType `json:"fulfilledBy,omitempty" azure:"ro"` + // READ-ONLY; Hierarchy information of a product. HierarchyInformation *HierarchyInformation `json:"hierarchyInformation,omitempty" azure:"ro"` @@ -116,18 +178,18 @@ type BasicInformation struct { ImageInformation []*ImageInformation `json:"imageInformation,omitempty" azure:"ro"` } -// BillingMeterDetails - Holds billing meter details for each type of billing +// BillingMeterDetails - Holds billing meter details for each type of billing. type BillingMeterDetails struct { - // READ-ONLY; Frequency of recurrence + // READ-ONLY; Frequency of recurrence. Frequency *string `json:"frequency,omitempty" azure:"ro"` - // READ-ONLY; Represents MeterDetails + // READ-ONLY; Represents MeterDetails. MeterDetails MeterDetailsClassification `json:"meterDetails,omitempty" azure:"ro"` - // READ-ONLY; Represents Metering type (eg one-time or recurrent) + // READ-ONLY; Represents Metering type (eg one-time or recurrent). MeteringType *MeteringType `json:"meteringType,omitempty" azure:"ro"` - // READ-ONLY; Represents Billing type name + // READ-ONLY; Represents Billing type name. Name *string `json:"name,omitempty" azure:"ro"` } @@ -137,7 +199,92 @@ type CancellationReason struct { Reason *string `json:"reason,omitempty"` } -// CommonProperties - Represents common properties across product hierarchy +// CategoryInformation - Category related properties of a child configuration. +type CategoryInformation struct { + // Category display name of the child configuration. + CategoryDisplayName *string `json:"categoryDisplayName,omitempty"` + + // Category name of the child configuration. + CategoryName *string `json:"categoryName,omitempty"` + + // Description text for the category. + Description *string `json:"description,omitempty"` + + // Links for the category. + Links []*Link `json:"links,omitempty"` +} + +// ChildConfiguration - Child configuration object. +type ChildConfiguration struct { + // READ-ONLY; Properties of child configuration. + Properties *ChildConfigurationProperties `json:"properties,omitempty" azure:"ro"` +} + +// ChildConfigurationFilter - Child configuration filter. +type ChildConfigurationFilter struct { + // Filter to fetch all child configurations belonging to the given list of configuration types. + ChildConfigurationTypes []*ChildConfigurationType `json:"childConfigurationTypes,omitempty"` + + // The list of child configuration hierarchy customer wants to filter for the given configuration. + HierarchyInformations []*HierarchyInformation `json:"hierarchyInformations,omitempty"` +} + +// ChildConfigurationProperties - Properties of child configuration. +type ChildConfigurationProperties struct { + // READ-ONLY; Availability information of the product system. + AvailabilityInformation *AvailabilityInformation `json:"availabilityInformation,omitempty" azure:"ro"` + + // READ-ONLY; Child configuration type. + ChildConfigurationType *ChildConfigurationType `json:"childConfigurationType,omitempty" azure:"ro"` + + // READ-ONLY; Different types of child configurations which exist for this configuration, these can be used to populate the + // child configuration filter. + ChildConfigurationTypes []*ChildConfigurationType `json:"childConfigurationTypes,omitempty" azure:"ro"` + + // READ-ONLY; Cost information for the product system. + CostInformation *CostInformation `json:"costInformation,omitempty" azure:"ro"` + + // READ-ONLY; Description related to the product system. + Description *Description `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; Dimensions of the configuration. + Dimensions *Dimensions `json:"dimensions,omitempty" azure:"ro"` + + // READ-ONLY; Display Name for the product system. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; List of filters supported for a product. + FilterableProperties []*FilterableProperty `json:"filterableProperties,omitempty" azure:"ro"` + + // READ-ONLY; The entity responsible for fulfillment of the item at the given hierarchy level. + FulfilledBy *FulfillmentType `json:"fulfilledBy,omitempty" azure:"ro"` + + // READ-ONLY; Child configurations present for the configuration after applying child configuration filter, grouped by the + // category name of the child configuration. + GroupedChildConfigurations []*GroupedChildConfigurations `json:"groupedChildConfigurations,omitempty" azure:"ro"` + + // READ-ONLY; Hierarchy information of a product. + HierarchyInformation *HierarchyInformation `json:"hierarchyInformation,omitempty" azure:"ro"` + + // READ-ONLY; Image information for the product system. + ImageInformation []*ImageInformation `json:"imageInformation,omitempty" azure:"ro"` + + // READ-ONLY; Flag to indicate if the child configuration is part of the base configuration, which means the customer need + // not pass this configuration in OptInAdditionalConfigurations while placing an order, it + // will be shipped by default. + IsPartOfBaseConfiguration *bool `json:"isPartOfBaseConfiguration,omitempty" azure:"ro"` + + // READ-ONLY; Maximum quantity a customer can order while choosing this configuration. + MaximumQuantity *int32 `json:"maximumQuantity,omitempty" azure:"ro"` + + // READ-ONLY; Minimum quantity a customer can order while choosing this configuration. + MinimumQuantity *int32 `json:"minimumQuantity,omitempty" azure:"ro"` + + // READ-ONLY; Specifications of the configuration. + Specifications []*Specification `json:"specifications,omitempty" azure:"ro"` +} + +// CommonProperties - Represents common properties across product hierarchy. type CommonProperties struct { // READ-ONLY; Availability information of the product system. AvailabilityInformation *AvailabilityInformation `json:"availabilityInformation,omitempty" azure:"ro"` @@ -151,9 +298,12 @@ type CommonProperties struct { // READ-ONLY; Display Name for the product system. DisplayName *string `json:"displayName,omitempty" azure:"ro"` - // READ-ONLY; list of filters supported for a product + // READ-ONLY; List of filters supported for a product. FilterableProperties []*FilterableProperty `json:"filterableProperties,omitempty" azure:"ro"` + // READ-ONLY; The entity responsible for fulfillment of the item at the given hierarchy level. + FulfilledBy *FulfillmentType `json:"fulfilledBy,omitempty" azure:"ro"` + // READ-ONLY; Hierarchy information of a product. HierarchyInformation *HierarchyInformation `json:"hierarchyInformation,omitempty" azure:"ro"` @@ -163,46 +313,80 @@ type CommonProperties struct { // Configuration object. type Configuration struct { - // READ-ONLY; Properties of configuration + // READ-ONLY; Properties of configuration. Properties *ConfigurationProperties `json:"properties,omitempty" azure:"ro"` } -// ConfigurationFilters - Configuration filters -type ConfigurationFilters struct { - // REQUIRED; Product hierarchy information +// ConfigurationDeviceDetails - Device details for configuration. +type ConfigurationDeviceDetails struct { + // Display details of the product. + DisplayInfo *DisplayInfo `json:"displayInfo,omitempty"` + + // READ-ONLY; List of device details. + DeviceDetails []*DeviceDetails `json:"deviceDetails,omitempty" azure:"ro"` + + // READ-ONLY; Hierarchy of the product which uniquely identifies the configuration. + HierarchyInformation *HierarchyInformation `json:"hierarchyInformation,omitempty" azure:"ro"` + + // READ-ONLY; Identification type of the configuration. + IdentificationType *IdentificationType `json:"identificationType,omitempty" azure:"ro"` + + // READ-ONLY; Quantity of the product. + Quantity *int32 `json:"quantity,omitempty" azure:"ro"` +} + +// ConfigurationFilter - Configuration filters. +type ConfigurationFilter struct { + // REQUIRED; Product hierarchy information. HierarchyInformation *HierarchyInformation `json:"hierarchyInformation,omitempty"` - // Filters specific to product + // Filter to fetch specific child configurations that exist in the configuration. This must be passed to either fetch a list + // of specific child configurations, or all child configurations of specific + // types of child configurations. + ChildConfigurationFilter *ChildConfigurationFilter `json:"childConfigurationFilter,omitempty"` + + // Filters specific to product. FilterableProperty []*FilterableProperty `json:"filterableProperty,omitempty"` } -// ConfigurationProperties - Properties of configuration +// ConfigurationProperties - Properties of configuration. type ConfigurationProperties struct { // READ-ONLY; Availability information of the product system. AvailabilityInformation *AvailabilityInformation `json:"availabilityInformation,omitempty" azure:"ro"` + // READ-ONLY; Different types of child configurations which exist for this configuration, these can be used to populate the + // child configuration filter. + ChildConfigurationTypes []*ChildConfigurationType `json:"childConfigurationTypes,omitempty" azure:"ro"` + // READ-ONLY; Cost information for the product system. CostInformation *CostInformation `json:"costInformation,omitempty" azure:"ro"` // READ-ONLY; Description related to the product system. Description *Description `json:"description,omitempty" azure:"ro"` - // READ-ONLY; Dimensions of the configuration + // READ-ONLY; Dimensions of the configuration. Dimensions *Dimensions `json:"dimensions,omitempty" azure:"ro"` // READ-ONLY; Display Name for the product system. DisplayName *string `json:"displayName,omitempty" azure:"ro"` - // READ-ONLY; list of filters supported for a product + // READ-ONLY; List of filters supported for a product. FilterableProperties []*FilterableProperty `json:"filterableProperties,omitempty" azure:"ro"` + // READ-ONLY; The entity responsible for fulfillment of the item at the given hierarchy level. + FulfilledBy *FulfillmentType `json:"fulfilledBy,omitempty" azure:"ro"` + + // READ-ONLY; Child configurations present for the configuration after applying child configuration filter, grouped by the + // category name of the child configuration. + GroupedChildConfigurations []*GroupedChildConfigurations `json:"groupedChildConfigurations,omitempty" azure:"ro"` + // READ-ONLY; Hierarchy information of a product. HierarchyInformation *HierarchyInformation `json:"hierarchyInformation,omitempty" azure:"ro"` // READ-ONLY; Image information for the product system. ImageInformation []*ImageInformation `json:"imageInformation,omitempty" azure:"ro"` - // READ-ONLY; Specifications of the configuration + // READ-ONLY; Specifications of the configuration. Specifications []*Specification `json:"specifications,omitempty" azure:"ro"` } @@ -217,11 +401,11 @@ type Configurations struct { // ConfigurationsRequest - Configuration request object. type ConfigurationsRequest struct { - // REQUIRED; Holds details about product hierarchy information and filterable property. - ConfigurationFilters []*ConfigurationFilters `json:"configurationFilters,omitempty"` + // Holds details about product hierarchy information and filterable property. + ConfigurationFilter *ConfigurationFilter `json:"configurationFilter,omitempty"` // Customer subscription properties. Clients can display available products to unregistered customers by explicitly passing - // subscription details + // subscription details. CustomerSubscriptionDetails *CustomerSubscriptionDetails `json:"customerSubscriptionDetails,omitempty"` } @@ -243,9 +427,9 @@ type ContactDetails struct { PhoneExtension *string `json:"phoneExtension,omitempty"` } -// CostInformation - Cost information for the product system +// CostInformation - Cost information for the product system. type CostInformation struct { - // READ-ONLY; Default url to display billing information + // READ-ONLY; Default url to display billing information. BillingInfoURL *string `json:"billingInfoUrl,omitempty" azure:"ro"` // READ-ONLY; Details on the various billing aspects for the product system. @@ -253,24 +437,24 @@ type CostInformation struct { } // CustomerSubscriptionDetails - Holds Customer subscription details. Clients can display available products to unregistered -// customers by explicitly passing subscription details +// customers by explicitly passing subscription details. type CustomerSubscriptionDetails struct { - // REQUIRED; Quota ID of a subscription + // REQUIRED; Quota ID of a subscription. QuotaID *string `json:"quotaId,omitempty"` - // Location placement Id of a subscription + // Location placement Id of a subscription. LocationPlacementID *string `json:"locationPlacementId,omitempty"` - // List of registered feature flags for subscription + // List of registered feature flags for subscription. RegisteredFeatures []*CustomerSubscriptionRegisteredFeatures `json:"registeredFeatures,omitempty"` } -// CustomerSubscriptionRegisteredFeatures - Represents subscription registered features +// CustomerSubscriptionRegisteredFeatures - Represents subscription registered features. type CustomerSubscriptionRegisteredFeatures struct { - // Name of subscription registered feature + // Name of subscription registered feature. Name *string `json:"name,omitempty"` - // State of subscription registered feature + // State of subscription registered feature. State *string `json:"state,omitempty"` } @@ -297,13 +481,13 @@ type Description struct { // DeviceDetails - Device details. type DeviceDetails struct { - // READ-ONLY; Management Resource Id + // READ-ONLY; Management Resource Id. ManagementResourceID *string `json:"managementResourceId,omitempty" azure:"ro"` - // READ-ONLY; Management Resource Tenant ID + // READ-ONLY; Management Resource Tenant ID. ManagementResourceTenantID *string `json:"managementResourceTenantId,omitempty" azure:"ro"` - // READ-ONLY; device serial number + // READ-ONLY; Device serial number. SerialNumber *string `json:"serialNumber,omitempty" azure:"ro"` } @@ -331,16 +515,16 @@ type Dimensions struct { Width *float64 `json:"width,omitempty" azure:"ro"` } -// DisplayInfo - Describes product display information +// DisplayInfo - Describes product display information. type DisplayInfo struct { - // READ-ONLY; Configuration display name + // READ-ONLY; Configuration display name. ConfigurationDisplayName *string `json:"configurationDisplayName,omitempty" azure:"ro"` - // READ-ONLY; Product family display name + // READ-ONLY; Product family display name. ProductFamilyDisplayName *string `json:"productFamilyDisplayName,omitempty" azure:"ro"` } -// EncryptionPreferences - Preferences related to the double encryption +// EncryptionPreferences - Preferences related to the double encryption. type EncryptionPreferences struct { // Double encryption status as entered by the customer. It is compulsory to give this parameter if the 'Deny' or 'Disabled' // policy is configured. @@ -350,7 +534,7 @@ type EncryptionPreferences struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` + Info any `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -398,216 +582,58 @@ type ForwardShippingDetails struct { // READ-ONLY; Name of the carrier. CarrierName *string `json:"carrierName,omitempty" azure:"ro"` - // READ-ONLY; TrackingId of the package + // READ-ONLY; TrackingId of the package. TrackingID *string `json:"trackingId,omitempty" azure:"ro"` // READ-ONLY; TrackingUrl of the package. TrackingURL *string `json:"trackingUrl,omitempty" azure:"ro"` } -// HierarchyInformation - Holds details about product hierarchy information +// GroupedChildConfigurations - Grouped child configuration object. +type GroupedChildConfigurations struct { + // READ-ONLY; Category information. + CategoryInformation *CategoryInformation `json:"categoryInformation,omitempty" azure:"ro"` + + // READ-ONLY; List of child configurations. + ChildConfigurations []*ChildConfiguration `json:"childConfigurations,omitempty" azure:"ro"` +} + +// HierarchyInformation - Holds details about product hierarchy information. type HierarchyInformation struct { - // Represents configuration name that uniquely identifies configuration + // Represents configuration name that uniquely identifies configuration. ConfigurationName *string `json:"configurationName,omitempty"` - // Represents product family name that uniquely identifies product family + // Represents product family name that uniquely identifies product family. ProductFamilyName *string `json:"productFamilyName,omitempty"` - // Represents product line name that uniquely identifies product line + // Represents product line name that uniquely identifies product line. ProductLineName *string `json:"productLineName,omitempty"` - // Represents product name that uniquely identifies product + // Represents product name that uniquely identifies product. ProductName *string `json:"productName,omitempty"` } -// ImageInformation - Image for the product +// ImageInformation - Image for the product. type ImageInformation struct { - // READ-ONLY; Type of the image + // READ-ONLY; Type of the image. ImageType *ImageType `json:"imageType,omitempty" azure:"ro"` - // READ-ONLY; Url of the image + // READ-ONLY; Url of the image. ImageURL *string `json:"imageUrl,omitempty" azure:"ro"` } -// Link - Returns link related to the product +// Link - Returns link related to the product. type Link struct { - // READ-ONLY; Type of link + // READ-ONLY; Type of link. LinkType *LinkType `json:"linkType,omitempty" azure:"ro"` - // READ-ONLY; Url of the link + // READ-ONLY; Url of the link. LinkURL *string `json:"linkUrl,omitempty" azure:"ro"` } -// ManagementClientBeginCreateAddressOptions contains the optional parameters for the ManagementClient.BeginCreateAddress -// method. -type ManagementClientBeginCreateAddressOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagementClientBeginCreateOrderItemOptions contains the optional parameters for the ManagementClient.BeginCreateOrderItem -// method. -type ManagementClientBeginCreateOrderItemOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagementClientBeginDeleteAddressByNameOptions contains the optional parameters for the ManagementClient.BeginDeleteAddressByName -// method. -type ManagementClientBeginDeleteAddressByNameOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagementClientBeginDeleteOrderItemByNameOptions contains the optional parameters for the ManagementClient.BeginDeleteOrderItemByName -// method. -type ManagementClientBeginDeleteOrderItemByNameOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagementClientBeginReturnOrderItemOptions contains the optional parameters for the ManagementClient.BeginReturnOrderItem -// method. -type ManagementClientBeginReturnOrderItemOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagementClientBeginUpdateAddressOptions contains the optional parameters for the ManagementClient.BeginUpdateAddress -// method. -type ManagementClientBeginUpdateAddressOptions struct { - // Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. - IfMatch *string - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagementClientBeginUpdateOrderItemOptions contains the optional parameters for the ManagementClient.BeginUpdateOrderItem -// method. -type ManagementClientBeginUpdateOrderItemOptions struct { - // Defines the If-Match condition. The patch will be performed only if the ETag of the order on the server matches this value. - IfMatch *string - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagementClientCancelOrderItemOptions contains the optional parameters for the ManagementClient.CancelOrderItem method. -type ManagementClientCancelOrderItemOptions struct { - // placeholder for future optional parameters -} - -// ManagementClientGetAddressByNameOptions contains the optional parameters for the ManagementClient.GetAddressByName method. -type ManagementClientGetAddressByNameOptions struct { - // placeholder for future optional parameters -} - -// ManagementClientGetOrderByNameOptions contains the optional parameters for the ManagementClient.GetOrderByName method. -type ManagementClientGetOrderByNameOptions struct { - // placeholder for future optional parameters -} - -// ManagementClientGetOrderItemByNameOptions contains the optional parameters for the ManagementClient.GetOrderItemByName -// method. -type ManagementClientGetOrderItemByNameOptions struct { - // $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these - // can be provided as a comma separated list. Device Details for order item - // provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping - // details respectively. - Expand *string -} - -// ManagementClientListAddressesAtResourceGroupLevelOptions contains the optional parameters for the ManagementClient.ListAddressesAtResourceGroupLevel -// method. -type ManagementClientListAddressesAtResourceGroupLevelOptions struct { - // $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - Filter *string - // $skipToken is supported on Get list of addresses, which provides the next page in the list of address. - SkipToken *string -} - -// ManagementClientListAddressesAtSubscriptionLevelOptions contains the optional parameters for the ManagementClient.ListAddressesAtSubscriptionLevel -// method. -type ManagementClientListAddressesAtSubscriptionLevelOptions struct { - // $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - Filter *string - // $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. - SkipToken *string -} - -// ManagementClientListConfigurationsOptions contains the optional parameters for the ManagementClient.ListConfigurations -// method. -type ManagementClientListConfigurationsOptions struct { - // $skipToken is supported on list of configurations, which provides the next page in the list of configurations. - SkipToken *string -} - -// ManagementClientListOperationsOptions contains the optional parameters for the ManagementClient.ListOperations method. -type ManagementClientListOperationsOptions struct { - // placeholder for future optional parameters -} - -// ManagementClientListOrderAtResourceGroupLevelOptions contains the optional parameters for the ManagementClient.ListOrderAtResourceGroupLevel -// method. -type ManagementClientListOrderAtResourceGroupLevelOptions struct { - // $skipToken is supported on Get list of order, which provides the next page in the list of order. - SkipToken *string -} - -// ManagementClientListOrderAtSubscriptionLevelOptions contains the optional parameters for the ManagementClient.ListOrderAtSubscriptionLevel -// method. -type ManagementClientListOrderAtSubscriptionLevelOptions struct { - // $skipToken is supported on Get list of order, which provides the next page in the list of order. - SkipToken *string -} - -// ManagementClientListOrderItemsAtResourceGroupLevelOptions contains the optional parameters for the ManagementClient.ListOrderItemsAtResourceGroupLevel -// method. -type ManagementClientListOrderItemsAtResourceGroupLevelOptions struct { - // $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these - // can be provided as a comma separated list. Device Details for order item - // provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping - // details respectively. - Expand *string - // $filter is supported to filter based on order id. Filter supports only equals operation. - Filter *string - // $skipToken is supported on Get list of order items, which provides the next page in the list of order items. - SkipToken *string -} - -// ManagementClientListOrderItemsAtSubscriptionLevelOptions contains the optional parameters for the ManagementClient.ListOrderItemsAtSubscriptionLevel -// method. -type ManagementClientListOrderItemsAtSubscriptionLevelOptions struct { - // $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these - // can be provided as a comma separated list. Device Details for order item - // provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping - // details respectively. - Expand *string - // $filter is supported to filter based on order id. Filter supports only equals operation. - Filter *string - // $skipToken is supported on Get list of order items, which provides the next page in the list of order items. - SkipToken *string -} - -// ManagementClientListProductFamiliesMetadataOptions contains the optional parameters for the ManagementClient.ListProductFamiliesMetadata -// method. -type ManagementClientListProductFamiliesMetadataOptions struct { - // $skipToken is supported on list of product families metadata, which provides the next page in the list of product families - // metadata. - SkipToken *string -} - -// ManagementClientListProductFamiliesOptions contains the optional parameters for the ManagementClient.ListProductFamilies -// method. -type ManagementClientListProductFamiliesOptions struct { - // $expand is supported on configurations parameter for product, which provides details on the configurations for the product. - Expand *string - // $skipToken is supported on list of product families, which provides the next page in the list of product families. - SkipToken *string -} - -// ManagementResourcePreferences - Management resource preference to link device +// ManagementResourcePreferences - Management resource preference to link device. type ManagementResourcePreferences struct { - // Customer preferred Management resource ARM ID + // Customer preferred Management resource ARM ID. PreferredManagementResourceID *string `json:"preferredManagementResourceId,omitempty"` } @@ -620,7 +646,7 @@ type MeterDetailsClassification interface { GetMeterDetails() *MeterDetails } -// MeterDetails - Holds details about billing type and its meter guids +// MeterDetails - Holds details about billing type and its meter guids. type MeterDetails struct { // REQUIRED; Represents billing type. BillingType *BillingType `json:"billingType,omitempty"` @@ -628,7 +654,7 @@ type MeterDetails struct { // READ-ONLY; Charging type. ChargingType *ChargingType `json:"chargingType,omitempty" azure:"ro"` - // READ-ONLY; Billing unit applicable for Pav2 billing + // READ-ONLY; Billing unit applicable for Pav2 billing. Multiplier *float64 `json:"multiplier,omitempty" azure:"ro"` } @@ -693,7 +719,12 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty" azure:"ro"` } -// OrderItemDetails - Order item details +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// OrderItemDetails - Order item details. type OrderItemDetails struct { // REQUIRED; Order item type. OrderItemType *OrderItemType `json:"orderItemType,omitempty"` @@ -701,10 +732,13 @@ type OrderItemDetails struct { // REQUIRED; Unique identifier for configuration. ProductDetails *ProductDetails `json:"productDetails,omitempty"` - // Additional notification email list + // Additional notification email list. NotificationEmailList []*string `json:"notificationEmailList,omitempty"` - // Customer notification Preferences + // Defines the mode of the Order item. + OrderItemMode *OrderMode `json:"orderItemMode,omitempty"` + + // Customer notification Preferences. Preferences *Preferences `json:"preferences,omitempty"` // READ-ONLY; Cancellation reason. @@ -713,7 +747,7 @@ type OrderItemDetails struct { // READ-ONLY; Describes whether the order item is cancellable or not. CancellationStatus *OrderItemCancellationEnum `json:"cancellationStatus,omitempty" azure:"ro"` - // READ-ONLY; Current Order item Status + // READ-ONLY; Current Order item Status. CurrentStage *StageDetails `json:"currentStage,omitempty" azure:"ro"` // READ-ONLY; Describes whether the order item is deletable or not. @@ -722,16 +756,13 @@ type OrderItemDetails struct { // READ-ONLY; Top level error for the job. Error *ErrorDetail `json:"error,omitempty" azure:"ro"` - // READ-ONLY; Forward Package Shipping details + // READ-ONLY; Forward Package Shipping details. ForwardShippingDetails *ForwardShippingDetails `json:"forwardShippingDetails,omitempty" azure:"ro"` - // READ-ONLY; Parent RP details - this returns only the first or default parent RP from the entire list - ManagementRpDetails *ResourceProviderDetails `json:"managementRpDetails,omitempty" azure:"ro"` - // READ-ONLY; List of parent RP details supported for configuration. ManagementRpDetailsList []*ResourceProviderDetails `json:"managementRpDetailsList,omitempty" azure:"ro"` - // READ-ONLY; Order item status history + // READ-ONLY; Order item status history. OrderItemStageHistory []*StageDetails `json:"orderItemStageHistory,omitempty" azure:"ro"` // READ-ONLY; Return reason. @@ -740,31 +771,31 @@ type OrderItemDetails struct { // READ-ONLY; Describes whether the order item is returnable or not. ReturnStatus *OrderItemReturnEnum `json:"returnStatus,omitempty" azure:"ro"` - // READ-ONLY; Reverse Package Shipping details + // READ-ONLY; Reverse Package Shipping details. ReverseShippingDetails *ReverseShippingDetails `json:"reverseShippingDetails,omitempty" azure:"ro"` } -// OrderItemProperties - Represents order item details. +// OrderItemProperties - Represents order item properties. type OrderItemProperties struct { - // REQUIRED; Represents shipping and return address for order item + // REQUIRED; Represents shipping and return address for order item. AddressDetails *AddressDetails `json:"addressDetails,omitempty"` - // REQUIRED; Id of the order to which order item belongs to + // REQUIRED; Id of the order to which order item belongs to. OrderID *string `json:"orderId,omitempty"` // REQUIRED; Represents order item details. OrderItemDetails *OrderItemDetails `json:"orderItemDetails,omitempty"` - // READ-ONLY; Start time of order item + // READ-ONLY; Start time of order item. StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` } -// OrderItemResource - Represents order item contract +// OrderItemResource - Represents order item resource. type OrderItemResource struct { // REQUIRED; The geo-location where the resource lives Location *string `json:"location,omitempty"` - // REQUIRED; Order item properties + // REQUIRED; Order item properties. Properties *OrderItemProperties `json:"properties,omitempty"` // Resource tags. @@ -776,14 +807,14 @@ type OrderItemResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; Represents resource creation and update time + // READ-ONLY; Represents resource creation and update time. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } -// OrderItemResourceList - List of orderItems. +// OrderItemResourceList - List of order items. type OrderItemResourceList struct { // Link for the next set of order item resources. NextLink *string `json:"nextLink,omitempty"` @@ -794,7 +825,7 @@ type OrderItemResourceList struct { // OrderItemUpdateParameter - Updates order item parameters. type OrderItemUpdateParameter struct { - // Order item update properties + // Order item update properties. Properties *OrderItemUpdateProperties `json:"properties,omitempty"` // The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across @@ -814,6 +845,83 @@ type OrderItemUpdateProperties struct { Preferences *Preferences `json:"preferences,omitempty"` } +// OrderItemsClientBeginCreateOptions contains the optional parameters for the OrderItemsClient.BeginCreate method. +type OrderItemsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// OrderItemsClientBeginDeleteOptions contains the optional parameters for the OrderItemsClient.BeginDelete method. +type OrderItemsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// OrderItemsClientBeginReturnOptions contains the optional parameters for the OrderItemsClient.BeginReturn method. +type OrderItemsClientBeginReturnOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// OrderItemsClientBeginUpdateOptions contains the optional parameters for the OrderItemsClient.BeginUpdate method. +type OrderItemsClientBeginUpdateOptions struct { + // Defines the If-Match condition. The patch will be performed only if the ETag of the order on the server matches this value. + IfMatch *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// OrderItemsClientCancelOptions contains the optional parameters for the OrderItemsClient.Cancel method. +type OrderItemsClientCancelOptions struct { + // placeholder for future optional parameters +} + +// OrderItemsClientGetOptions contains the optional parameters for the OrderItemsClient.Get method. +type OrderItemsClientGetOptions struct { + // $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. + // Each of these can be provided as a comma separated list. Parent Device + // Details for order item provides details on the devices of the product, Device Details for order item provides details on + // the devices of the child configurations of the product, Forward and Reverse + // Shipping details provide forward and reverse shipping details respectively. + Expand *string +} + +// OrderItemsClientListByResourceGroupOptions contains the optional parameters for the OrderItemsClient.NewListByResourceGroupPager +// method. +type OrderItemsClientListByResourceGroupOptions struct { + // $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. + // Each of these can be provided as a comma separated list. Parent Device + // Details for order item provides details on the devices of the product, Device Details for order item provides details on + // the devices of the child configurations of the product, Forward and Reverse + // Shipping details provide forward and reverse shipping details respectively. + Expand *string + // $filter is supported to filter based on order id. Filter supports only equals operation. + Filter *string + // $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + SkipToken *string + // $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to + // the API caller. + Top *int32 +} + +// OrderItemsClientListBySubscriptionOptions contains the optional parameters for the OrderItemsClient.NewListBySubscriptionPager +// method. +type OrderItemsClientListBySubscriptionOptions struct { + // $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. + // Each of these can be provided as a comma separated list. Parent Device + // Details for order item provides details on the devices of the product, Device Details for order item provides details on + // the devices of the child configurations of the product, Forward and Reverse + // Shipping details provide forward and reverse shipping details respectively. + Expand *string + // $filter is supported to filter based on order id. Filter supports only equals operation. + Filter *string + // $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + SkipToken *string + // $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to + // the API caller. + Top *int32 +} + // OrderProperties - Represents order details. type OrderProperties struct { // READ-ONLY; Order current status. @@ -822,13 +930,16 @@ type OrderProperties struct { // READ-ONLY; List of order item ARM Ids which are part of an order. OrderItemIDs []*string `json:"orderItemIds,omitempty" azure:"ro"` + // READ-ONLY; Order mode. + OrderMode *OrderMode `json:"orderMode,omitempty" azure:"ro"` + // READ-ONLY; Order status history. OrderStageHistory []*StageDetails `json:"orderStageHistory,omitempty" azure:"ro"` } // OrderResource - Specifies the properties or parameters for an order. Order is a grouping of one or more order items. type OrderResource struct { - // REQUIRED; Order properties + // REQUIRED; Order properties. Properties *OrderProperties `json:"properties,omitempty"` // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} @@ -837,7 +948,7 @@ type OrderResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; Represents resource creation and update time + // READ-ONLY; Represents resource creation and update time. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -853,7 +964,32 @@ type OrderResourceList struct { Value []*OrderResource `json:"value,omitempty" azure:"ro"` } -// Pav2MeterDetails - Billing type PAV2 meter details +// OrdersClientGetOptions contains the optional parameters for the OrdersClient.Get method. +type OrdersClientGetOptions struct { + // placeholder for future optional parameters +} + +// OrdersClientListByResourceGroupOptions contains the optional parameters for the OrdersClient.NewListByResourceGroupPager +// method. +type OrdersClientListByResourceGroupOptions struct { + // $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + SkipToken *string + // $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to + // the API caller. + Top *int32 +} + +// OrdersClientListBySubscriptionOptions contains the optional parameters for the OrdersClient.NewListBySubscriptionPager +// method. +type OrdersClientListBySubscriptionOptions struct { + // $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + SkipToken *string + // $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to + // the API caller. + Top *int32 +} + +// Pav2MeterDetails - Billing type PAV2 meter details. type Pav2MeterDetails struct { // REQUIRED; Represents billing type. BillingType *BillingType `json:"billingType,omitempty"` @@ -864,7 +1000,7 @@ type Pav2MeterDetails struct { // READ-ONLY; Validation status of requested data center and transport. MeterGUID *string `json:"meterGuid,omitempty" azure:"ro"` - // READ-ONLY; Billing unit applicable for Pav2 billing + // READ-ONLY; Billing unit applicable for Pav2 billing. Multiplier *float64 `json:"multiplier,omitempty" azure:"ro"` } @@ -877,7 +1013,7 @@ func (p *Pav2MeterDetails) GetMeterDetails() *MeterDetails { } } -// Preferences related to the order +// Preferences related to the order. type Preferences struct { // Preferences related to the Encryption. EncryptionPreferences *EncryptionPreferences `json:"encryptionPreferences,omitempty"` @@ -892,25 +1028,31 @@ type Preferences struct { TransportPreferences *TransportPreferences `json:"transportPreferences,omitempty"` } -// Product - List of Products +// Product - Represents a product. type Product struct { - // READ-ONLY; Properties of product + // READ-ONLY; Properties of product. Properties *ProductProperties `json:"properties,omitempty" azure:"ro"` } -// ProductDetails - Represents product details +// ProductDetails - Represents product details. type ProductDetails struct { - // REQUIRED; Hierarchy of the product which uniquely identifies the product + // REQUIRED; Hierarchy of the product which uniquely identifies the product. HierarchyInformation *HierarchyInformation `json:"hierarchyInformation,omitempty"` - // Display details of the product + // Display details of the product. DisplayInfo *DisplayInfo `json:"displayInfo,omitempty"` - // READ-ONLY; Quantity of the product - Count *int32 `json:"count,omitempty" azure:"ro"` + // List of additional configurations customer wants in the order item apart from the ones included in the base configuration. + OptInAdditionalConfigurations []*AdditionalConfiguration `json:"optInAdditionalConfigurations,omitempty"` - // READ-ONLY; list of device details - DeviceDetails []*DeviceDetails `json:"deviceDetails,omitempty" azure:"ro"` + // READ-ONLY; Details of all child configurations that are part of the order item. + ChildConfigurationDeviceDetails []*ConfigurationDeviceDetails `json:"childConfigurationDeviceDetails,omitempty" azure:"ro"` + + // READ-ONLY; Identification type of the configuration. + IdentificationType *IdentificationType `json:"identificationType,omitempty" azure:"ro"` + + // READ-ONLY; Device details of the parent configuration. + ParentDeviceDetails *DeviceDetails `json:"parentDeviceDetails,omitempty" azure:"ro"` // READ-ONLY; Double encryption status of the configuration. Read-only field. ProductDoubleEncryptionStatus *DoubleEncryptionStatus `json:"productDoubleEncryptionStatus,omitempty" azure:"ro"` @@ -925,7 +1067,7 @@ type ProductFamilies struct { Value []*ProductFamily `json:"value,omitempty" azure:"ro"` } -// ProductFamiliesMetadata - Holds details about product family metadata +// ProductFamiliesMetadata - Holds details about product family metadata. type ProductFamiliesMetadata struct { // READ-ONLY; Link for the next set of product families. NextLink *string `json:"nextLink,omitempty" azure:"ro"` @@ -936,7 +1078,7 @@ type ProductFamiliesMetadata struct { // ProductFamiliesMetadataDetails - Product families metadata details. type ProductFamiliesMetadataDetails struct { - // READ-ONLY; Product family properties + // READ-ONLY; Product family properties. Properties *ProductFamilyProperties `json:"properties,omitempty" azure:"ro"` } @@ -946,19 +1088,19 @@ type ProductFamiliesRequest struct { FilterableProperties map[string][]*FilterableProperty `json:"filterableProperties,omitempty"` // Customer subscription properties. Clients can display available products to unregistered customers by explicitly passing - // subscription details + // subscription details. CustomerSubscriptionDetails *CustomerSubscriptionDetails `json:"customerSubscriptionDetails,omitempty"` } -// ProductFamily - Product Family +// ProductFamily - Product Family. type ProductFamily struct { - // READ-ONLY; Properties of product family + // READ-ONLY; Properties of product family. Properties *ProductFamilyProperties `json:"properties,omitempty" azure:"ro"` } -// ProductFamilyProperties - Properties of product family +// ProductFamilyProperties - Properties of product family. type ProductFamilyProperties struct { - // Contains details related to resource provider + // Contains details related to resource provider. ResourceProviderDetails []*ResourceProviderDetails `json:"resourceProviderDetails,omitempty"` // READ-ONLY; Availability information of the product system. @@ -973,26 +1115,29 @@ type ProductFamilyProperties struct { // READ-ONLY; Display Name for the product system. DisplayName *string `json:"displayName,omitempty" azure:"ro"` - // READ-ONLY; list of filters supported for a product + // READ-ONLY; List of filters supported for a product. FilterableProperties []*FilterableProperty `json:"filterableProperties,omitempty" azure:"ro"` + // READ-ONLY; The entity responsible for fulfillment of the item at the given hierarchy level. + FulfilledBy *FulfillmentType `json:"fulfilledBy,omitempty" azure:"ro"` + // READ-ONLY; Hierarchy information of a product. HierarchyInformation *HierarchyInformation `json:"hierarchyInformation,omitempty" azure:"ro"` // READ-ONLY; Image information for the product system. ImageInformation []*ImageInformation `json:"imageInformation,omitempty" azure:"ro"` - // READ-ONLY; List of product lines supported in the product family + // READ-ONLY; List of product lines supported in the product family. ProductLines []*ProductLine `json:"productLines,omitempty" azure:"ro"` } -// ProductLine - Product line +// ProductLine - Product line. type ProductLine struct { - // READ-ONLY; Properties of product line + // READ-ONLY; Properties of product line. Properties *ProductLineProperties `json:"properties,omitempty" azure:"ro"` } -// ProductLineProperties - Properties of product line +// ProductLineProperties - Properties of product line. type ProductLineProperties struct { // READ-ONLY; Availability information of the product system. AvailabilityInformation *AvailabilityInformation `json:"availabilityInformation,omitempty" azure:"ro"` @@ -1006,25 +1151,28 @@ type ProductLineProperties struct { // READ-ONLY; Display Name for the product system. DisplayName *string `json:"displayName,omitempty" azure:"ro"` - // READ-ONLY; list of filters supported for a product + // READ-ONLY; List of filters supported for a product. FilterableProperties []*FilterableProperty `json:"filterableProperties,omitempty" azure:"ro"` + // READ-ONLY; The entity responsible for fulfillment of the item at the given hierarchy level. + FulfilledBy *FulfillmentType `json:"fulfilledBy,omitempty" azure:"ro"` + // READ-ONLY; Hierarchy information of a product. HierarchyInformation *HierarchyInformation `json:"hierarchyInformation,omitempty" azure:"ro"` // READ-ONLY; Image information for the product system. ImageInformation []*ImageInformation `json:"imageInformation,omitempty" azure:"ro"` - // READ-ONLY; List of products in the product line + // READ-ONLY; List of products in the product line. Products []*Product `json:"products,omitempty" azure:"ro"` } -// ProductProperties - Properties of products +// ProductProperties - Properties of product. type ProductProperties struct { // READ-ONLY; Availability information of the product system. AvailabilityInformation *AvailabilityInformation `json:"availabilityInformation,omitempty" azure:"ro"` - // READ-ONLY; List of configurations for the product + // READ-ONLY; List of configurations for the product. Configurations []*Configuration `json:"configurations,omitempty" azure:"ro"` // READ-ONLY; Cost information for the product system. @@ -1036,9 +1184,12 @@ type ProductProperties struct { // READ-ONLY; Display Name for the product system. DisplayName *string `json:"displayName,omitempty" azure:"ro"` - // READ-ONLY; list of filters supported for a product + // READ-ONLY; List of filters supported for a product. FilterableProperties []*FilterableProperty `json:"filterableProperties,omitempty" azure:"ro"` + // READ-ONLY; The entity responsible for fulfillment of the item at the given hierarchy level. + FulfilledBy *FulfillmentType `json:"fulfilledBy,omitempty" azure:"ro"` + // READ-ONLY; Hierarchy information of a product. HierarchyInformation *HierarchyInformation `json:"hierarchyInformation,omitempty" azure:"ro"` @@ -1046,6 +1197,30 @@ type ProductProperties struct { ImageInformation []*ImageInformation `json:"imageInformation,omitempty" azure:"ro"` } +// ProductsAndConfigurationsClientListConfigurationsOptions contains the optional parameters for the ProductsAndConfigurationsClient.NewListConfigurationsPager +// method. +type ProductsAndConfigurationsClientListConfigurationsOptions struct { + // $skipToken is supported on list of configurations, which provides the next page in the list of configurations. + SkipToken *string +} + +// ProductsAndConfigurationsClientListProductFamiliesMetadataOptions contains the optional parameters for the ProductsAndConfigurationsClient.NewListProductFamiliesMetadataPager +// method. +type ProductsAndConfigurationsClientListProductFamiliesMetadataOptions struct { + // $skipToken is supported on list of product families metadata, which provides the next page in the list of product families + // metadata. + SkipToken *string +} + +// ProductsAndConfigurationsClientListProductFamiliesOptions contains the optional parameters for the ProductsAndConfigurationsClient.NewListProductFamiliesPager +// method. +type ProductsAndConfigurationsClientListProductFamiliesOptions struct { + // $expand is supported on configurations parameter for product, which provides details on the configurations for the product. + Expand *string + // $skipToken is supported on list of product families, which provides the next page in the list of product families. + SkipToken *string +} + // ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a // location type ProxyResource struct { @@ -1059,7 +1234,7 @@ type ProxyResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// PurchaseMeterDetails - Billing type Purchase meter details +// PurchaseMeterDetails - Billing type Purchase meter details. type PurchaseMeterDetails struct { // REQUIRED; Represents billing type. BillingType *BillingType `json:"billingType,omitempty"` @@ -1067,16 +1242,16 @@ type PurchaseMeterDetails struct { // READ-ONLY; Charging type. ChargingType *ChargingType `json:"chargingType,omitempty" azure:"ro"` - // READ-ONLY; Billing unit applicable for Pav2 billing + // READ-ONLY; Billing unit applicable for Pav2 billing. Multiplier *float64 `json:"multiplier,omitempty" azure:"ro"` - // READ-ONLY; Product Id + // READ-ONLY; Product Id. ProductID *string `json:"productId,omitempty" azure:"ro"` - // READ-ONLY; Sku Id + // READ-ONLY; Sku Id. SKUID *string `json:"skuId,omitempty" azure:"ro"` - // READ-ONLY; Term Id + // READ-ONLY; Term Id. TermID *string `json:"termId,omitempty" azure:"ro"` } @@ -1101,36 +1276,29 @@ type Resource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// ResourceIdentity - Msi identity details of the resource -type ResourceIdentity struct { - // Identity type - Type *string `json:"type,omitempty"` - - // READ-ONLY; Service Principal Id backing the Msi - PrincipalID *string `json:"principalId,omitempty" azure:"ro"` - - // READ-ONLY; Home Tenant Id - TenantID *string `json:"tenantId,omitempty" azure:"ro"` +type ResourceMoveRequest struct { + Resources []*string `json:"resources,omitempty"` + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` } -// ResourceProviderDetails - Management RP details +// ResourceProviderDetails - Management RP details. type ResourceProviderDetails struct { - // READ-ONLY; Resource provider namespace + // READ-ONLY; Resource provider namespace. ResourceProviderNamespace *string `json:"resourceProviderNamespace,omitempty" azure:"ro"` } -// ReturnOrderItemDetails - Return order item request body +// ReturnOrderItemDetails - Return order item request body. type ReturnOrderItemDetails struct { // REQUIRED; Return Reason. ReturnReason *string `json:"returnReason,omitempty"` - // customer return address. + // Customer return address. ReturnAddress *AddressProperties `json:"returnAddress,omitempty"` - // Service tag (located on the bottom-right corner of the device) + // Service tag (located on the bottom-right corner of the device). ServiceTag *string `json:"serviceTag,omitempty"` - // Shipping Box required + // Shipping Box required. ShippingBoxRequired *bool `json:"shippingBoxRequired,omitempty"` } @@ -1145,7 +1313,7 @@ type ReverseShippingDetails struct { // READ-ONLY; SAS key to download the reverse shipment label of the package. SasKeyForLabel *string `json:"sasKeyForLabel,omitempty" azure:"ro"` - // READ-ONLY; TrackingId of the package + // READ-ONLY; TrackingId of the package. TrackingID *string `json:"trackingId,omitempty" azure:"ro"` // READ-ONLY; TrackingUrl of the package. @@ -1185,27 +1353,12 @@ type ShippingAddress struct { ZipExtendedCode *string `json:"zipExtendedCode,omitempty"` } -// ShippingDetails - Package shipping details -type ShippingDetails struct { - // READ-ONLY; Carrier Name for display purpose. Not to be used for any processing. - CarrierDisplayName *string `json:"carrierDisplayName,omitempty" azure:"ro"` - - // READ-ONLY; Name of the carrier. - CarrierName *string `json:"carrierName,omitempty" azure:"ro"` - - // READ-ONLY; TrackingId of the package - TrackingID *string `json:"trackingId,omitempty" azure:"ro"` - - // READ-ONLY; TrackingUrl of the package. - TrackingURL *string `json:"trackingUrl,omitempty" azure:"ro"` -} - -// Specifications of the configurations +// Specification of the configurations. type Specification struct { - // READ-ONLY; Name of the specification + // READ-ONLY; Name of the specification. Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; Value of the specification + // READ-ONLY; Value of the specification. Value *string `json:"value,omitempty" azure:"ro"` } @@ -1214,13 +1367,13 @@ type StageDetails struct { // READ-ONLY; Display name of the resource stage. DisplayName *string `json:"displayName,omitempty" azure:"ro"` - // READ-ONLY; Stage name + // READ-ONLY; Stage name. StageName *StageName `json:"stageName,omitempty" azure:"ro"` // READ-ONLY; Stage status. StageStatus *StageStatus `json:"stageStatus,omitempty" azure:"ro"` - // READ-ONLY; Stage start time + // READ-ONLY; Stage start time. StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` } @@ -1264,7 +1417,7 @@ type TrackedResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// TransportPreferences - Preferences related to the shipment logistics of the sku +// TransportPreferences - Preferences related to the shipment logistics of the sku. type TransportPreferences struct { // REQUIRED; Indicates Shipment Logistics type that the customer preferred. PreferredShipmentType *TransportShipmentTypes `json:"preferredShipmentType,omitempty"` diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/models_serde.go b/sdk/resourcemanager/edgeorder/armedgeorder/models_serde.go new file mode 100644 index 000000000000..b1d1308635e5 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/models_serde.go @@ -0,0 +1,3152 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armedgeorder + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AdditionalConfiguration. +func (a AdditionalConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hierarchyInformation", a.HierarchyInformation) + populate(objectMap, "quantity", a.Quantity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalConfiguration. +func (a *AdditionalConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hierarchyInformation": + err = unpopulate(val, "HierarchyInformation", &a.HierarchyInformation) + delete(rawMsg, key) + case "quantity": + err = unpopulate(val, "Quantity", &a.Quantity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddressDetails. +func (a AddressDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "forwardAddress", a.ForwardAddress) + populate(objectMap, "returnAddress", a.ReturnAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddressDetails. +func (a *AddressDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "forwardAddress": + err = unpopulate(val, "ForwardAddress", &a.ForwardAddress) + delete(rawMsg, key) + case "returnAddress": + err = unpopulate(val, "ReturnAddress", &a.ReturnAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddressProperties. +func (a AddressProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressValidationStatus", a.AddressValidationStatus) + populate(objectMap, "contactDetails", a.ContactDetails) + populate(objectMap, "shippingAddress", a.ShippingAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddressProperties. +func (a *AddressProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressValidationStatus": + err = unpopulate(val, "AddressValidationStatus", &a.AddressValidationStatus) + delete(rawMsg, key) + case "contactDetails": + err = unpopulate(val, "ContactDetails", &a.ContactDetails) + delete(rawMsg, key) + case "shippingAddress": + err = unpopulate(val, "ShippingAddress", &a.ShippingAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddressResource. +func (a AddressResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddressResource. +func (a *AddressResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddressResourceList. +func (a AddressResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddressResourceList. +func (a *AddressResourceList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddressUpdateParameter. +func (a AddressUpdateParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddressUpdateParameter. +func (a *AddressUpdateParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddressUpdateProperties. +func (a AddressUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contactDetails", a.ContactDetails) + populate(objectMap, "shippingAddress", a.ShippingAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddressUpdateProperties. +func (a *AddressUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contactDetails": + err = unpopulate(val, "ContactDetails", &a.ContactDetails) + delete(rawMsg, key) + case "shippingAddress": + err = unpopulate(val, "ShippingAddress", &a.ShippingAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailabilityInformation. +func (a AvailabilityInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityStage", a.AvailabilityStage) + populate(objectMap, "disabledReason", a.DisabledReason) + populate(objectMap, "disabledReasonMessage", a.DisabledReasonMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityInformation. +func (a *AvailabilityInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityStage": + err = unpopulate(val, "AvailabilityStage", &a.AvailabilityStage) + delete(rawMsg, key) + case "disabledReason": + err = unpopulate(val, "DisabledReason", &a.DisabledReason) + delete(rawMsg, key) + case "disabledReasonMessage": + err = unpopulate(val, "DisabledReasonMessage", &a.DisabledReasonMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BasicInformation. +func (b BasicInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityInformation", b.AvailabilityInformation) + populate(objectMap, "costInformation", b.CostInformation) + populate(objectMap, "description", b.Description) + populate(objectMap, "displayName", b.DisplayName) + populate(objectMap, "fulfilledBy", b.FulfilledBy) + populate(objectMap, "hierarchyInformation", b.HierarchyInformation) + populate(objectMap, "imageInformation", b.ImageInformation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BasicInformation. +func (b *BasicInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityInformation": + err = unpopulate(val, "AvailabilityInformation", &b.AvailabilityInformation) + delete(rawMsg, key) + case "costInformation": + err = unpopulate(val, "CostInformation", &b.CostInformation) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &b.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &b.DisplayName) + delete(rawMsg, key) + case "fulfilledBy": + err = unpopulate(val, "FulfilledBy", &b.FulfilledBy) + delete(rawMsg, key) + case "hierarchyInformation": + err = unpopulate(val, "HierarchyInformation", &b.HierarchyInformation) + delete(rawMsg, key) + case "imageInformation": + err = unpopulate(val, "ImageInformation", &b.ImageInformation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingMeterDetails. +func (b BillingMeterDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "frequency", b.Frequency) + populate(objectMap, "meterDetails", b.MeterDetails) + populate(objectMap, "meteringType", b.MeteringType) + populate(objectMap, "name", b.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingMeterDetails. +func (b *BillingMeterDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "frequency": + err = unpopulate(val, "Frequency", &b.Frequency) + delete(rawMsg, key) + case "meterDetails": + b.MeterDetails, err = unmarshalMeterDetailsClassification(val) + delete(rawMsg, key) + case "meteringType": + err = unpopulate(val, "MeteringType", &b.MeteringType) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CancellationReason. +func (c CancellationReason) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CancellationReason. +func (c *CancellationReason) UnmarshalJSON(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 "reason": + err = unpopulate(val, "Reason", &c.Reason) + 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 CategoryInformation. +func (c CategoryInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "categoryDisplayName", c.CategoryDisplayName) + populate(objectMap, "categoryName", c.CategoryName) + populate(objectMap, "description", c.Description) + populate(objectMap, "links", c.Links) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CategoryInformation. +func (c *CategoryInformation) UnmarshalJSON(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 "categoryDisplayName": + err = unpopulate(val, "CategoryDisplayName", &c.CategoryDisplayName) + delete(rawMsg, key) + case "categoryName": + err = unpopulate(val, "CategoryName", &c.CategoryName) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "links": + err = unpopulate(val, "Links", &c.Links) + 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 ChildConfiguration. +func (c ChildConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChildConfiguration. +func (c *ChildConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ChildConfigurationFilter. +func (c ChildConfigurationFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "childConfigurationTypes", c.ChildConfigurationTypes) + populate(objectMap, "hierarchyInformations", c.HierarchyInformations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChildConfigurationFilter. +func (c *ChildConfigurationFilter) UnmarshalJSON(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 "childConfigurationTypes": + err = unpopulate(val, "ChildConfigurationTypes", &c.ChildConfigurationTypes) + delete(rawMsg, key) + case "hierarchyInformations": + err = unpopulate(val, "HierarchyInformations", &c.HierarchyInformations) + 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 ChildConfigurationProperties. +func (c ChildConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityInformation", c.AvailabilityInformation) + populate(objectMap, "childConfigurationType", c.ChildConfigurationType) + populate(objectMap, "childConfigurationTypes", c.ChildConfigurationTypes) + populate(objectMap, "costInformation", c.CostInformation) + populate(objectMap, "description", c.Description) + populate(objectMap, "dimensions", c.Dimensions) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "filterableProperties", c.FilterableProperties) + populate(objectMap, "fulfilledBy", c.FulfilledBy) + populate(objectMap, "groupedChildConfigurations", c.GroupedChildConfigurations) + populate(objectMap, "hierarchyInformation", c.HierarchyInformation) + populate(objectMap, "imageInformation", c.ImageInformation) + populate(objectMap, "isPartOfBaseConfiguration", c.IsPartOfBaseConfiguration) + populate(objectMap, "maximumQuantity", c.MaximumQuantity) + populate(objectMap, "minimumQuantity", c.MinimumQuantity) + populate(objectMap, "specifications", c.Specifications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChildConfigurationProperties. +func (c *ChildConfigurationProperties) UnmarshalJSON(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 "availabilityInformation": + err = unpopulate(val, "AvailabilityInformation", &c.AvailabilityInformation) + delete(rawMsg, key) + case "childConfigurationType": + err = unpopulate(val, "ChildConfigurationType", &c.ChildConfigurationType) + delete(rawMsg, key) + case "childConfigurationTypes": + err = unpopulate(val, "ChildConfigurationTypes", &c.ChildConfigurationTypes) + delete(rawMsg, key) + case "costInformation": + err = unpopulate(val, "CostInformation", &c.CostInformation) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &c.Dimensions) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "filterableProperties": + err = unpopulate(val, "FilterableProperties", &c.FilterableProperties) + delete(rawMsg, key) + case "fulfilledBy": + err = unpopulate(val, "FulfilledBy", &c.FulfilledBy) + delete(rawMsg, key) + case "groupedChildConfigurations": + err = unpopulate(val, "GroupedChildConfigurations", &c.GroupedChildConfigurations) + delete(rawMsg, key) + case "hierarchyInformation": + err = unpopulate(val, "HierarchyInformation", &c.HierarchyInformation) + delete(rawMsg, key) + case "imageInformation": + err = unpopulate(val, "ImageInformation", &c.ImageInformation) + delete(rawMsg, key) + case "isPartOfBaseConfiguration": + err = unpopulate(val, "IsPartOfBaseConfiguration", &c.IsPartOfBaseConfiguration) + delete(rawMsg, key) + case "maximumQuantity": + err = unpopulate(val, "MaximumQuantity", &c.MaximumQuantity) + delete(rawMsg, key) + case "minimumQuantity": + err = unpopulate(val, "MinimumQuantity", &c.MinimumQuantity) + delete(rawMsg, key) + case "specifications": + err = unpopulate(val, "Specifications", &c.Specifications) + 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 CommonProperties. +func (c CommonProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityInformation", c.AvailabilityInformation) + populate(objectMap, "costInformation", c.CostInformation) + populate(objectMap, "description", c.Description) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "filterableProperties", c.FilterableProperties) + populate(objectMap, "fulfilledBy", c.FulfilledBy) + populate(objectMap, "hierarchyInformation", c.HierarchyInformation) + populate(objectMap, "imageInformation", c.ImageInformation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommonProperties. +func (c *CommonProperties) UnmarshalJSON(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 "availabilityInformation": + err = unpopulate(val, "AvailabilityInformation", &c.AvailabilityInformation) + delete(rawMsg, key) + case "costInformation": + err = unpopulate(val, "CostInformation", &c.CostInformation) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "filterableProperties": + err = unpopulate(val, "FilterableProperties", &c.FilterableProperties) + delete(rawMsg, key) + case "fulfilledBy": + err = unpopulate(val, "FulfilledBy", &c.FulfilledBy) + delete(rawMsg, key) + case "hierarchyInformation": + err = unpopulate(val, "HierarchyInformation", &c.HierarchyInformation) + delete(rawMsg, key) + case "imageInformation": + err = unpopulate(val, "ImageInformation", &c.ImageInformation) + 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 Configuration. +func (c Configuration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Configuration. +func (c *Configuration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationDeviceDetails. +func (c ConfigurationDeviceDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deviceDetails", c.DeviceDetails) + populate(objectMap, "displayInfo", c.DisplayInfo) + populate(objectMap, "hierarchyInformation", c.HierarchyInformation) + populate(objectMap, "identificationType", c.IdentificationType) + populate(objectMap, "quantity", c.Quantity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationDeviceDetails. +func (c *ConfigurationDeviceDetails) UnmarshalJSON(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 "deviceDetails": + err = unpopulate(val, "DeviceDetails", &c.DeviceDetails) + delete(rawMsg, key) + case "displayInfo": + err = unpopulate(val, "DisplayInfo", &c.DisplayInfo) + delete(rawMsg, key) + case "hierarchyInformation": + err = unpopulate(val, "HierarchyInformation", &c.HierarchyInformation) + delete(rawMsg, key) + case "identificationType": + err = unpopulate(val, "IdentificationType", &c.IdentificationType) + delete(rawMsg, key) + case "quantity": + err = unpopulate(val, "Quantity", &c.Quantity) + 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 ConfigurationFilter. +func (c ConfigurationFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "childConfigurationFilter", c.ChildConfigurationFilter) + populate(objectMap, "filterableProperty", c.FilterableProperty) + populate(objectMap, "hierarchyInformation", c.HierarchyInformation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationFilter. +func (c *ConfigurationFilter) UnmarshalJSON(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 "childConfigurationFilter": + err = unpopulate(val, "ChildConfigurationFilter", &c.ChildConfigurationFilter) + delete(rawMsg, key) + case "filterableProperty": + err = unpopulate(val, "FilterableProperty", &c.FilterableProperty) + delete(rawMsg, key) + case "hierarchyInformation": + err = unpopulate(val, "HierarchyInformation", &c.HierarchyInformation) + 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 ConfigurationProperties. +func (c ConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityInformation", c.AvailabilityInformation) + populate(objectMap, "childConfigurationTypes", c.ChildConfigurationTypes) + populate(objectMap, "costInformation", c.CostInformation) + populate(objectMap, "description", c.Description) + populate(objectMap, "dimensions", c.Dimensions) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "filterableProperties", c.FilterableProperties) + populate(objectMap, "fulfilledBy", c.FulfilledBy) + populate(objectMap, "groupedChildConfigurations", c.GroupedChildConfigurations) + populate(objectMap, "hierarchyInformation", c.HierarchyInformation) + populate(objectMap, "imageInformation", c.ImageInformation) + populate(objectMap, "specifications", c.Specifications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationProperties. +func (c *ConfigurationProperties) UnmarshalJSON(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 "availabilityInformation": + err = unpopulate(val, "AvailabilityInformation", &c.AvailabilityInformation) + delete(rawMsg, key) + case "childConfigurationTypes": + err = unpopulate(val, "ChildConfigurationTypes", &c.ChildConfigurationTypes) + delete(rawMsg, key) + case "costInformation": + err = unpopulate(val, "CostInformation", &c.CostInformation) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &c.Dimensions) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "filterableProperties": + err = unpopulate(val, "FilterableProperties", &c.FilterableProperties) + delete(rawMsg, key) + case "fulfilledBy": + err = unpopulate(val, "FulfilledBy", &c.FulfilledBy) + delete(rawMsg, key) + case "groupedChildConfigurations": + err = unpopulate(val, "GroupedChildConfigurations", &c.GroupedChildConfigurations) + delete(rawMsg, key) + case "hierarchyInformation": + err = unpopulate(val, "HierarchyInformation", &c.HierarchyInformation) + delete(rawMsg, key) + case "imageInformation": + err = unpopulate(val, "ImageInformation", &c.ImageInformation) + delete(rawMsg, key) + case "specifications": + err = unpopulate(val, "Specifications", &c.Specifications) + 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 Configurations. +func (c Configurations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Configurations. +func (c *Configurations) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationsRequest. +func (c ConfigurationsRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "configurationFilter", c.ConfigurationFilter) + populate(objectMap, "customerSubscriptionDetails", c.CustomerSubscriptionDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationsRequest. +func (c *ConfigurationsRequest) UnmarshalJSON(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 "configurationFilter": + err = unpopulate(val, "ConfigurationFilter", &c.ConfigurationFilter) + delete(rawMsg, key) + case "customerSubscriptionDetails": + err = unpopulate(val, "CustomerSubscriptionDetails", &c.CustomerSubscriptionDetails) + 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 ContactDetails. +func (c ContactDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contactName", c.ContactName) + populate(objectMap, "emailList", c.EmailList) + populate(objectMap, "mobile", c.Mobile) + populate(objectMap, "phone", c.Phone) + populate(objectMap, "phoneExtension", c.PhoneExtension) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactDetails. +func (c *ContactDetails) UnmarshalJSON(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 "contactName": + err = unpopulate(val, "ContactName", &c.ContactName) + delete(rawMsg, key) + case "emailList": + err = unpopulate(val, "EmailList", &c.EmailList) + delete(rawMsg, key) + case "mobile": + err = unpopulate(val, "Mobile", &c.Mobile) + delete(rawMsg, key) + case "phone": + err = unpopulate(val, "Phone", &c.Phone) + delete(rawMsg, key) + case "phoneExtension": + err = unpopulate(val, "PhoneExtension", &c.PhoneExtension) + 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 CostInformation. +func (c CostInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "billingInfoUrl", c.BillingInfoURL) + populate(objectMap, "billingMeterDetails", c.BillingMeterDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CostInformation. +func (c *CostInformation) UnmarshalJSON(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 "billingInfoUrl": + err = unpopulate(val, "BillingInfoURL", &c.BillingInfoURL) + delete(rawMsg, key) + case "billingMeterDetails": + err = unpopulate(val, "BillingMeterDetails", &c.BillingMeterDetails) + 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 CustomerSubscriptionDetails. +func (c CustomerSubscriptionDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "locationPlacementId", c.LocationPlacementID) + populate(objectMap, "quotaId", c.QuotaID) + populate(objectMap, "registeredFeatures", c.RegisteredFeatures) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerSubscriptionDetails. +func (c *CustomerSubscriptionDetails) UnmarshalJSON(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 "locationPlacementId": + err = unpopulate(val, "LocationPlacementID", &c.LocationPlacementID) + delete(rawMsg, key) + case "quotaId": + err = unpopulate(val, "QuotaID", &c.QuotaID) + delete(rawMsg, key) + case "registeredFeatures": + err = unpopulate(val, "RegisteredFeatures", &c.RegisteredFeatures) + 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 CustomerSubscriptionRegisteredFeatures. +func (c CustomerSubscriptionRegisteredFeatures) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populate(objectMap, "state", c.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerSubscriptionRegisteredFeatures. +func (c *CustomerSubscriptionRegisteredFeatures) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &c.Name) + 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 Description. +func (d Description) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "attributes", d.Attributes) + populate(objectMap, "descriptionType", d.DescriptionType) + populate(objectMap, "keywords", d.Keywords) + populate(objectMap, "links", d.Links) + populate(objectMap, "longDescription", d.LongDescription) + populate(objectMap, "shortDescription", d.ShortDescription) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Description. +func (d *Description) UnmarshalJSON(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 "attributes": + err = unpopulate(val, "Attributes", &d.Attributes) + delete(rawMsg, key) + case "descriptionType": + err = unpopulate(val, "DescriptionType", &d.DescriptionType) + delete(rawMsg, key) + case "keywords": + err = unpopulate(val, "Keywords", &d.Keywords) + delete(rawMsg, key) + case "links": + err = unpopulate(val, "Links", &d.Links) + delete(rawMsg, key) + case "longDescription": + err = unpopulate(val, "LongDescription", &d.LongDescription) + delete(rawMsg, key) + case "shortDescription": + err = unpopulate(val, "ShortDescription", &d.ShortDescription) + 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 DeviceDetails. +func (d DeviceDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "managementResourceId", d.ManagementResourceID) + populate(objectMap, "managementResourceTenantId", d.ManagementResourceTenantID) + populate(objectMap, "serialNumber", d.SerialNumber) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceDetails. +func (d *DeviceDetails) UnmarshalJSON(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 "managementResourceId": + err = unpopulate(val, "ManagementResourceID", &d.ManagementResourceID) + delete(rawMsg, key) + case "managementResourceTenantId": + err = unpopulate(val, "ManagementResourceTenantID", &d.ManagementResourceTenantID) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &d.SerialNumber) + 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 Dimensions. +func (d Dimensions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "depth", d.Depth) + populate(objectMap, "height", d.Height) + populate(objectMap, "length", d.Length) + populate(objectMap, "lengthHeightUnit", d.LengthHeightUnit) + populate(objectMap, "weight", d.Weight) + populate(objectMap, "weightUnit", d.WeightUnit) + populate(objectMap, "width", d.Width) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Dimensions. +func (d *Dimensions) UnmarshalJSON(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 "depth": + err = unpopulate(val, "Depth", &d.Depth) + delete(rawMsg, key) + case "height": + err = unpopulate(val, "Height", &d.Height) + delete(rawMsg, key) + case "length": + err = unpopulate(val, "Length", &d.Length) + delete(rawMsg, key) + case "lengthHeightUnit": + err = unpopulate(val, "LengthHeightUnit", &d.LengthHeightUnit) + delete(rawMsg, key) + case "weight": + err = unpopulate(val, "Weight", &d.Weight) + delete(rawMsg, key) + case "weightUnit": + err = unpopulate(val, "WeightUnit", &d.WeightUnit) + delete(rawMsg, key) + case "width": + err = unpopulate(val, "Width", &d.Width) + 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 DisplayInfo. +func (d DisplayInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "configurationDisplayName", d.ConfigurationDisplayName) + populate(objectMap, "productFamilyDisplayName", d.ProductFamilyDisplayName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DisplayInfo. +func (d *DisplayInfo) UnmarshalJSON(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 "configurationDisplayName": + err = unpopulate(val, "ConfigurationDisplayName", &d.ConfigurationDisplayName) + delete(rawMsg, key) + case "productFamilyDisplayName": + err = unpopulate(val, "ProductFamilyDisplayName", &d.ProductFamilyDisplayName) + 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 EncryptionPreferences. +func (e EncryptionPreferences) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "doubleEncryptionStatus", e.DoubleEncryptionStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionPreferences. +func (e *EncryptionPreferences) UnmarshalJSON(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 "doubleEncryptionStatus": + err = unpopulate(val, "DoubleEncryptionStatus", &e.DoubleEncryptionStatus) + 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 ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(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 "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(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 "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, 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 ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(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 "error": + err = unpopulate(val, "Error", &e.Error) + 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 FilterableProperty. +func (f FilterableProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "supportedValues", f.SupportedValues) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FilterableProperty. +func (f *FilterableProperty) UnmarshalJSON(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 "supportedValues": + err = unpopulate(val, "SupportedValues", &f.SupportedValues) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + 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 ForwardShippingDetails. +func (f ForwardShippingDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "carrierDisplayName", f.CarrierDisplayName) + populate(objectMap, "carrierName", f.CarrierName) + populate(objectMap, "trackingId", f.TrackingID) + populate(objectMap, "trackingUrl", f.TrackingURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForwardShippingDetails. +func (f *ForwardShippingDetails) UnmarshalJSON(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 "carrierDisplayName": + err = unpopulate(val, "CarrierDisplayName", &f.CarrierDisplayName) + delete(rawMsg, key) + case "carrierName": + err = unpopulate(val, "CarrierName", &f.CarrierName) + delete(rawMsg, key) + case "trackingId": + err = unpopulate(val, "TrackingID", &f.TrackingID) + delete(rawMsg, key) + case "trackingUrl": + err = unpopulate(val, "TrackingURL", &f.TrackingURL) + 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 GroupedChildConfigurations. +func (g GroupedChildConfigurations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "categoryInformation", g.CategoryInformation) + populate(objectMap, "childConfigurations", g.ChildConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupedChildConfigurations. +func (g *GroupedChildConfigurations) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "categoryInformation": + err = unpopulate(val, "CategoryInformation", &g.CategoryInformation) + delete(rawMsg, key) + case "childConfigurations": + err = unpopulate(val, "ChildConfigurations", &g.ChildConfigurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HierarchyInformation. +func (h HierarchyInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "configurationName", h.ConfigurationName) + populate(objectMap, "productFamilyName", h.ProductFamilyName) + populate(objectMap, "productLineName", h.ProductLineName) + populate(objectMap, "productName", h.ProductName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HierarchyInformation. +func (h *HierarchyInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configurationName": + err = unpopulate(val, "ConfigurationName", &h.ConfigurationName) + delete(rawMsg, key) + case "productFamilyName": + err = unpopulate(val, "ProductFamilyName", &h.ProductFamilyName) + delete(rawMsg, key) + case "productLineName": + err = unpopulate(val, "ProductLineName", &h.ProductLineName) + delete(rawMsg, key) + case "productName": + err = unpopulate(val, "ProductName", &h.ProductName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageInformation. +func (i ImageInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "imageType", i.ImageType) + populate(objectMap, "imageUrl", i.ImageURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageInformation. +func (i *ImageInformation) UnmarshalJSON(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 "imageType": + err = unpopulate(val, "ImageType", &i.ImageType) + delete(rawMsg, key) + case "imageUrl": + err = unpopulate(val, "ImageURL", &i.ImageURL) + 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 Link. +func (l Link) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "linkType", l.LinkType) + populate(objectMap, "linkUrl", l.LinkURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Link. +func (l *Link) UnmarshalJSON(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 "linkType": + err = unpopulate(val, "LinkType", &l.LinkType) + delete(rawMsg, key) + case "linkUrl": + err = unpopulate(val, "LinkURL", &l.LinkURL) + 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 ManagementResourcePreferences. +func (m ManagementResourcePreferences) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "preferredManagementResourceId", m.PreferredManagementResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementResourcePreferences. +func (m *ManagementResourcePreferences) UnmarshalJSON(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 "preferredManagementResourceId": + err = unpopulate(val, "PreferredManagementResourceID", &m.PreferredManagementResourceID) + 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 MeterDetails. +func (m MeterDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["billingType"] = m.BillingType + populate(objectMap, "chargingType", m.ChargingType) + populate(objectMap, "multiplier", m.Multiplier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MeterDetails. +func (m *MeterDetails) UnmarshalJSON(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 "billingType": + err = unpopulate(val, "BillingType", &m.BillingType) + delete(rawMsg, key) + case "chargingType": + err = unpopulate(val, "ChargingType", &m.ChargingType) + delete(rawMsg, key) + case "multiplier": + err = unpopulate(val, "Multiplier", &m.Multiplier) + 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 NotificationPreference. +func (n NotificationPreference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sendNotification", n.SendNotification) + populate(objectMap, "stageName", n.StageName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationPreference. +func (n *NotificationPreference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sendNotification": + err = unpopulate(val, "SendNotification", &n.SendNotification) + delete(rawMsg, key) + case "stageName": + err = unpopulate(val, "StageName", &n.StageName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OrderItemDetails. +func (o OrderItemDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cancellationReason", o.CancellationReason) + populate(objectMap, "cancellationStatus", o.CancellationStatus) + populate(objectMap, "currentStage", o.CurrentStage) + populate(objectMap, "deletionStatus", o.DeletionStatus) + populate(objectMap, "error", o.Error) + populate(objectMap, "forwardShippingDetails", o.ForwardShippingDetails) + populate(objectMap, "managementRpDetailsList", o.ManagementRpDetailsList) + populate(objectMap, "notificationEmailList", o.NotificationEmailList) + populate(objectMap, "orderItemMode", o.OrderItemMode) + populate(objectMap, "orderItemStageHistory", o.OrderItemStageHistory) + populate(objectMap, "orderItemType", o.OrderItemType) + populate(objectMap, "preferences", o.Preferences) + populate(objectMap, "productDetails", o.ProductDetails) + populate(objectMap, "returnReason", o.ReturnReason) + populate(objectMap, "returnStatus", o.ReturnStatus) + populate(objectMap, "reverseShippingDetails", o.ReverseShippingDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrderItemDetails. +func (o *OrderItemDetails) UnmarshalJSON(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 "cancellationReason": + err = unpopulate(val, "CancellationReason", &o.CancellationReason) + delete(rawMsg, key) + case "cancellationStatus": + err = unpopulate(val, "CancellationStatus", &o.CancellationStatus) + delete(rawMsg, key) + case "currentStage": + err = unpopulate(val, "CurrentStage", &o.CurrentStage) + delete(rawMsg, key) + case "deletionStatus": + err = unpopulate(val, "DeletionStatus", &o.DeletionStatus) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "forwardShippingDetails": + err = unpopulate(val, "ForwardShippingDetails", &o.ForwardShippingDetails) + delete(rawMsg, key) + case "managementRpDetailsList": + err = unpopulate(val, "ManagementRpDetailsList", &o.ManagementRpDetailsList) + delete(rawMsg, key) + case "notificationEmailList": + err = unpopulate(val, "NotificationEmailList", &o.NotificationEmailList) + delete(rawMsg, key) + case "orderItemMode": + err = unpopulate(val, "OrderItemMode", &o.OrderItemMode) + delete(rawMsg, key) + case "orderItemStageHistory": + err = unpopulate(val, "OrderItemStageHistory", &o.OrderItemStageHistory) + delete(rawMsg, key) + case "orderItemType": + err = unpopulate(val, "OrderItemType", &o.OrderItemType) + delete(rawMsg, key) + case "preferences": + err = unpopulate(val, "Preferences", &o.Preferences) + delete(rawMsg, key) + case "productDetails": + err = unpopulate(val, "ProductDetails", &o.ProductDetails) + delete(rawMsg, key) + case "returnReason": + err = unpopulate(val, "ReturnReason", &o.ReturnReason) + delete(rawMsg, key) + case "returnStatus": + err = unpopulate(val, "ReturnStatus", &o.ReturnStatus) + delete(rawMsg, key) + case "reverseShippingDetails": + err = unpopulate(val, "ReverseShippingDetails", &o.ReverseShippingDetails) + 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 OrderItemProperties. +func (o OrderItemProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressDetails", o.AddressDetails) + populate(objectMap, "orderId", o.OrderID) + populate(objectMap, "orderItemDetails", o.OrderItemDetails) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrderItemProperties. +func (o *OrderItemProperties) UnmarshalJSON(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 "addressDetails": + err = unpopulate(val, "AddressDetails", &o.AddressDetails) + delete(rawMsg, key) + case "orderId": + err = unpopulate(val, "OrderID", &o.OrderID) + delete(rawMsg, key) + case "orderItemDetails": + err = unpopulate(val, "OrderItemDetails", &o.OrderItemDetails) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) + 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 OrderItemResource. +func (o OrderItemResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", o.ID) + populate(objectMap, "location", o.Location) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "tags", o.Tags) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrderItemResource. +func (o *OrderItemResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &o.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &o.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OrderItemResourceList. +func (o OrderItemResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrderItemResourceList. +func (o *OrderItemResourceList) UnmarshalJSON(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 OrderItemUpdateParameter. +func (o OrderItemUpdateParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "tags", o.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrderItemUpdateParameter. +func (o *OrderItemUpdateParameter) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &o.Tags) + 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 OrderItemUpdateProperties. +func (o OrderItemUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "forwardAddress", o.ForwardAddress) + populate(objectMap, "notificationEmailList", o.NotificationEmailList) + populate(objectMap, "preferences", o.Preferences) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrderItemUpdateProperties. +func (o *OrderItemUpdateProperties) UnmarshalJSON(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 "forwardAddress": + err = unpopulate(val, "ForwardAddress", &o.ForwardAddress) + delete(rawMsg, key) + case "notificationEmailList": + err = unpopulate(val, "NotificationEmailList", &o.NotificationEmailList) + delete(rawMsg, key) + case "preferences": + err = unpopulate(val, "Preferences", &o.Preferences) + 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 OrderProperties. +func (o OrderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentStage", o.CurrentStage) + populate(objectMap, "orderItemIds", o.OrderItemIDs) + populate(objectMap, "orderMode", o.OrderMode) + populate(objectMap, "orderStageHistory", o.OrderStageHistory) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrderProperties. +func (o *OrderProperties) UnmarshalJSON(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 "currentStage": + err = unpopulate(val, "CurrentStage", &o.CurrentStage) + delete(rawMsg, key) + case "orderItemIds": + err = unpopulate(val, "OrderItemIDs", &o.OrderItemIDs) + delete(rawMsg, key) + case "orderMode": + err = unpopulate(val, "OrderMode", &o.OrderMode) + delete(rawMsg, key) + case "orderStageHistory": + err = unpopulate(val, "OrderStageHistory", &o.OrderStageHistory) + 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 OrderResource. +func (o OrderResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrderResource. +func (o *OrderResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OrderResourceList. +func (o OrderResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrderResourceList. +func (o *OrderResourceList) UnmarshalJSON(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 Pav2MeterDetails. +func (p Pav2MeterDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["billingType"] = BillingTypePav2 + populate(objectMap, "chargingType", p.ChargingType) + populate(objectMap, "meterGuid", p.MeterGUID) + populate(objectMap, "multiplier", p.Multiplier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Pav2MeterDetails. +func (p *Pav2MeterDetails) UnmarshalJSON(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 "billingType": + err = unpopulate(val, "BillingType", &p.BillingType) + delete(rawMsg, key) + case "chargingType": + err = unpopulate(val, "ChargingType", &p.ChargingType) + delete(rawMsg, key) + case "meterGuid": + err = unpopulate(val, "MeterGUID", &p.MeterGUID) + delete(rawMsg, key) + case "multiplier": + err = unpopulate(val, "Multiplier", &p.Multiplier) + 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 Preferences. +func (p Preferences) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "encryptionPreferences", p.EncryptionPreferences) + populate(objectMap, "managementResourcePreferences", p.ManagementResourcePreferences) + populate(objectMap, "notificationPreferences", p.NotificationPreferences) + populate(objectMap, "transportPreferences", p.TransportPreferences) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Preferences. +func (p *Preferences) UnmarshalJSON(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 "encryptionPreferences": + err = unpopulate(val, "EncryptionPreferences", &p.EncryptionPreferences) + delete(rawMsg, key) + case "managementResourcePreferences": + err = unpopulate(val, "ManagementResourcePreferences", &p.ManagementResourcePreferences) + delete(rawMsg, key) + case "notificationPreferences": + err = unpopulate(val, "NotificationPreferences", &p.NotificationPreferences) + delete(rawMsg, key) + case "transportPreferences": + err = unpopulate(val, "TransportPreferences", &p.TransportPreferences) + 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 Product. +func (p Product) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Product. +func (p *Product) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &p.Properties) + 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 ProductDetails. +func (p ProductDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "childConfigurationDeviceDetails", p.ChildConfigurationDeviceDetails) + populate(objectMap, "displayInfo", p.DisplayInfo) + populate(objectMap, "hierarchyInformation", p.HierarchyInformation) + populate(objectMap, "identificationType", p.IdentificationType) + populate(objectMap, "optInAdditionalConfigurations", p.OptInAdditionalConfigurations) + populate(objectMap, "parentDeviceDetails", p.ParentDeviceDetails) + populate(objectMap, "productDoubleEncryptionStatus", p.ProductDoubleEncryptionStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductDetails. +func (p *ProductDetails) UnmarshalJSON(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 "childConfigurationDeviceDetails": + err = unpopulate(val, "ChildConfigurationDeviceDetails", &p.ChildConfigurationDeviceDetails) + delete(rawMsg, key) + case "displayInfo": + err = unpopulate(val, "DisplayInfo", &p.DisplayInfo) + delete(rawMsg, key) + case "hierarchyInformation": + err = unpopulate(val, "HierarchyInformation", &p.HierarchyInformation) + delete(rawMsg, key) + case "identificationType": + err = unpopulate(val, "IdentificationType", &p.IdentificationType) + delete(rawMsg, key) + case "optInAdditionalConfigurations": + err = unpopulate(val, "OptInAdditionalConfigurations", &p.OptInAdditionalConfigurations) + delete(rawMsg, key) + case "parentDeviceDetails": + err = unpopulate(val, "ParentDeviceDetails", &p.ParentDeviceDetails) + delete(rawMsg, key) + case "productDoubleEncryptionStatus": + err = unpopulate(val, "ProductDoubleEncryptionStatus", &p.ProductDoubleEncryptionStatus) + 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 ProductFamilies. +func (p ProductFamilies) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductFamilies. +func (p *ProductFamilies) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProductFamiliesMetadata. +func (p ProductFamiliesMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductFamiliesMetadata. +func (p *ProductFamiliesMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProductFamiliesMetadataDetails. +func (p ProductFamiliesMetadataDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductFamiliesMetadataDetails. +func (p *ProductFamiliesMetadataDetails) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &p.Properties) + 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 ProductFamiliesRequest. +func (p ProductFamiliesRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customerSubscriptionDetails", p.CustomerSubscriptionDetails) + populate(objectMap, "filterableProperties", p.FilterableProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductFamiliesRequest. +func (p *ProductFamiliesRequest) UnmarshalJSON(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 "customerSubscriptionDetails": + err = unpopulate(val, "CustomerSubscriptionDetails", &p.CustomerSubscriptionDetails) + delete(rawMsg, key) + case "filterableProperties": + err = unpopulate(val, "FilterableProperties", &p.FilterableProperties) + 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 ProductFamily. +func (p ProductFamily) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductFamily. +func (p *ProductFamily) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &p.Properties) + 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 ProductFamilyProperties. +func (p ProductFamilyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityInformation", p.AvailabilityInformation) + populate(objectMap, "costInformation", p.CostInformation) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "filterableProperties", p.FilterableProperties) + populate(objectMap, "fulfilledBy", p.FulfilledBy) + populate(objectMap, "hierarchyInformation", p.HierarchyInformation) + populate(objectMap, "imageInformation", p.ImageInformation) + populate(objectMap, "productLines", p.ProductLines) + populate(objectMap, "resourceProviderDetails", p.ResourceProviderDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductFamilyProperties. +func (p *ProductFamilyProperties) UnmarshalJSON(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 "availabilityInformation": + err = unpopulate(val, "AvailabilityInformation", &p.AvailabilityInformation) + delete(rawMsg, key) + case "costInformation": + err = unpopulate(val, "CostInformation", &p.CostInformation) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "filterableProperties": + err = unpopulate(val, "FilterableProperties", &p.FilterableProperties) + delete(rawMsg, key) + case "fulfilledBy": + err = unpopulate(val, "FulfilledBy", &p.FulfilledBy) + delete(rawMsg, key) + case "hierarchyInformation": + err = unpopulate(val, "HierarchyInformation", &p.HierarchyInformation) + delete(rawMsg, key) + case "imageInformation": + err = unpopulate(val, "ImageInformation", &p.ImageInformation) + delete(rawMsg, key) + case "productLines": + err = unpopulate(val, "ProductLines", &p.ProductLines) + delete(rawMsg, key) + case "resourceProviderDetails": + err = unpopulate(val, "ResourceProviderDetails", &p.ResourceProviderDetails) + 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 ProductLine. +func (p ProductLine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductLine. +func (p *ProductLine) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &p.Properties) + 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 ProductLineProperties. +func (p ProductLineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityInformation", p.AvailabilityInformation) + populate(objectMap, "costInformation", p.CostInformation) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "filterableProperties", p.FilterableProperties) + populate(objectMap, "fulfilledBy", p.FulfilledBy) + populate(objectMap, "hierarchyInformation", p.HierarchyInformation) + populate(objectMap, "imageInformation", p.ImageInformation) + populate(objectMap, "products", p.Products) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductLineProperties. +func (p *ProductLineProperties) UnmarshalJSON(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 "availabilityInformation": + err = unpopulate(val, "AvailabilityInformation", &p.AvailabilityInformation) + delete(rawMsg, key) + case "costInformation": + err = unpopulate(val, "CostInformation", &p.CostInformation) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "filterableProperties": + err = unpopulate(val, "FilterableProperties", &p.FilterableProperties) + delete(rawMsg, key) + case "fulfilledBy": + err = unpopulate(val, "FulfilledBy", &p.FulfilledBy) + delete(rawMsg, key) + case "hierarchyInformation": + err = unpopulate(val, "HierarchyInformation", &p.HierarchyInformation) + delete(rawMsg, key) + case "imageInformation": + err = unpopulate(val, "ImageInformation", &p.ImageInformation) + delete(rawMsg, key) + case "products": + err = unpopulate(val, "Products", &p.Products) + 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 ProductProperties. +func (p ProductProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityInformation", p.AvailabilityInformation) + populate(objectMap, "configurations", p.Configurations) + populate(objectMap, "costInformation", p.CostInformation) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "filterableProperties", p.FilterableProperties) + populate(objectMap, "fulfilledBy", p.FulfilledBy) + populate(objectMap, "hierarchyInformation", p.HierarchyInformation) + populate(objectMap, "imageInformation", p.ImageInformation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductProperties. +func (p *ProductProperties) UnmarshalJSON(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 "availabilityInformation": + err = unpopulate(val, "AvailabilityInformation", &p.AvailabilityInformation) + delete(rawMsg, key) + case "configurations": + err = unpopulate(val, "Configurations", &p.Configurations) + delete(rawMsg, key) + case "costInformation": + err = unpopulate(val, "CostInformation", &p.CostInformation) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "filterableProperties": + err = unpopulate(val, "FilterableProperties", &p.FilterableProperties) + delete(rawMsg, key) + case "fulfilledBy": + err = unpopulate(val, "FulfilledBy", &p.FulfilledBy) + delete(rawMsg, key) + case "hierarchyInformation": + err = unpopulate(val, "HierarchyInformation", &p.HierarchyInformation) + delete(rawMsg, key) + case "imageInformation": + err = unpopulate(val, "ImageInformation", &p.ImageInformation) + 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 ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PurchaseMeterDetails. +func (p PurchaseMeterDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["billingType"] = BillingTypePurchase + populate(objectMap, "chargingType", p.ChargingType) + populate(objectMap, "multiplier", p.Multiplier) + populate(objectMap, "productId", p.ProductID) + populate(objectMap, "skuId", p.SKUID) + populate(objectMap, "termId", p.TermID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PurchaseMeterDetails. +func (p *PurchaseMeterDetails) UnmarshalJSON(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 "billingType": + err = unpopulate(val, "BillingType", &p.BillingType) + delete(rawMsg, key) + case "chargingType": + err = unpopulate(val, "ChargingType", &p.ChargingType) + delete(rawMsg, key) + case "multiplier": + err = unpopulate(val, "Multiplier", &p.Multiplier) + delete(rawMsg, key) + case "productId": + err = unpopulate(val, "ProductID", &p.ProductID) + delete(rawMsg, key) + case "skuId": + err = unpopulate(val, "SKUID", &p.SKUID) + delete(rawMsg, key) + case "termId": + err = unpopulate(val, "TermID", &p.TermID) + 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 Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceMoveRequest. +func (r ResourceMoveRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resources", r.Resources) + populate(objectMap, "targetResourceGroup", r.TargetResourceGroup) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceMoveRequest. +func (r *ResourceMoveRequest) UnmarshalJSON(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 "resources": + err = unpopulate(val, "Resources", &r.Resources) + delete(rawMsg, key) + case "targetResourceGroup": + err = unpopulate(val, "TargetResourceGroup", &r.TargetResourceGroup) + 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 ResourceProviderDetails. +func (r ResourceProviderDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceProviderNamespace", r.ResourceProviderNamespace) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderDetails. +func (r *ResourceProviderDetails) UnmarshalJSON(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 "resourceProviderNamespace": + err = unpopulate(val, "ResourceProviderNamespace", &r.ResourceProviderNamespace) + 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 ReturnOrderItemDetails. +func (r ReturnOrderItemDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "returnAddress", r.ReturnAddress) + populate(objectMap, "returnReason", r.ReturnReason) + populate(objectMap, "serviceTag", r.ServiceTag) + populate(objectMap, "shippingBoxRequired", r.ShippingBoxRequired) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReturnOrderItemDetails. +func (r *ReturnOrderItemDetails) UnmarshalJSON(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 "returnAddress": + err = unpopulate(val, "ReturnAddress", &r.ReturnAddress) + delete(rawMsg, key) + case "returnReason": + err = unpopulate(val, "ReturnReason", &r.ReturnReason) + delete(rawMsg, key) + case "serviceTag": + err = unpopulate(val, "ServiceTag", &r.ServiceTag) + delete(rawMsg, key) + case "shippingBoxRequired": + err = unpopulate(val, "ShippingBoxRequired", &r.ShippingBoxRequired) + 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 ReverseShippingDetails. +func (r ReverseShippingDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "carrierDisplayName", r.CarrierDisplayName) + populate(objectMap, "carrierName", r.CarrierName) + populate(objectMap, "sasKeyForLabel", r.SasKeyForLabel) + populate(objectMap, "trackingId", r.TrackingID) + populate(objectMap, "trackingUrl", r.TrackingURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReverseShippingDetails. +func (r *ReverseShippingDetails) UnmarshalJSON(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 "carrierDisplayName": + err = unpopulate(val, "CarrierDisplayName", &r.CarrierDisplayName) + delete(rawMsg, key) + case "carrierName": + err = unpopulate(val, "CarrierName", &r.CarrierName) + delete(rawMsg, key) + case "sasKeyForLabel": + err = unpopulate(val, "SasKeyForLabel", &r.SasKeyForLabel) + delete(rawMsg, key) + case "trackingId": + err = unpopulate(val, "TrackingID", &r.TrackingID) + delete(rawMsg, key) + case "trackingUrl": + err = unpopulate(val, "TrackingURL", &r.TrackingURL) + 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 ShippingAddress. +func (s ShippingAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressType", s.AddressType) + populate(objectMap, "city", s.City) + populate(objectMap, "companyName", s.CompanyName) + populate(objectMap, "country", s.Country) + populate(objectMap, "postalCode", s.PostalCode) + populate(objectMap, "stateOrProvince", s.StateOrProvince) + populate(objectMap, "streetAddress1", s.StreetAddress1) + populate(objectMap, "streetAddress2", s.StreetAddress2) + populate(objectMap, "streetAddress3", s.StreetAddress3) + populate(objectMap, "zipExtendedCode", s.ZipExtendedCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ShippingAddress. +func (s *ShippingAddress) UnmarshalJSON(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 "addressType": + err = unpopulate(val, "AddressType", &s.AddressType) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &s.City) + delete(rawMsg, key) + case "companyName": + err = unpopulate(val, "CompanyName", &s.CompanyName) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &s.Country) + delete(rawMsg, key) + case "postalCode": + err = unpopulate(val, "PostalCode", &s.PostalCode) + delete(rawMsg, key) + case "stateOrProvince": + err = unpopulate(val, "StateOrProvince", &s.StateOrProvince) + delete(rawMsg, key) + case "streetAddress1": + err = unpopulate(val, "StreetAddress1", &s.StreetAddress1) + delete(rawMsg, key) + case "streetAddress2": + err = unpopulate(val, "StreetAddress2", &s.StreetAddress2) + delete(rawMsg, key) + case "streetAddress3": + err = unpopulate(val, "StreetAddress3", &s.StreetAddress3) + delete(rawMsg, key) + case "zipExtendedCode": + err = unpopulate(val, "ZipExtendedCode", &s.ZipExtendedCode) + 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 Specification. +func (s Specification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Specification. +func (s *Specification) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StageDetails. +func (s StageDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "stageName", s.StageName) + populate(objectMap, "stageStatus", s.StageStatus) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StageDetails. +func (s *StageDetails) UnmarshalJSON(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 "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "stageName": + err = unpopulate(val, "StageName", &s.StageName) + delete(rawMsg, key) + case "stageStatus": + err = unpopulate(val, "StageStatus", &s.StageStatus) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &s.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + 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 TransportPreferences. +func (t TransportPreferences) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "preferredShipmentType", t.PreferredShipmentType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TransportPreferences. +func (t *TransportPreferences) UnmarshalJSON(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 "preferredShipmentType": + err = unpopulate(val, "PreferredShipmentType", &t.PreferredShipmentType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/operations_client.go b/sdk/resourcemanager/edgeorder/armedgeorder/operations_client.go new file mode 100644 index 000000000000..a2fc1c5ffdcf --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/operations_client.go @@ -0,0 +1,105 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armedgeorder + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + host string + pl runtime.Pipeline +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.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 := &OperationsClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - List all the supported operations. +// +// Generated from API version 2022-05-01-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.EdgeOrder/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/orderitems_client.go b/sdk/resourcemanager/edgeorder/armedgeorder/orderitems_client.go new file mode 100644 index 000000000000..99782f39f03c --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/orderitems_client.go @@ -0,0 +1,579 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armedgeorder + +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" + "strconv" + "strings" +) + +// OrderItemsClient contains the methods for the OrderItems group. +// Don't use this type directly, use NewOrderItemsClient() instead. +type OrderItemsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewOrderItemsClient creates a new instance of OrderItemsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOrderItemsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OrderItemsClient, 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 := &OrderItemsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Cancel - Cancel order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - orderItemName - The name of the order item. +// - cancellationReason - Reason for cancellation. +// - options - OrderItemsClientCancelOptions contains the optional parameters for the OrderItemsClient.Cancel method. +func (client *OrderItemsClient) Cancel(ctx context.Context, resourceGroupName string, orderItemName string, cancellationReason CancellationReason, options *OrderItemsClientCancelOptions) (OrderItemsClientCancelResponse, error) { + req, err := client.cancelCreateRequest(ctx, resourceGroupName, orderItemName, cancellationReason, options) + if err != nil { + return OrderItemsClientCancelResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OrderItemsClientCancelResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return OrderItemsClientCancelResponse{}, runtime.NewResponseError(resp) + } + return OrderItemsClientCancelResponse{}, nil +} + +// cancelCreateRequest creates the Cancel request. +func (client *OrderItemsClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, orderItemName string, cancellationReason CancellationReason, options *OrderItemsClientCancelOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}/cancel" + 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 orderItemName == "" { + return nil, errors.New("parameter orderItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{orderItemName}", url.PathEscape(orderItemName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, cancellationReason) +} + +// BeginCreate - Create an order item. Existing order item cannot be updated with this api and should instead be updated with +// the Update order item API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - orderItemName - The name of the order item. +// - orderItemResource - Order item details from request body. +// - options - OrderItemsClientBeginCreateOptions contains the optional parameters for the OrderItemsClient.BeginCreate method. +func (client *OrderItemsClient) BeginCreate(ctx context.Context, resourceGroupName string, orderItemName string, orderItemResource OrderItemResource, options *OrderItemsClientBeginCreateOptions) (*runtime.Poller[OrderItemsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, orderItemName, orderItemResource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[OrderItemsClientCreateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[OrderItemsClientCreateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Create - Create an order item. Existing order item cannot be updated with this api and should instead be updated with the +// Update order item API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +func (client *OrderItemsClient) create(ctx context.Context, resourceGroupName string, orderItemName string, orderItemResource OrderItemResource, options *OrderItemsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, orderItemName, orderItemResource, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *OrderItemsClient) createCreateRequest(ctx context.Context, resourceGroupName string, orderItemName string, orderItemResource OrderItemResource, options *OrderItemsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" + 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 orderItemName == "" { + return nil, errors.New("parameter orderItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{orderItemName}", url.PathEscape(orderItemName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, orderItemResource) +} + +// BeginDelete - Delete an order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - orderItemName - The name of the order item. +// - options - OrderItemsClientBeginDeleteOptions contains the optional parameters for the OrderItemsClient.BeginDelete method. +func (client *OrderItemsClient) BeginDelete(ctx context.Context, resourceGroupName string, orderItemName string, options *OrderItemsClientBeginDeleteOptions) (*runtime.Poller[OrderItemsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, orderItemName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[OrderItemsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[OrderItemsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete an order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +func (client *OrderItemsClient) deleteOperation(ctx context.Context, resourceGroupName string, orderItemName string, options *OrderItemsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, orderItemName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *OrderItemsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, orderItemName string, options *OrderItemsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" + 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 orderItemName == "" { + return nil, errors.New("parameter orderItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{orderItemName}", url.PathEscape(orderItemName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get an order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - orderItemName - The name of the order item. +// - options - OrderItemsClientGetOptions contains the optional parameters for the OrderItemsClient.Get method. +func (client *OrderItemsClient) Get(ctx context.Context, resourceGroupName string, orderItemName string, options *OrderItemsClientGetOptions) (OrderItemsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, orderItemName, options) + if err != nil { + return OrderItemsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OrderItemsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OrderItemsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *OrderItemsClient) getCreateRequest(ctx context.Context, resourceGroupName string, orderItemName string, options *OrderItemsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" + 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 orderItemName == "" { + return nil, errors.New("parameter orderItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{orderItemName}", url.PathEscape(orderItemName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OrderItemsClient) getHandleResponse(resp *http.Response) (OrderItemsClientGetResponse, error) { + result := OrderItemsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrderItemResource); err != nil { + return OrderItemsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List order items at resource group level. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - OrderItemsClientListByResourceGroupOptions contains the optional parameters for the OrderItemsClient.NewListByResourceGroupPager +// method. +func (client *OrderItemsClient) NewListByResourceGroupPager(resourceGroupName string, options *OrderItemsClientListByResourceGroupOptions) *runtime.Pager[OrderItemsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[OrderItemsClientListByResourceGroupResponse]{ + More: func(page OrderItemsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OrderItemsClientListByResourceGroupResponse) (OrderItemsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OrderItemsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OrderItemsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OrderItemsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *OrderItemsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *OrderItemsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *OrderItemsClient) listByResourceGroupHandleResponse(resp *http.Response) (OrderItemsClientListByResourceGroupResponse, error) { + result := OrderItemsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrderItemResourceList); err != nil { + return OrderItemsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List order items at subscription level. +// +// Generated from API version 2022-05-01-preview +// - options - OrderItemsClientListBySubscriptionOptions contains the optional parameters for the OrderItemsClient.NewListBySubscriptionPager +// method. +func (client *OrderItemsClient) NewListBySubscriptionPager(options *OrderItemsClientListBySubscriptionOptions) *runtime.Pager[OrderItemsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[OrderItemsClientListBySubscriptionResponse]{ + More: func(page OrderItemsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OrderItemsClientListBySubscriptionResponse) (OrderItemsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OrderItemsClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OrderItemsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OrderItemsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *OrderItemsClient) listBySubscriptionCreateRequest(ctx context.Context, options *OrderItemsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *OrderItemsClient) listBySubscriptionHandleResponse(resp *http.Response) (OrderItemsClientListBySubscriptionResponse, error) { + result := OrderItemsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrderItemResourceList); err != nil { + return OrderItemsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginReturn - Return order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - orderItemName - The name of the order item. +// - returnOrderItemDetails - Return order item details. +// - options - OrderItemsClientBeginReturnOptions contains the optional parameters for the OrderItemsClient.BeginReturn method. +func (client *OrderItemsClient) BeginReturn(ctx context.Context, resourceGroupName string, orderItemName string, returnOrderItemDetails ReturnOrderItemDetails, options *OrderItemsClientBeginReturnOptions) (*runtime.Poller[OrderItemsClientReturnResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.returnOperation(ctx, resourceGroupName, orderItemName, returnOrderItemDetails, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[OrderItemsClientReturnResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[OrderItemsClientReturnResponse](options.ResumeToken, client.pl, nil) + } +} + +// Return - Return order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +func (client *OrderItemsClient) returnOperation(ctx context.Context, resourceGroupName string, orderItemName string, returnOrderItemDetails ReturnOrderItemDetails, options *OrderItemsClientBeginReturnOptions) (*http.Response, error) { + req, err := client.returnCreateRequest(ctx, resourceGroupName, orderItemName, returnOrderItemDetails, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// returnCreateRequest creates the Return request. +func (client *OrderItemsClient) returnCreateRequest(ctx context.Context, resourceGroupName string, orderItemName string, returnOrderItemDetails ReturnOrderItemDetails, options *OrderItemsClientBeginReturnOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}/return" + 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 orderItemName == "" { + return nil, errors.New("parameter orderItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{orderItemName}", url.PathEscape(orderItemName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, returnOrderItemDetails) +} + +// BeginUpdate - Update the properties of an existing order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - orderItemName - The name of the order item. +// - orderItemUpdateParameter - Order item update parameters from request body. +// - options - OrderItemsClientBeginUpdateOptions contains the optional parameters for the OrderItemsClient.BeginUpdate method. +func (client *OrderItemsClient) BeginUpdate(ctx context.Context, resourceGroupName string, orderItemName string, orderItemUpdateParameter OrderItemUpdateParameter, options *OrderItemsClientBeginUpdateOptions) (*runtime.Poller[OrderItemsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, orderItemName, orderItemUpdateParameter, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[OrderItemsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[OrderItemsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Update the properties of an existing order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +func (client *OrderItemsClient) update(ctx context.Context, resourceGroupName string, orderItemName string, orderItemUpdateParameter OrderItemUpdateParameter, options *OrderItemsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, orderItemName, orderItemUpdateParameter, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *OrderItemsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, orderItemName string, orderItemUpdateParameter OrderItemUpdateParameter, options *OrderItemsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" + 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 orderItemName == "" { + return nil, errors.New("parameter orderItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{orderItemName}", url.PathEscape(orderItemName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, orderItemUpdateParameter) +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/orders_client.go b/sdk/resourcemanager/edgeorder/armedgeorder/orders_client.go new file mode 100644 index 000000000000..b0e67a470dad --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/orders_client.go @@ -0,0 +1,256 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armedgeorder + +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" + "strconv" + "strings" +) + +// OrdersClient contains the methods for the Orders group. +// Don't use this type directly, use NewOrdersClient() instead. +type OrdersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewOrdersClient creates a new instance of OrdersClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOrdersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OrdersClient, 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 := &OrdersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get an order. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - location - The name of Azure region. +// - orderName - The name of the order. +// - options - OrdersClientGetOptions contains the optional parameters for the OrdersClient.Get method. +func (client *OrdersClient) Get(ctx context.Context, resourceGroupName string, location string, orderName string, options *OrdersClientGetOptions) (OrdersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, location, orderName, options) + if err != nil { + return OrdersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OrdersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OrdersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *OrdersClient) getCreateRequest(ctx context.Context, resourceGroupName string, location string, orderName string, options *OrdersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName}" + 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 location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if orderName == "" { + return nil, errors.New("parameter orderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{orderName}", url.PathEscape(orderName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OrdersClient) getHandleResponse(resp *http.Response) (OrdersClientGetResponse, error) { + result := OrdersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrderResource); err != nil { + return OrdersClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List orders at resource group level. +// +// Generated from API version 2022-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - OrdersClientListByResourceGroupOptions contains the optional parameters for the OrdersClient.NewListByResourceGroupPager +// method. +func (client *OrdersClient) NewListByResourceGroupPager(resourceGroupName string, options *OrdersClientListByResourceGroupOptions) *runtime.Pager[OrdersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[OrdersClientListByResourceGroupResponse]{ + More: func(page OrdersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OrdersClientListByResourceGroupResponse) (OrdersClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OrdersClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OrdersClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OrdersClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *OrdersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *OrdersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orders" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *OrdersClient) listByResourceGroupHandleResponse(resp *http.Response) (OrdersClientListByResourceGroupResponse, error) { + result := OrdersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrderResourceList); err != nil { + return OrdersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List orders at subscription level. +// +// Generated from API version 2022-05-01-preview +// - options - OrdersClientListBySubscriptionOptions contains the optional parameters for the OrdersClient.NewListBySubscriptionPager +// method. +func (client *OrdersClient) NewListBySubscriptionPager(options *OrdersClientListBySubscriptionOptions) *runtime.Pager[OrdersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[OrdersClientListBySubscriptionResponse]{ + More: func(page OrdersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OrdersClientListBySubscriptionResponse) (OrdersClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OrdersClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OrdersClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OrdersClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *OrdersClient) listBySubscriptionCreateRequest(ctx context.Context, options *OrdersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *OrdersClient) listBySubscriptionHandleResponse(resp *http.Response) (OrdersClientListBySubscriptionResponse, error) { + result := OrdersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrderResourceList); err != nil { + return OrdersClientListBySubscriptionResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/edgeorder/armedgeorder/polymorphic_helpers.go similarity index 95% rename from sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_polymorphic_helpers.go rename to sdk/resourcemanager/edgeorder/armedgeorder/polymorphic_helpers.go index 6e3b4d42c7ef..d96ed7a1da06 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/polymorphic_helpers.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armedgeorder @@ -14,7 +15,7 @@ func unmarshalMeterDetailsClassification(rawMsg json.RawMessage) (MeterDetailsCl if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/productsandconfigurations_client.go b/sdk/resourcemanager/edgeorder/armedgeorder/productsandconfigurations_client.go new file mode 100644 index 000000000000..82ad2a850290 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/productsandconfigurations_client.go @@ -0,0 +1,250 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armedgeorder + +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" +) + +// ProductsAndConfigurationsClient contains the methods for the ProductsAndConfigurations group. +// Don't use this type directly, use NewProductsAndConfigurationsClient() instead. +type ProductsAndConfigurationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewProductsAndConfigurationsClient creates a new instance of ProductsAndConfigurationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProductsAndConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductsAndConfigurationsClient, 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 := &ProductsAndConfigurationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListConfigurationsPager - List configurations for the given product family, product line and product for the given subscription. +// +// Generated from API version 2022-05-01-preview +// - configurationsRequest - Filters for showing the configurations. +// - options - ProductsAndConfigurationsClientListConfigurationsOptions contains the optional parameters for the ProductsAndConfigurationsClient.NewListConfigurationsPager +// method. +func (client *ProductsAndConfigurationsClient) NewListConfigurationsPager(configurationsRequest ConfigurationsRequest, options *ProductsAndConfigurationsClientListConfigurationsOptions) *runtime.Pager[ProductsAndConfigurationsClientListConfigurationsResponse] { + return runtime.NewPager(runtime.PagingHandler[ProductsAndConfigurationsClientListConfigurationsResponse]{ + More: func(page ProductsAndConfigurationsClientListConfigurationsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProductsAndConfigurationsClientListConfigurationsResponse) (ProductsAndConfigurationsClientListConfigurationsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listConfigurationsCreateRequest(ctx, configurationsRequest, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProductsAndConfigurationsClientListConfigurationsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProductsAndConfigurationsClientListConfigurationsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProductsAndConfigurationsClientListConfigurationsResponse{}, runtime.NewResponseError(resp) + } + return client.listConfigurationsHandleResponse(resp) + }, + }) +} + +// listConfigurationsCreateRequest creates the ListConfigurations request. +func (client *ProductsAndConfigurationsClient) listConfigurationsCreateRequest(ctx context.Context, configurationsRequest ConfigurationsRequest, options *ProductsAndConfigurationsClientListConfigurationsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, configurationsRequest) +} + +// listConfigurationsHandleResponse handles the ListConfigurations response. +func (client *ProductsAndConfigurationsClient) listConfigurationsHandleResponse(resp *http.Response) (ProductsAndConfigurationsClientListConfigurationsResponse, error) { + result := ProductsAndConfigurationsClientListConfigurationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Configurations); err != nil { + return ProductsAndConfigurationsClientListConfigurationsResponse{}, err + } + return result, nil +} + +// NewListProductFamiliesPager - List product families for the given subscription. +// +// Generated from API version 2022-05-01-preview +// - productFamiliesRequest - Filters for showing the product families. +// - options - ProductsAndConfigurationsClientListProductFamiliesOptions contains the optional parameters for the ProductsAndConfigurationsClient.NewListProductFamiliesPager +// method. +func (client *ProductsAndConfigurationsClient) NewListProductFamiliesPager(productFamiliesRequest ProductFamiliesRequest, options *ProductsAndConfigurationsClientListProductFamiliesOptions) *runtime.Pager[ProductsAndConfigurationsClientListProductFamiliesResponse] { + return runtime.NewPager(runtime.PagingHandler[ProductsAndConfigurationsClientListProductFamiliesResponse]{ + More: func(page ProductsAndConfigurationsClientListProductFamiliesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProductsAndConfigurationsClientListProductFamiliesResponse) (ProductsAndConfigurationsClientListProductFamiliesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listProductFamiliesCreateRequest(ctx, productFamiliesRequest, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProductsAndConfigurationsClientListProductFamiliesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProductsAndConfigurationsClientListProductFamiliesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProductsAndConfigurationsClientListProductFamiliesResponse{}, runtime.NewResponseError(resp) + } + return client.listProductFamiliesHandleResponse(resp) + }, + }) +} + +// listProductFamiliesCreateRequest creates the ListProductFamilies request. +func (client *ProductsAndConfigurationsClient) listProductFamiliesCreateRequest(ctx context.Context, productFamiliesRequest ProductFamiliesRequest, options *ProductsAndConfigurationsClientListProductFamiliesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, productFamiliesRequest) +} + +// listProductFamiliesHandleResponse handles the ListProductFamilies response. +func (client *ProductsAndConfigurationsClient) listProductFamiliesHandleResponse(resp *http.Response) (ProductsAndConfigurationsClientListProductFamiliesResponse, error) { + result := ProductsAndConfigurationsClientListProductFamiliesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductFamilies); err != nil { + return ProductsAndConfigurationsClientListProductFamiliesResponse{}, err + } + return result, nil +} + +// NewListProductFamiliesMetadataPager - List product families metadata for the given subscription. +// +// Generated from API version 2022-05-01-preview +// - options - ProductsAndConfigurationsClientListProductFamiliesMetadataOptions contains the optional parameters for the ProductsAndConfigurationsClient.NewListProductFamiliesMetadataPager +// method. +func (client *ProductsAndConfigurationsClient) NewListProductFamiliesMetadataPager(options *ProductsAndConfigurationsClientListProductFamiliesMetadataOptions) *runtime.Pager[ProductsAndConfigurationsClientListProductFamiliesMetadataResponse] { + return runtime.NewPager(runtime.PagingHandler[ProductsAndConfigurationsClientListProductFamiliesMetadataResponse]{ + More: func(page ProductsAndConfigurationsClientListProductFamiliesMetadataResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProductsAndConfigurationsClientListProductFamiliesMetadataResponse) (ProductsAndConfigurationsClientListProductFamiliesMetadataResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listProductFamiliesMetadataCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProductsAndConfigurationsClientListProductFamiliesMetadataResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProductsAndConfigurationsClientListProductFamiliesMetadataResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProductsAndConfigurationsClientListProductFamiliesMetadataResponse{}, runtime.NewResponseError(resp) + } + return client.listProductFamiliesMetadataHandleResponse(resp) + }, + }) +} + +// listProductFamiliesMetadataCreateRequest creates the ListProductFamiliesMetadata request. +func (client *ProductsAndConfigurationsClient) listProductFamiliesMetadataCreateRequest(ctx context.Context, options *ProductsAndConfigurationsClientListProductFamiliesMetadataOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01-preview") + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listProductFamiliesMetadataHandleResponse handles the ListProductFamiliesMetadata response. +func (client *ProductsAndConfigurationsClient) listProductFamiliesMetadataHandleResponse(resp *http.Response) (ProductsAndConfigurationsClientListProductFamiliesMetadataResponse, error) { + result := ProductsAndConfigurationsClientListProductFamiliesMetadataResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductFamiliesMetadata); err != nil { + return ProductsAndConfigurationsClientListProductFamiliesMetadataResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/response_types.go b/sdk/resourcemanager/edgeorder/armedgeorder/response_types.go new file mode 100644 index 000000000000..8efc11f08311 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/response_types.go @@ -0,0 +1,115 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armedgeorder + +// AddressesClientCreateResponse contains the response from method AddressesClient.BeginCreate. +type AddressesClientCreateResponse struct { + AddressResource +} + +// AddressesClientDeleteResponse contains the response from method AddressesClient.BeginDelete. +type AddressesClientDeleteResponse struct { + // placeholder for future response values +} + +// AddressesClientGetResponse contains the response from method AddressesClient.Get. +type AddressesClientGetResponse struct { + AddressResource +} + +// AddressesClientListByResourceGroupResponse contains the response from method AddressesClient.NewListByResourceGroupPager. +type AddressesClientListByResourceGroupResponse struct { + AddressResourceList +} + +// AddressesClientListBySubscriptionResponse contains the response from method AddressesClient.NewListBySubscriptionPager. +type AddressesClientListBySubscriptionResponse struct { + AddressResourceList +} + +// AddressesClientUpdateResponse contains the response from method AddressesClient.BeginUpdate. +type AddressesClientUpdateResponse struct { + AddressResource +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + OperationListResult +} + +// OrderItemsClientCancelResponse contains the response from method OrderItemsClient.Cancel. +type OrderItemsClientCancelResponse struct { + // placeholder for future response values +} + +// OrderItemsClientCreateResponse contains the response from method OrderItemsClient.BeginCreate. +type OrderItemsClientCreateResponse struct { + OrderItemResource +} + +// OrderItemsClientDeleteResponse contains the response from method OrderItemsClient.BeginDelete. +type OrderItemsClientDeleteResponse struct { + // placeholder for future response values +} + +// OrderItemsClientGetResponse contains the response from method OrderItemsClient.Get. +type OrderItemsClientGetResponse struct { + OrderItemResource +} + +// OrderItemsClientListByResourceGroupResponse contains the response from method OrderItemsClient.NewListByResourceGroupPager. +type OrderItemsClientListByResourceGroupResponse struct { + OrderItemResourceList +} + +// OrderItemsClientListBySubscriptionResponse contains the response from method OrderItemsClient.NewListBySubscriptionPager. +type OrderItemsClientListBySubscriptionResponse struct { + OrderItemResourceList +} + +// OrderItemsClientReturnResponse contains the response from method OrderItemsClient.BeginReturn. +type OrderItemsClientReturnResponse struct { + // placeholder for future response values +} + +// OrderItemsClientUpdateResponse contains the response from method OrderItemsClient.BeginUpdate. +type OrderItemsClientUpdateResponse struct { + OrderItemResource +} + +// OrdersClientGetResponse contains the response from method OrdersClient.Get. +type OrdersClientGetResponse struct { + OrderResource +} + +// OrdersClientListByResourceGroupResponse contains the response from method OrdersClient.NewListByResourceGroupPager. +type OrdersClientListByResourceGroupResponse struct { + OrderResourceList +} + +// OrdersClientListBySubscriptionResponse contains the response from method OrdersClient.NewListBySubscriptionPager. +type OrdersClientListBySubscriptionResponse struct { + OrderResourceList +} + +// ProductsAndConfigurationsClientListConfigurationsResponse contains the response from method ProductsAndConfigurationsClient.NewListConfigurationsPager. +type ProductsAndConfigurationsClientListConfigurationsResponse struct { + Configurations +} + +// ProductsAndConfigurationsClientListProductFamiliesMetadataResponse contains the response from method ProductsAndConfigurationsClient.NewListProductFamiliesMetadataPager. +type ProductsAndConfigurationsClientListProductFamiliesMetadataResponse struct { + ProductFamiliesMetadata +} + +// ProductsAndConfigurationsClientListProductFamiliesResponse contains the response from method ProductsAndConfigurationsClient.NewListProductFamiliesPager. +type ProductsAndConfigurationsClientListProductFamiliesResponse struct { + ProductFamilies +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_time_rfc3339.go b/sdk/resourcemanager/edgeorder/armedgeorder/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/edgeorder/armedgeorder/time_rfc3339.go index 581885d97b0b..a75499478d05 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/time_rfc3339.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armedgeorder @@ -61,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/ze_generated_example_edgeordermanagementclient_client_test.go b/sdk/resourcemanager/edgeorder/armedgeorder/ze_generated_example_edgeordermanagementclient_client_test.go deleted file mode 100644 index 46126594bf36..000000000000 --- a/sdk/resourcemanager/edgeorder/armedgeorder/ze_generated_example_edgeordermanagementclient_client_test.go +++ /dev/null @@ -1,667 +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 armedgeorder_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListOperations.json -func ExampleManagementClient_NewListOperationsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListOperationsPager(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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListAddressesAtSubscriptionLevel.json -func ExampleManagementClient_NewListAddressesAtSubscriptionLevelPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAddressesAtSubscriptionLevelPager(&armedgeorder.ManagementClientListAddressesAtSubscriptionLevelOptions{Filter: nil, - SkipToken: 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListProductFamilies.json -func ExampleManagementClient_NewListProductFamiliesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListProductFamiliesPager(armedgeorder.ProductFamiliesRequest{ - FilterableProperties: map[string][]*armedgeorder.FilterableProperty{ - "azurestackedge": { - { - Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), - SupportedValues: []*string{ - to.Ptr("US")}, - }}, - }, - }, - &armedgeorder.ManagementClientListProductFamiliesOptions{Expand: to.Ptr("configurations"), - SkipToken: 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListConfigurations.json -func ExampleManagementClient_NewListConfigurationsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListConfigurationsPager(armedgeorder.ConfigurationsRequest{ - ConfigurationFilters: []*armedgeorder.ConfigurationFilters{ - { - FilterableProperty: []*armedgeorder.FilterableProperty{ - { - Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), - SupportedValues: []*string{ - to.Ptr("US")}, - }}, - HierarchyInformation: &armedgeorder.HierarchyInformation{ - ProductFamilyName: to.Ptr("azurestackedge"), - ProductLineName: to.Ptr("azurestackedge"), - ProductName: to.Ptr("azurestackedgegpu"), - }, - }}, - }, - &armedgeorder.ManagementClientListConfigurationsOptions{SkipToken: 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListProductFamiliesMetadata.json -func ExampleManagementClient_NewListProductFamiliesMetadataPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListProductFamiliesMetadataPager(&armedgeorder.ManagementClientListProductFamiliesMetadataOptions{SkipToken: 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListOrderAtSubscriptionLevel.json -func ExampleManagementClient_NewListOrderAtSubscriptionLevelPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListOrderAtSubscriptionLevelPager(&armedgeorder.ManagementClientListOrderAtSubscriptionLevelOptions{SkipToken: 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListOrderItemsAtSubscriptionLevel.json -func ExampleManagementClient_NewListOrderItemsAtSubscriptionLevelPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListOrderItemsAtSubscriptionLevelPager(&armedgeorder.ManagementClientListOrderItemsAtSubscriptionLevelOptions{Filter: nil, - Expand: nil, - SkipToken: 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListAddressesAtResourceGroupLevel.json -func ExampleManagementClient_NewListAddressesAtResourceGroupLevelPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAddressesAtResourceGroupLevelPager("YourResourceGroupName", - &armedgeorder.ManagementClientListAddressesAtResourceGroupLevelOptions{Filter: nil, - SkipToken: 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/GetAddressByName.json -func ExampleManagementClient_GetAddressByName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetAddressByName(ctx, - "TestAddressName1", - "YourResourceGroupName", - 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/CreateAddress.json -func ExampleManagementClient_BeginCreateAddress() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateAddress(ctx, - "TestAddressName2", - "YourResourceGroupName", - armedgeorder.AddressResource{ - Location: to.Ptr("eastus"), - Properties: &armedgeorder.AddressProperties{ - ContactDetails: &armedgeorder.ContactDetails{ - ContactName: to.Ptr("XXXX XXXX"), - EmailList: []*string{ - to.Ptr("xxxx@xxxx.xxx")}, - Phone: to.Ptr("0000000000"), - PhoneExtension: to.Ptr(""), - }, - ShippingAddress: &armedgeorder.ShippingAddress{ - AddressType: to.Ptr(armedgeorder.AddressTypeNone), - City: to.Ptr("San Francisco"), - CompanyName: to.Ptr("Microsoft"), - Country: to.Ptr("US"), - PostalCode: to.Ptr("94107"), - StateOrProvince: to.Ptr("CA"), - StreetAddress1: to.Ptr("16 TOWNSEND ST"), - StreetAddress2: to.Ptr("UNIT 1"), - }, - }, - }, - 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/DeleteAddressByName.json -func ExampleManagementClient_BeginDeleteAddressByName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteAddressByName(ctx, - "TestAddressName1", - "YourResourceGroupName", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/UpdateAddress.json -func ExampleManagementClient_BeginUpdateAddress() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateAddress(ctx, - "TestAddressName2", - "YourResourceGroupName", - armedgeorder.AddressUpdateParameter{ - Properties: &armedgeorder.AddressUpdateProperties{ - ContactDetails: &armedgeorder.ContactDetails{ - ContactName: to.Ptr("YYYY YYYY"), - EmailList: []*string{ - to.Ptr("xxxx@xxxx.xxx")}, - Phone: to.Ptr("0000000000"), - PhoneExtension: to.Ptr(""), - }, - ShippingAddress: &armedgeorder.ShippingAddress{ - AddressType: to.Ptr(armedgeorder.AddressTypeNone), - City: to.Ptr("San Francisco"), - CompanyName: to.Ptr("Microsoft"), - Country: to.Ptr("US"), - PostalCode: to.Ptr("94107"), - StateOrProvince: to.Ptr("CA"), - StreetAddress1: to.Ptr("16 TOWNSEND ST"), - StreetAddress2: to.Ptr("UNIT 1"), - }, - }, - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, - &armedgeorder.ManagementClientBeginUpdateAddressOptions{IfMatch: 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListOrderAtResourceGroupLevel.json -func ExampleManagementClient_NewListOrderAtResourceGroupLevelPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListOrderAtResourceGroupLevelPager("YourResourceGroupName", - &armedgeorder.ManagementClientListOrderAtResourceGroupLevelOptions{SkipToken: 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/GetOrderByName.json -func ExampleManagementClient_GetOrderByName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetOrderByName(ctx, - "TestOrderName3", - "YourResourceGroupName", - "eastus", - 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListOrderItemsAtResourceGroupLevel.json -func ExampleManagementClient_NewListOrderItemsAtResourceGroupLevelPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListOrderItemsAtResourceGroupLevelPager("YourResourceGroupName", - &armedgeorder.ManagementClientListOrderItemsAtResourceGroupLevelOptions{Filter: nil, - Expand: nil, - SkipToken: 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/GetOrderItemByName.json -func ExampleManagementClient_GetOrderItemByName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetOrderItemByName(ctx, - "TestOrderItemName1", - "YourResourceGroupName", - &armedgeorder.ManagementClientGetOrderItemByNameOptions{Expand: 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/CreateOrderItem.json -func ExampleManagementClient_BeginCreateOrderItem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrderItem(ctx, - "TestOrderItemName2", - "YourResourceGroupName", - armedgeorder.OrderItemResource{ - Location: to.Ptr("eastus"), - Properties: &armedgeorder.OrderItemProperties{ - AddressDetails: &armedgeorder.AddressDetails{ - ForwardAddress: &armedgeorder.AddressProperties{ - ContactDetails: &armedgeorder.ContactDetails{ - ContactName: to.Ptr("XXXX XXXX"), - EmailList: []*string{ - to.Ptr("xxxx@xxxx.xxx")}, - Phone: to.Ptr("0000000000"), - PhoneExtension: to.Ptr(""), - }, - ShippingAddress: &armedgeorder.ShippingAddress{ - AddressType: to.Ptr(armedgeorder.AddressTypeNone), - City: to.Ptr("San Francisco"), - CompanyName: to.Ptr("Microsoft"), - Country: to.Ptr("US"), - PostalCode: to.Ptr("94107"), - StateOrProvince: to.Ptr("CA"), - StreetAddress1: to.Ptr("16 TOWNSEND ST"), - StreetAddress2: to.Ptr("UNIT 1"), - }, - }, - }, - OrderID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName2"), - OrderItemDetails: &armedgeorder.OrderItemDetails{ - OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), - Preferences: &armedgeorder.Preferences{ - TransportPreferences: &armedgeorder.TransportPreferences{ - PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged), - }, - }, - ProductDetails: &armedgeorder.ProductDetails{ - HierarchyInformation: &armedgeorder.HierarchyInformation{ - ConfigurationName: to.Ptr("edgep_base"), - ProductFamilyName: to.Ptr("azurestackedge"), - ProductLineName: to.Ptr("azurestackedge"), - ProductName: to.Ptr("azurestackedgegpu"), - }, - }, - }, - }, - }, - 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/DeleteOrderItemByName.json -func ExampleManagementClient_BeginDeleteOrderItemByName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteOrderItemByName(ctx, - "TestOrderItemName3", - "YourResourceGroupName", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/UpdateOrderItem.json -func ExampleManagementClient_BeginUpdateOrderItem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateOrderItem(ctx, - "TestOrderItemName3", - "YourResourceGroupName", - armedgeorder.OrderItemUpdateParameter{ - Properties: &armedgeorder.OrderItemUpdateProperties{ - Preferences: &armedgeorder.Preferences{ - TransportPreferences: &armedgeorder.TransportPreferences{ - PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesCustomerManaged), - }, - }, - }, - }, - &armedgeorder.ManagementClientBeginUpdateOrderItemOptions{IfMatch: 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/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/CancelOrderItem.json -func ExampleManagementClient_CancelOrderItem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.CancelOrderItem(ctx, - "TestOrderItemName3", - "YourResourceGroupName", - armedgeorder.CancellationReason{ - Reason: to.Ptr("Order cancelled"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ReturnOrderItem.json -func ExampleManagementClient_BeginReturnOrderItem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armedgeorder.NewManagementClient("YourSubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReturnOrderItem(ctx, - "TestOrderName4", - "YourResourceGroupName", - armedgeorder.ReturnOrderItemDetails{ - ReturnReason: to.Ptr("Order returned"), - }, - 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/edgeorder/armedgeorder/zz_generated_management_client.go b/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_management_client.go deleted file mode 100644 index 42c34796cc04..000000000000 --- a/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_management_client.go +++ /dev/null @@ -1,1403 +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 armedgeorder - -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" -) - -// ManagementClient contains the methods for the EdgeOrderManagementClient group. -// Don't use this type directly, use NewManagementClient() instead. -type ManagementClient struct { - host string - subscriptionID string - pl runtime.Pipeline -} - -// NewManagementClient creates a new instance of ManagementClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagementClient, 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 := &ManagementClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// CancelOrderItem - Cancel order item. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// orderItemName - The name of the order item -// resourceGroupName - The name of the resource group. The name is case insensitive. -// cancellationReason - Reason for cancellation. -// options - ManagementClientCancelOrderItemOptions contains the optional parameters for the ManagementClient.CancelOrderItem -// method. -func (client *ManagementClient) CancelOrderItem(ctx context.Context, orderItemName string, resourceGroupName string, cancellationReason CancellationReason, options *ManagementClientCancelOrderItemOptions) (ManagementClientCancelOrderItemResponse, error) { - req, err := client.cancelOrderItemCreateRequest(ctx, orderItemName, resourceGroupName, cancellationReason, options) - if err != nil { - return ManagementClientCancelOrderItemResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientCancelOrderItemResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ManagementClientCancelOrderItemResponse{}, runtime.NewResponseError(resp) - } - return ManagementClientCancelOrderItemResponse{}, nil -} - -// cancelOrderItemCreateRequest creates the CancelOrderItem request. -func (client *ManagementClient) cancelOrderItemCreateRequest(ctx context.Context, orderItemName string, resourceGroupName string, cancellationReason CancellationReason, options *ManagementClientCancelOrderItemOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}/cancel" - if orderItemName == "" { - return nil, errors.New("parameter orderItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orderItemName}", url.PathEscape(orderItemName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, cancellationReason) -} - -// BeginCreateAddress - Creates a new address with the specified parameters. Existing address can be updated with this API -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// addressName - The name of the address Resource within the specified resource group. address names must be between 3 and -// 24 characters in length and use any alphanumeric and underscore only -// resourceGroupName - The name of the resource group. The name is case insensitive. -// addressResource - Address details from request body. -// options - ManagementClientBeginCreateAddressOptions contains the optional parameters for the ManagementClient.BeginCreateAddress -// method. -func (client *ManagementClient) BeginCreateAddress(ctx context.Context, addressName string, resourceGroupName string, addressResource AddressResource, options *ManagementClientBeginCreateAddressOptions) (*runtime.Poller[ManagementClientCreateAddressResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createAddress(ctx, addressName, resourceGroupName, addressResource, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ManagementClientCreateAddressResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ManagementClientCreateAddressResponse](options.ResumeToken, client.pl, nil) - } -} - -// CreateAddress - Creates a new address with the specified parameters. Existing address can be updated with this API -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -func (client *ManagementClient) createAddress(ctx context.Context, addressName string, resourceGroupName string, addressResource AddressResource, options *ManagementClientBeginCreateAddressOptions) (*http.Response, error) { - req, err := client.createAddressCreateRequest(ctx, addressName, resourceGroupName, addressResource, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createAddressCreateRequest creates the CreateAddress request. -func (client *ManagementClient) createAddressCreateRequest(ctx context.Context, addressName string, resourceGroupName string, addressResource AddressResource, options *ManagementClientBeginCreateAddressOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" - if addressName == "" { - return nil, errors.New("parameter addressName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{addressName}", url.PathEscape(addressName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, addressResource) -} - -// BeginCreateOrderItem - Creates an order item. Existing order item cannot be updated with this api and should instead be -// updated with the Update order item API. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// orderItemName - The name of the order item -// resourceGroupName - The name of the resource group. The name is case insensitive. -// orderItemResource - Order item details from request body. -// options - ManagementClientBeginCreateOrderItemOptions contains the optional parameters for the ManagementClient.BeginCreateOrderItem -// method. -func (client *ManagementClient) BeginCreateOrderItem(ctx context.Context, orderItemName string, resourceGroupName string, orderItemResource OrderItemResource, options *ManagementClientBeginCreateOrderItemOptions) (*runtime.Poller[ManagementClientCreateOrderItemResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrderItem(ctx, orderItemName, resourceGroupName, orderItemResource, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ManagementClientCreateOrderItemResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ManagementClientCreateOrderItemResponse](options.ResumeToken, client.pl, nil) - } -} - -// CreateOrderItem - Creates an order item. Existing order item cannot be updated with this api and should instead be updated -// with the Update order item API. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -func (client *ManagementClient) createOrderItem(ctx context.Context, orderItemName string, resourceGroupName string, orderItemResource OrderItemResource, options *ManagementClientBeginCreateOrderItemOptions) (*http.Response, error) { - req, err := client.createOrderItemCreateRequest(ctx, orderItemName, resourceGroupName, orderItemResource, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrderItemCreateRequest creates the CreateOrderItem request. -func (client *ManagementClient) createOrderItemCreateRequest(ctx context.Context, orderItemName string, resourceGroupName string, orderItemResource OrderItemResource, options *ManagementClientBeginCreateOrderItemOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" - if orderItemName == "" { - return nil, errors.New("parameter orderItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orderItemName}", url.PathEscape(orderItemName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, orderItemResource) -} - -// BeginDeleteAddressByName - Deletes an address. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// addressName - The name of the address Resource within the specified resource group. address names must be between 3 and -// 24 characters in length and use any alphanumeric and underscore only -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - ManagementClientBeginDeleteAddressByNameOptions contains the optional parameters for the ManagementClient.BeginDeleteAddressByName -// method. -func (client *ManagementClient) BeginDeleteAddressByName(ctx context.Context, addressName string, resourceGroupName string, options *ManagementClientBeginDeleteAddressByNameOptions) (*runtime.Poller[ManagementClientDeleteAddressByNameResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteAddressByName(ctx, addressName, resourceGroupName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ManagementClientDeleteAddressByNameResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ManagementClientDeleteAddressByNameResponse](options.ResumeToken, client.pl, nil) - } -} - -// DeleteAddressByName - Deletes an address. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -func (client *ManagementClient) deleteAddressByName(ctx context.Context, addressName string, resourceGroupName string, options *ManagementClientBeginDeleteAddressByNameOptions) (*http.Response, error) { - req, err := client.deleteAddressByNameCreateRequest(ctx, addressName, resourceGroupName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteAddressByNameCreateRequest creates the DeleteAddressByName request. -func (client *ManagementClient) deleteAddressByNameCreateRequest(ctx context.Context, addressName string, resourceGroupName string, options *ManagementClientBeginDeleteAddressByNameOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" - if addressName == "" { - return nil, errors.New("parameter addressName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{addressName}", url.PathEscape(addressName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// BeginDeleteOrderItemByName - Deletes an order item. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// orderItemName - The name of the order item -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - ManagementClientBeginDeleteOrderItemByNameOptions contains the optional parameters for the ManagementClient.BeginDeleteOrderItemByName -// method. -func (client *ManagementClient) BeginDeleteOrderItemByName(ctx context.Context, orderItemName string, resourceGroupName string, options *ManagementClientBeginDeleteOrderItemByNameOptions) (*runtime.Poller[ManagementClientDeleteOrderItemByNameResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOrderItemByName(ctx, orderItemName, resourceGroupName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ManagementClientDeleteOrderItemByNameResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ManagementClientDeleteOrderItemByNameResponse](options.ResumeToken, client.pl, nil) - } -} - -// DeleteOrderItemByName - Deletes an order item. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -func (client *ManagementClient) deleteOrderItemByName(ctx context.Context, orderItemName string, resourceGroupName string, options *ManagementClientBeginDeleteOrderItemByNameOptions) (*http.Response, error) { - req, err := client.deleteOrderItemByNameCreateRequest(ctx, orderItemName, resourceGroupName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteOrderItemByNameCreateRequest creates the DeleteOrderItemByName request. -func (client *ManagementClient) deleteOrderItemByNameCreateRequest(ctx context.Context, orderItemName string, resourceGroupName string, options *ManagementClientBeginDeleteOrderItemByNameOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" - if orderItemName == "" { - return nil, errors.New("parameter orderItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orderItemName}", url.PathEscape(orderItemName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// GetAddressByName - Gets information about the specified address. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// addressName - The name of the address Resource within the specified resource group. address names must be between 3 and -// 24 characters in length and use any alphanumeric and underscore only -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - ManagementClientGetAddressByNameOptions contains the optional parameters for the ManagementClient.GetAddressByName -// method. -func (client *ManagementClient) GetAddressByName(ctx context.Context, addressName string, resourceGroupName string, options *ManagementClientGetAddressByNameOptions) (ManagementClientGetAddressByNameResponse, error) { - req, err := client.getAddressByNameCreateRequest(ctx, addressName, resourceGroupName, options) - if err != nil { - return ManagementClientGetAddressByNameResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientGetAddressByNameResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientGetAddressByNameResponse{}, runtime.NewResponseError(resp) - } - return client.getAddressByNameHandleResponse(resp) -} - -// getAddressByNameCreateRequest creates the GetAddressByName request. -func (client *ManagementClient) getAddressByNameCreateRequest(ctx context.Context, addressName string, resourceGroupName string, options *ManagementClientGetAddressByNameOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" - if addressName == "" { - return nil, errors.New("parameter addressName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{addressName}", url.PathEscape(addressName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getAddressByNameHandleResponse handles the GetAddressByName response. -func (client *ManagementClient) getAddressByNameHandleResponse(resp *http.Response) (ManagementClientGetAddressByNameResponse, error) { - result := ManagementClientGetAddressByNameResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AddressResource); err != nil { - return ManagementClientGetAddressByNameResponse{}, err - } - return result, nil -} - -// GetOrderByName - Gets an order. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// orderName - The name of the order -// resourceGroupName - The name of the resource group. The name is case insensitive. -// location - The name of Azure region. -// options - ManagementClientGetOrderByNameOptions contains the optional parameters for the ManagementClient.GetOrderByName -// method. -func (client *ManagementClient) GetOrderByName(ctx context.Context, orderName string, resourceGroupName string, location string, options *ManagementClientGetOrderByNameOptions) (ManagementClientGetOrderByNameResponse, error) { - req, err := client.getOrderByNameCreateRequest(ctx, orderName, resourceGroupName, location, options) - if err != nil { - return ManagementClientGetOrderByNameResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientGetOrderByNameResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientGetOrderByNameResponse{}, runtime.NewResponseError(resp) - } - return client.getOrderByNameHandleResponse(resp) -} - -// getOrderByNameCreateRequest creates the GetOrderByName request. -func (client *ManagementClient) getOrderByNameCreateRequest(ctx context.Context, orderName string, resourceGroupName string, location string, options *ManagementClientGetOrderByNameOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName}" - if orderName == "" { - return nil, errors.New("parameter orderName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orderName}", url.PathEscape(orderName)) - 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 location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getOrderByNameHandleResponse handles the GetOrderByName response. -func (client *ManagementClient) getOrderByNameHandleResponse(resp *http.Response) (ManagementClientGetOrderByNameResponse, error) { - result := ManagementClientGetOrderByNameResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OrderResource); err != nil { - return ManagementClientGetOrderByNameResponse{}, err - } - return result, nil -} - -// GetOrderItemByName - Gets an order item. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// orderItemName - The name of the order item -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - ManagementClientGetOrderItemByNameOptions contains the optional parameters for the ManagementClient.GetOrderItemByName -// method. -func (client *ManagementClient) GetOrderItemByName(ctx context.Context, orderItemName string, resourceGroupName string, options *ManagementClientGetOrderItemByNameOptions) (ManagementClientGetOrderItemByNameResponse, error) { - req, err := client.getOrderItemByNameCreateRequest(ctx, orderItemName, resourceGroupName, options) - if err != nil { - return ManagementClientGetOrderItemByNameResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientGetOrderItemByNameResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientGetOrderItemByNameResponse{}, runtime.NewResponseError(resp) - } - return client.getOrderItemByNameHandleResponse(resp) -} - -// getOrderItemByNameCreateRequest creates the GetOrderItemByName request. -func (client *ManagementClient) getOrderItemByNameCreateRequest(ctx context.Context, orderItemName string, resourceGroupName string, options *ManagementClientGetOrderItemByNameOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" - if orderItemName == "" { - return nil, errors.New("parameter orderItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orderItemName}", url.PathEscape(orderItemName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - if options != nil && options.Expand != nil { - reqQP.Set("$expand", *options.Expand) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getOrderItemByNameHandleResponse handles the GetOrderItemByName response. -func (client *ManagementClient) getOrderItemByNameHandleResponse(resp *http.Response) (ManagementClientGetOrderItemByNameResponse, error) { - result := ManagementClientGetOrderItemByNameResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OrderItemResource); err != nil { - return ManagementClientGetOrderItemByNameResponse{}, err - } - return result, nil -} - -// NewListAddressesAtResourceGroupLevelPager - Lists all the addresses available under the given resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - ManagementClientListAddressesAtResourceGroupLevelOptions contains the optional parameters for the ManagementClient.ListAddressesAtResourceGroupLevel -// method. -func (client *ManagementClient) NewListAddressesAtResourceGroupLevelPager(resourceGroupName string, options *ManagementClientListAddressesAtResourceGroupLevelOptions) *runtime.Pager[ManagementClientListAddressesAtResourceGroupLevelResponse] { - return runtime.NewPager(runtime.PagingHandler[ManagementClientListAddressesAtResourceGroupLevelResponse]{ - More: func(page ManagementClientListAddressesAtResourceGroupLevelResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ManagementClientListAddressesAtResourceGroupLevelResponse) (ManagementClientListAddressesAtResourceGroupLevelResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listAddressesAtResourceGroupLevelCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ManagementClientListAddressesAtResourceGroupLevelResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientListAddressesAtResourceGroupLevelResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientListAddressesAtResourceGroupLevelResponse{}, runtime.NewResponseError(resp) - } - return client.listAddressesAtResourceGroupLevelHandleResponse(resp) - }, - }) -} - -// listAddressesAtResourceGroupLevelCreateRequest creates the ListAddressesAtResourceGroupLevel request. -func (client *ManagementClient) listAddressesAtResourceGroupLevelCreateRequest(ctx context.Context, resourceGroupName string, options *ManagementClientListAddressesAtResourceGroupLevelOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listAddressesAtResourceGroupLevelHandleResponse handles the ListAddressesAtResourceGroupLevel response. -func (client *ManagementClient) listAddressesAtResourceGroupLevelHandleResponse(resp *http.Response) (ManagementClientListAddressesAtResourceGroupLevelResponse, error) { - result := ManagementClientListAddressesAtResourceGroupLevelResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AddressResourceList); err != nil { - return ManagementClientListAddressesAtResourceGroupLevelResponse{}, err - } - return result, nil -} - -// NewListAddressesAtSubscriptionLevelPager - Lists all the addresses available under the subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// options - ManagementClientListAddressesAtSubscriptionLevelOptions contains the optional parameters for the ManagementClient.ListAddressesAtSubscriptionLevel -// method. -func (client *ManagementClient) NewListAddressesAtSubscriptionLevelPager(options *ManagementClientListAddressesAtSubscriptionLevelOptions) *runtime.Pager[ManagementClientListAddressesAtSubscriptionLevelResponse] { - return runtime.NewPager(runtime.PagingHandler[ManagementClientListAddressesAtSubscriptionLevelResponse]{ - More: func(page ManagementClientListAddressesAtSubscriptionLevelResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ManagementClientListAddressesAtSubscriptionLevelResponse) (ManagementClientListAddressesAtSubscriptionLevelResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listAddressesAtSubscriptionLevelCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ManagementClientListAddressesAtSubscriptionLevelResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientListAddressesAtSubscriptionLevelResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientListAddressesAtSubscriptionLevelResponse{}, runtime.NewResponseError(resp) - } - return client.listAddressesAtSubscriptionLevelHandleResponse(resp) - }, - }) -} - -// listAddressesAtSubscriptionLevelCreateRequest creates the ListAddressesAtSubscriptionLevel request. -func (client *ManagementClient) listAddressesAtSubscriptionLevelCreateRequest(ctx context.Context, options *ManagementClientListAddressesAtSubscriptionLevelOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/addresses" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listAddressesAtSubscriptionLevelHandleResponse handles the ListAddressesAtSubscriptionLevel response. -func (client *ManagementClient) listAddressesAtSubscriptionLevelHandleResponse(resp *http.Response) (ManagementClientListAddressesAtSubscriptionLevelResponse, error) { - result := ManagementClientListAddressesAtSubscriptionLevelResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AddressResourceList); err != nil { - return ManagementClientListAddressesAtSubscriptionLevelResponse{}, err - } - return result, nil -} - -// NewListConfigurationsPager - This method provides the list of configurations for the given product family, product line -// and product under subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// configurationsRequest - Filters for showing the configurations. -// options - ManagementClientListConfigurationsOptions contains the optional parameters for the ManagementClient.ListConfigurations -// method. -func (client *ManagementClient) NewListConfigurationsPager(configurationsRequest ConfigurationsRequest, options *ManagementClientListConfigurationsOptions) *runtime.Pager[ManagementClientListConfigurationsResponse] { - return runtime.NewPager(runtime.PagingHandler[ManagementClientListConfigurationsResponse]{ - More: func(page ManagementClientListConfigurationsResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ManagementClientListConfigurationsResponse) (ManagementClientListConfigurationsResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listConfigurationsCreateRequest(ctx, configurationsRequest, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ManagementClientListConfigurationsResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientListConfigurationsResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientListConfigurationsResponse{}, runtime.NewResponseError(resp) - } - return client.listConfigurationsHandleResponse(resp) - }, - }) -} - -// listConfigurationsCreateRequest creates the ListConfigurations request. -func (client *ManagementClient) listConfigurationsCreateRequest(ctx context.Context, configurationsRequest ConfigurationsRequest, options *ManagementClientListConfigurationsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listConfigurations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, configurationsRequest) -} - -// listConfigurationsHandleResponse handles the ListConfigurations response. -func (client *ManagementClient) listConfigurationsHandleResponse(resp *http.Response) (ManagementClientListConfigurationsResponse, error) { - result := ManagementClientListConfigurationsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Configurations); err != nil { - return ManagementClientListConfigurationsResponse{}, err - } - return result, nil -} - -// NewListOperationsPager - This method gets all the operations that are exposed for customer. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// options - ManagementClientListOperationsOptions contains the optional parameters for the ManagementClient.ListOperations -// method. -func (client *ManagementClient) NewListOperationsPager(options *ManagementClientListOperationsOptions) *runtime.Pager[ManagementClientListOperationsResponse] { - return runtime.NewPager(runtime.PagingHandler[ManagementClientListOperationsResponse]{ - More: func(page ManagementClientListOperationsResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ManagementClientListOperationsResponse) (ManagementClientListOperationsResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listOperationsCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ManagementClientListOperationsResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientListOperationsResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientListOperationsResponse{}, runtime.NewResponseError(resp) - } - return client.listOperationsHandleResponse(resp) - }, - }) -} - -// listOperationsCreateRequest creates the ListOperations request. -func (client *ManagementClient) listOperationsCreateRequest(ctx context.Context, options *ManagementClientListOperationsOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.EdgeOrder/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listOperationsHandleResponse handles the ListOperations response. -func (client *ManagementClient) listOperationsHandleResponse(resp *http.Response) (ManagementClientListOperationsResponse, error) { - result := ManagementClientListOperationsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return ManagementClientListOperationsResponse{}, err - } - return result, nil -} - -// NewListOrderAtResourceGroupLevelPager - Lists order at resource group level. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - ManagementClientListOrderAtResourceGroupLevelOptions contains the optional parameters for the ManagementClient.ListOrderAtResourceGroupLevel -// method. -func (client *ManagementClient) NewListOrderAtResourceGroupLevelPager(resourceGroupName string, options *ManagementClientListOrderAtResourceGroupLevelOptions) *runtime.Pager[ManagementClientListOrderAtResourceGroupLevelResponse] { - return runtime.NewPager(runtime.PagingHandler[ManagementClientListOrderAtResourceGroupLevelResponse]{ - More: func(page ManagementClientListOrderAtResourceGroupLevelResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ManagementClientListOrderAtResourceGroupLevelResponse) (ManagementClientListOrderAtResourceGroupLevelResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listOrderAtResourceGroupLevelCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ManagementClientListOrderAtResourceGroupLevelResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientListOrderAtResourceGroupLevelResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientListOrderAtResourceGroupLevelResponse{}, runtime.NewResponseError(resp) - } - return client.listOrderAtResourceGroupLevelHandleResponse(resp) - }, - }) -} - -// listOrderAtResourceGroupLevelCreateRequest creates the ListOrderAtResourceGroupLevel request. -func (client *ManagementClient) listOrderAtResourceGroupLevelCreateRequest(ctx context.Context, resourceGroupName string, options *ManagementClientListOrderAtResourceGroupLevelOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orders" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listOrderAtResourceGroupLevelHandleResponse handles the ListOrderAtResourceGroupLevel response. -func (client *ManagementClient) listOrderAtResourceGroupLevelHandleResponse(resp *http.Response) (ManagementClientListOrderAtResourceGroupLevelResponse, error) { - result := ManagementClientListOrderAtResourceGroupLevelResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OrderResourceList); err != nil { - return ManagementClientListOrderAtResourceGroupLevelResponse{}, err - } - return result, nil -} - -// NewListOrderAtSubscriptionLevelPager - Lists order at subscription level. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// options - ManagementClientListOrderAtSubscriptionLevelOptions contains the optional parameters for the ManagementClient.ListOrderAtSubscriptionLevel -// method. -func (client *ManagementClient) NewListOrderAtSubscriptionLevelPager(options *ManagementClientListOrderAtSubscriptionLevelOptions) *runtime.Pager[ManagementClientListOrderAtSubscriptionLevelResponse] { - return runtime.NewPager(runtime.PagingHandler[ManagementClientListOrderAtSubscriptionLevelResponse]{ - More: func(page ManagementClientListOrderAtSubscriptionLevelResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ManagementClientListOrderAtSubscriptionLevelResponse) (ManagementClientListOrderAtSubscriptionLevelResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listOrderAtSubscriptionLevelCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ManagementClientListOrderAtSubscriptionLevelResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientListOrderAtSubscriptionLevelResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientListOrderAtSubscriptionLevelResponse{}, runtime.NewResponseError(resp) - } - return client.listOrderAtSubscriptionLevelHandleResponse(resp) - }, - }) -} - -// listOrderAtSubscriptionLevelCreateRequest creates the ListOrderAtSubscriptionLevel request. -func (client *ManagementClient) listOrderAtSubscriptionLevelCreateRequest(ctx context.Context, options *ManagementClientListOrderAtSubscriptionLevelOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listOrderAtSubscriptionLevelHandleResponse handles the ListOrderAtSubscriptionLevel response. -func (client *ManagementClient) listOrderAtSubscriptionLevelHandleResponse(resp *http.Response) (ManagementClientListOrderAtSubscriptionLevelResponse, error) { - result := ManagementClientListOrderAtSubscriptionLevelResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OrderResourceList); err != nil { - return ManagementClientListOrderAtSubscriptionLevelResponse{}, err - } - return result, nil -} - -// NewListOrderItemsAtResourceGroupLevelPager - Lists order item at resource group level. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - ManagementClientListOrderItemsAtResourceGroupLevelOptions contains the optional parameters for the ManagementClient.ListOrderItemsAtResourceGroupLevel -// method. -func (client *ManagementClient) NewListOrderItemsAtResourceGroupLevelPager(resourceGroupName string, options *ManagementClientListOrderItemsAtResourceGroupLevelOptions) *runtime.Pager[ManagementClientListOrderItemsAtResourceGroupLevelResponse] { - return runtime.NewPager(runtime.PagingHandler[ManagementClientListOrderItemsAtResourceGroupLevelResponse]{ - More: func(page ManagementClientListOrderItemsAtResourceGroupLevelResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ManagementClientListOrderItemsAtResourceGroupLevelResponse) (ManagementClientListOrderItemsAtResourceGroupLevelResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listOrderItemsAtResourceGroupLevelCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ManagementClientListOrderItemsAtResourceGroupLevelResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientListOrderItemsAtResourceGroupLevelResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientListOrderItemsAtResourceGroupLevelResponse{}, runtime.NewResponseError(resp) - } - return client.listOrderItemsAtResourceGroupLevelHandleResponse(resp) - }, - }) -} - -// listOrderItemsAtResourceGroupLevelCreateRequest creates the ListOrderItemsAtResourceGroupLevel request. -func (client *ManagementClient) listOrderItemsAtResourceGroupLevelCreateRequest(ctx context.Context, resourceGroupName string, options *ManagementClientListOrderItemsAtResourceGroupLevelOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Expand != nil { - reqQP.Set("$expand", *options.Expand) - } - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listOrderItemsAtResourceGroupLevelHandleResponse handles the ListOrderItemsAtResourceGroupLevel response. -func (client *ManagementClient) listOrderItemsAtResourceGroupLevelHandleResponse(resp *http.Response) (ManagementClientListOrderItemsAtResourceGroupLevelResponse, error) { - result := ManagementClientListOrderItemsAtResourceGroupLevelResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OrderItemResourceList); err != nil { - return ManagementClientListOrderItemsAtResourceGroupLevelResponse{}, err - } - return result, nil -} - -// NewListOrderItemsAtSubscriptionLevelPager - Lists order item at subscription level. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// options - ManagementClientListOrderItemsAtSubscriptionLevelOptions contains the optional parameters for the ManagementClient.ListOrderItemsAtSubscriptionLevel -// method. -func (client *ManagementClient) NewListOrderItemsAtSubscriptionLevelPager(options *ManagementClientListOrderItemsAtSubscriptionLevelOptions) *runtime.Pager[ManagementClientListOrderItemsAtSubscriptionLevelResponse] { - return runtime.NewPager(runtime.PagingHandler[ManagementClientListOrderItemsAtSubscriptionLevelResponse]{ - More: func(page ManagementClientListOrderItemsAtSubscriptionLevelResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ManagementClientListOrderItemsAtSubscriptionLevelResponse) (ManagementClientListOrderItemsAtSubscriptionLevelResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listOrderItemsAtSubscriptionLevelCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ManagementClientListOrderItemsAtSubscriptionLevelResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientListOrderItemsAtSubscriptionLevelResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientListOrderItemsAtSubscriptionLevelResponse{}, runtime.NewResponseError(resp) - } - return client.listOrderItemsAtSubscriptionLevelHandleResponse(resp) - }, - }) -} - -// listOrderItemsAtSubscriptionLevelCreateRequest creates the ListOrderItemsAtSubscriptionLevel request. -func (client *ManagementClient) listOrderItemsAtSubscriptionLevelCreateRequest(ctx context.Context, options *ManagementClientListOrderItemsAtSubscriptionLevelOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Expand != nil { - reqQP.Set("$expand", *options.Expand) - } - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listOrderItemsAtSubscriptionLevelHandleResponse handles the ListOrderItemsAtSubscriptionLevel response. -func (client *ManagementClient) listOrderItemsAtSubscriptionLevelHandleResponse(resp *http.Response) (ManagementClientListOrderItemsAtSubscriptionLevelResponse, error) { - result := ManagementClientListOrderItemsAtSubscriptionLevelResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OrderItemResourceList); err != nil { - return ManagementClientListOrderItemsAtSubscriptionLevelResponse{}, err - } - return result, nil -} - -// NewListProductFamiliesPager - This method provides the list of product families for the given subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// productFamiliesRequest - Filters for showing the product families. -// options - ManagementClientListProductFamiliesOptions contains the optional parameters for the ManagementClient.ListProductFamilies -// method. -func (client *ManagementClient) NewListProductFamiliesPager(productFamiliesRequest ProductFamiliesRequest, options *ManagementClientListProductFamiliesOptions) *runtime.Pager[ManagementClientListProductFamiliesResponse] { - return runtime.NewPager(runtime.PagingHandler[ManagementClientListProductFamiliesResponse]{ - More: func(page ManagementClientListProductFamiliesResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ManagementClientListProductFamiliesResponse) (ManagementClientListProductFamiliesResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listProductFamiliesCreateRequest(ctx, productFamiliesRequest, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ManagementClientListProductFamiliesResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientListProductFamiliesResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientListProductFamiliesResponse{}, runtime.NewResponseError(resp) - } - return client.listProductFamiliesHandleResponse(resp) - }, - }) -} - -// listProductFamiliesCreateRequest creates the ListProductFamilies request. -func (client *ManagementClient) listProductFamiliesCreateRequest(ctx context.Context, productFamiliesRequest ProductFamiliesRequest, options *ManagementClientListProductFamiliesOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - if options != nil && options.Expand != nil { - reqQP.Set("$expand", *options.Expand) - } - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, productFamiliesRequest) -} - -// listProductFamiliesHandleResponse handles the ListProductFamilies response. -func (client *ManagementClient) listProductFamiliesHandleResponse(resp *http.Response) (ManagementClientListProductFamiliesResponse, error) { - result := ManagementClientListProductFamiliesResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProductFamilies); err != nil { - return ManagementClientListProductFamiliesResponse{}, err - } - return result, nil -} - -// NewListProductFamiliesMetadataPager - This method provides the list of product families metadata for the given subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// options - ManagementClientListProductFamiliesMetadataOptions contains the optional parameters for the ManagementClient.ListProductFamiliesMetadata -// method. -func (client *ManagementClient) NewListProductFamiliesMetadataPager(options *ManagementClientListProductFamiliesMetadataOptions) *runtime.Pager[ManagementClientListProductFamiliesMetadataResponse] { - return runtime.NewPager(runtime.PagingHandler[ManagementClientListProductFamiliesMetadataResponse]{ - More: func(page ManagementClientListProductFamiliesMetadataResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ManagementClientListProductFamiliesMetadataResponse) (ManagementClientListProductFamiliesMetadataResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listProductFamiliesMetadataCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ManagementClientListProductFamiliesMetadataResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ManagementClientListProductFamiliesMetadataResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientListProductFamiliesMetadataResponse{}, runtime.NewResponseError(resp) - } - return client.listProductFamiliesMetadataHandleResponse(resp) - }, - }) -} - -// listProductFamiliesMetadataCreateRequest creates the ListProductFamiliesMetadata request. -func (client *ManagementClient) listProductFamiliesMetadataCreateRequest(ctx context.Context, options *ManagementClientListProductFamiliesMetadataOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listProductFamiliesMetadataHandleResponse handles the ListProductFamiliesMetadata response. -func (client *ManagementClient) listProductFamiliesMetadataHandleResponse(resp *http.Response) (ManagementClientListProductFamiliesMetadataResponse, error) { - result := ManagementClientListProductFamiliesMetadataResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProductFamiliesMetadata); err != nil { - return ManagementClientListProductFamiliesMetadataResponse{}, err - } - return result, nil -} - -// BeginReturnOrderItem - Return order item. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// orderItemName - The name of the order item -// resourceGroupName - The name of the resource group. The name is case insensitive. -// returnOrderItemDetails - Return order item CurrentStatus. -// options - ManagementClientBeginReturnOrderItemOptions contains the optional parameters for the ManagementClient.BeginReturnOrderItem -// method. -func (client *ManagementClient) BeginReturnOrderItem(ctx context.Context, orderItemName string, resourceGroupName string, returnOrderItemDetails ReturnOrderItemDetails, options *ManagementClientBeginReturnOrderItemOptions) (*runtime.Poller[ManagementClientReturnOrderItemResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.returnOrderItem(ctx, orderItemName, resourceGroupName, returnOrderItemDetails, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ManagementClientReturnOrderItemResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ManagementClientReturnOrderItemResponse](options.ResumeToken, client.pl, nil) - } -} - -// ReturnOrderItem - Return order item. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -func (client *ManagementClient) returnOrderItem(ctx context.Context, orderItemName string, resourceGroupName string, returnOrderItemDetails ReturnOrderItemDetails, options *ManagementClientBeginReturnOrderItemOptions) (*http.Response, error) { - req, err := client.returnOrderItemCreateRequest(ctx, orderItemName, resourceGroupName, returnOrderItemDetails, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// returnOrderItemCreateRequest creates the ReturnOrderItem request. -func (client *ManagementClient) returnOrderItemCreateRequest(ctx context.Context, orderItemName string, resourceGroupName string, returnOrderItemDetails ReturnOrderItemDetails, options *ManagementClientBeginReturnOrderItemOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}/return" - if orderItemName == "" { - return nil, errors.New("parameter orderItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orderItemName}", url.PathEscape(orderItemName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, returnOrderItemDetails) -} - -// BeginUpdateAddress - Updates the properties of an existing address. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// addressName - The name of the address Resource within the specified resource group. address names must be between 3 and -// 24 characters in length and use any alphanumeric and underscore only -// resourceGroupName - The name of the resource group. The name is case insensitive. -// addressUpdateParameter - Address update parameters from request body. -// options - ManagementClientBeginUpdateAddressOptions contains the optional parameters for the ManagementClient.BeginUpdateAddress -// method. -func (client *ManagementClient) BeginUpdateAddress(ctx context.Context, addressName string, resourceGroupName string, addressUpdateParameter AddressUpdateParameter, options *ManagementClientBeginUpdateAddressOptions) (*runtime.Poller[ManagementClientUpdateAddressResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.updateAddress(ctx, addressName, resourceGroupName, addressUpdateParameter, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ManagementClientUpdateAddressResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ManagementClientUpdateAddressResponse](options.ResumeToken, client.pl, nil) - } -} - -// UpdateAddress - Updates the properties of an existing address. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -func (client *ManagementClient) updateAddress(ctx context.Context, addressName string, resourceGroupName string, addressUpdateParameter AddressUpdateParameter, options *ManagementClientBeginUpdateAddressOptions) (*http.Response, error) { - req, err := client.updateAddressCreateRequest(ctx, addressName, resourceGroupName, addressUpdateParameter, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// updateAddressCreateRequest creates the UpdateAddress request. -func (client *ManagementClient) updateAddressCreateRequest(ctx context.Context, addressName string, resourceGroupName string, addressUpdateParameter AddressUpdateParameter, options *ManagementClientBeginUpdateAddressOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" - if addressName == "" { - return nil, errors.New("parameter addressName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{addressName}", url.PathEscape(addressName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - req.Raw().URL.RawQuery = reqQP.Encode() - if options != nil && options.IfMatch != nil { - req.Raw().Header["If-Match"] = []string{*options.IfMatch} - } - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, addressUpdateParameter) -} - -// BeginUpdateOrderItem - Updates the properties of an existing order item. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -// orderItemName - The name of the order item -// resourceGroupName - The name of the resource group. The name is case insensitive. -// orderItemUpdateParameter - order item update parameters from request body. -// options - ManagementClientBeginUpdateOrderItemOptions contains the optional parameters for the ManagementClient.BeginUpdateOrderItem -// method. -func (client *ManagementClient) BeginUpdateOrderItem(ctx context.Context, orderItemName string, resourceGroupName string, orderItemUpdateParameter OrderItemUpdateParameter, options *ManagementClientBeginUpdateOrderItemOptions) (*runtime.Poller[ManagementClientUpdateOrderItemResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.updateOrderItem(ctx, orderItemName, resourceGroupName, orderItemUpdateParameter, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ManagementClientUpdateOrderItemResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ManagementClientUpdateOrderItemResponse](options.ResumeToken, client.pl, nil) - } -} - -// UpdateOrderItem - Updates the properties of an existing order item. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-12-01 -func (client *ManagementClient) updateOrderItem(ctx context.Context, orderItemName string, resourceGroupName string, orderItemUpdateParameter OrderItemUpdateParameter, options *ManagementClientBeginUpdateOrderItemOptions) (*http.Response, error) { - req, err := client.updateOrderItemCreateRequest(ctx, orderItemName, resourceGroupName, orderItemUpdateParameter, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// updateOrderItemCreateRequest creates the UpdateOrderItem request. -func (client *ManagementClient) updateOrderItemCreateRequest(ctx context.Context, orderItemName string, resourceGroupName string, orderItemUpdateParameter OrderItemUpdateParameter, options *ManagementClientBeginUpdateOrderItemOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" - if orderItemName == "" { - return nil, errors.New("parameter orderItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orderItemName}", url.PathEscape(orderItemName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01") - req.Raw().URL.RawQuery = reqQP.Encode() - if options != nil && options.IfMatch != nil { - req.Raw().Header["If-Match"] = []string{*options.IfMatch} - } - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, orderItemUpdateParameter) -} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_models_serde.go b/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_models_serde.go deleted file mode 100644 index 7d60f83fb113..000000000000 --- a/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_models_serde.go +++ /dev/null @@ -1,431 +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 armedgeorder - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AddressResource. -func (a AddressResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AddressUpdateParameter. -func (a AddressUpdateParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BillingMeterDetails. -func (b *BillingMeterDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "frequency": - err = unpopulate(val, "Frequency", &b.Frequency) - delete(rawMsg, key) - case "meterDetails": - b.MeterDetails, err = unmarshalMeterDetailsClassification(val) - delete(rawMsg, key) - case "meteringType": - err = unpopulate(val, "MeteringType", &b.MeteringType) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConfigurationFilters. -func (c ConfigurationFilters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filterableProperty", c.FilterableProperty) - populate(objectMap, "hierarchyInformation", c.HierarchyInformation) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ConfigurationsRequest. -func (c ConfigurationsRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "configurationFilters", c.ConfigurationFilters) - populate(objectMap, "customerSubscriptionDetails", c.CustomerSubscriptionDetails) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContactDetails. -func (c ContactDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "contactName", c.ContactName) - populate(objectMap, "emailList", c.EmailList) - populate(objectMap, "mobile", c.Mobile) - populate(objectMap, "phone", c.Phone) - populate(objectMap, "phoneExtension", c.PhoneExtension) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CustomerSubscriptionDetails. -func (c CustomerSubscriptionDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "locationPlacementId", c.LocationPlacementID) - populate(objectMap, "quotaId", c.QuotaID) - populate(objectMap, "registeredFeatures", c.RegisteredFeatures) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type FilterableProperty. -func (f FilterableProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "supportedValues", f.SupportedValues) - populate(objectMap, "type", f.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type OrderItemDetails. -func (o OrderItemDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "cancellationReason", o.CancellationReason) - populate(objectMap, "cancellationStatus", o.CancellationStatus) - populate(objectMap, "currentStage", o.CurrentStage) - populate(objectMap, "deletionStatus", o.DeletionStatus) - populate(objectMap, "error", o.Error) - populate(objectMap, "forwardShippingDetails", o.ForwardShippingDetails) - populate(objectMap, "managementRpDetails", o.ManagementRpDetails) - populate(objectMap, "managementRpDetailsList", o.ManagementRpDetailsList) - populate(objectMap, "notificationEmailList", o.NotificationEmailList) - populate(objectMap, "orderItemStageHistory", o.OrderItemStageHistory) - populate(objectMap, "orderItemType", o.OrderItemType) - populate(objectMap, "preferences", o.Preferences) - populate(objectMap, "productDetails", o.ProductDetails) - populate(objectMap, "returnReason", o.ReturnReason) - populate(objectMap, "returnStatus", o.ReturnStatus) - populate(objectMap, "reverseShippingDetails", o.ReverseShippingDetails) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type OrderItemProperties. -func (o OrderItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "addressDetails", o.AddressDetails) - populate(objectMap, "orderId", o.OrderID) - populate(objectMap, "orderItemDetails", o.OrderItemDetails) - populateTimeRFC3339(objectMap, "startTime", o.StartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OrderItemProperties. -func (o *OrderItemProperties) UnmarshalJSON(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 "addressDetails": - err = unpopulate(val, "AddressDetails", &o.AddressDetails) - delete(rawMsg, key) - case "orderId": - err = unpopulate(val, "OrderID", &o.OrderID) - delete(rawMsg, key) - case "orderItemDetails": - err = unpopulate(val, "OrderItemDetails", &o.OrderItemDetails) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) - 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 OrderItemResource. -func (o OrderItemResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", o.ID) - populate(objectMap, "location", o.Location) - populate(objectMap, "name", o.Name) - populate(objectMap, "properties", o.Properties) - populate(objectMap, "systemData", o.SystemData) - populate(objectMap, "tags", o.Tags) - populate(objectMap, "type", o.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type OrderItemUpdateParameter. -func (o OrderItemUpdateParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", o.Properties) - populate(objectMap, "tags", o.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type OrderItemUpdateProperties. -func (o OrderItemUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "forwardAddress", o.ForwardAddress) - populate(objectMap, "notificationEmailList", o.NotificationEmailList) - populate(objectMap, "preferences", o.Preferences) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type OrderProperties. -func (o OrderProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "currentStage", o.CurrentStage) - populate(objectMap, "orderItemIds", o.OrderItemIDs) - populate(objectMap, "orderStageHistory", o.OrderStageHistory) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Pav2MeterDetails. -func (p *Pav2MeterDetails) UnmarshalJSON(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 "billingType": - err = unpopulate(val, "BillingType", &p.BillingType) - delete(rawMsg, key) - case "chargingType": - err = unpopulate(val, "ChargingType", &p.ChargingType) - delete(rawMsg, key) - case "meterGuid": - err = unpopulate(val, "MeterGUID", &p.MeterGUID) - delete(rawMsg, key) - case "multiplier": - err = unpopulate(val, "Multiplier", &p.Multiplier) - 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 Preferences. -func (p Preferences) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "encryptionPreferences", p.EncryptionPreferences) - populate(objectMap, "managementResourcePreferences", p.ManagementResourcePreferences) - populate(objectMap, "notificationPreferences", p.NotificationPreferences) - populate(objectMap, "transportPreferences", p.TransportPreferences) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ProductDetails. -func (p ProductDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "count", p.Count) - populate(objectMap, "deviceDetails", p.DeviceDetails) - populate(objectMap, "displayInfo", p.DisplayInfo) - populate(objectMap, "hierarchyInformation", p.HierarchyInformation) - populate(objectMap, "productDoubleEncryptionStatus", p.ProductDoubleEncryptionStatus) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ProductFamiliesRequest. -func (p ProductFamiliesRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "customerSubscriptionDetails", p.CustomerSubscriptionDetails) - populate(objectMap, "filterableProperties", p.FilterableProperties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PurchaseMeterDetails. -func (p *PurchaseMeterDetails) UnmarshalJSON(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 "billingType": - err = unpopulate(val, "BillingType", &p.BillingType) - delete(rawMsg, key) - case "chargingType": - err = unpopulate(val, "ChargingType", &p.ChargingType) - delete(rawMsg, key) - case "multiplier": - err = unpopulate(val, "Multiplier", &p.Multiplier) - delete(rawMsg, key) - case "productId": - err = unpopulate(val, "ProductID", &p.ProductID) - delete(rawMsg, key) - case "skuId": - err = unpopulate(val, "SKUID", &p.SKUID) - delete(rawMsg, key) - case "termId": - err = unpopulate(val, "TermID", &p.TermID) - 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 StageDetails. -func (s StageDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "stageName", s.StageName) - populate(objectMap, "stageStatus", s.StageStatus) - populateTimeRFC3339(objectMap, "startTime", s.StartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StageDetails. -func (s *StageDetails) UnmarshalJSON(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 "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) - delete(rawMsg, key) - case "stageName": - err = unpopulate(val, "StageName", &s.StageName) - delete(rawMsg, key) - case "stageStatus": - err = unpopulate(val, "StageStatus", &s.StageStatus) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &s.StartTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, 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/edgeorder/armedgeorder/zz_generated_response_types.go b/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_response_types.go deleted file mode 100644 index 7035d4820784..000000000000 --- a/sdk/resourcemanager/edgeorder/armedgeorder/zz_generated_response_types.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 armedgeorder - -// ManagementClientCancelOrderItemResponse contains the response from method ManagementClient.CancelOrderItem. -type ManagementClientCancelOrderItemResponse struct { - // placeholder for future response values -} - -// ManagementClientCreateAddressResponse contains the response from method ManagementClient.CreateAddress. -type ManagementClientCreateAddressResponse struct { - AddressResource -} - -// ManagementClientCreateOrderItemResponse contains the response from method ManagementClient.CreateOrderItem. -type ManagementClientCreateOrderItemResponse struct { - OrderItemResource -} - -// ManagementClientDeleteAddressByNameResponse contains the response from method ManagementClient.DeleteAddressByName. -type ManagementClientDeleteAddressByNameResponse struct { - // placeholder for future response values -} - -// ManagementClientDeleteOrderItemByNameResponse contains the response from method ManagementClient.DeleteOrderItemByName. -type ManagementClientDeleteOrderItemByNameResponse struct { - // placeholder for future response values -} - -// ManagementClientGetAddressByNameResponse contains the response from method ManagementClient.GetAddressByName. -type ManagementClientGetAddressByNameResponse struct { - AddressResource -} - -// ManagementClientGetOrderByNameResponse contains the response from method ManagementClient.GetOrderByName. -type ManagementClientGetOrderByNameResponse struct { - OrderResource -} - -// ManagementClientGetOrderItemByNameResponse contains the response from method ManagementClient.GetOrderItemByName. -type ManagementClientGetOrderItemByNameResponse struct { - OrderItemResource -} - -// ManagementClientListAddressesAtResourceGroupLevelResponse contains the response from method ManagementClient.ListAddressesAtResourceGroupLevel. -type ManagementClientListAddressesAtResourceGroupLevelResponse struct { - AddressResourceList -} - -// ManagementClientListAddressesAtSubscriptionLevelResponse contains the response from method ManagementClient.ListAddressesAtSubscriptionLevel. -type ManagementClientListAddressesAtSubscriptionLevelResponse struct { - AddressResourceList -} - -// ManagementClientListConfigurationsResponse contains the response from method ManagementClient.ListConfigurations. -type ManagementClientListConfigurationsResponse struct { - Configurations -} - -// ManagementClientListOperationsResponse contains the response from method ManagementClient.ListOperations. -type ManagementClientListOperationsResponse struct { - OperationListResult -} - -// ManagementClientListOrderAtResourceGroupLevelResponse contains the response from method ManagementClient.ListOrderAtResourceGroupLevel. -type ManagementClientListOrderAtResourceGroupLevelResponse struct { - OrderResourceList -} - -// ManagementClientListOrderAtSubscriptionLevelResponse contains the response from method ManagementClient.ListOrderAtSubscriptionLevel. -type ManagementClientListOrderAtSubscriptionLevelResponse struct { - OrderResourceList -} - -// ManagementClientListOrderItemsAtResourceGroupLevelResponse contains the response from method ManagementClient.ListOrderItemsAtResourceGroupLevel. -type ManagementClientListOrderItemsAtResourceGroupLevelResponse struct { - OrderItemResourceList -} - -// ManagementClientListOrderItemsAtSubscriptionLevelResponse contains the response from method ManagementClient.ListOrderItemsAtSubscriptionLevel. -type ManagementClientListOrderItemsAtSubscriptionLevelResponse struct { - OrderItemResourceList -} - -// ManagementClientListProductFamiliesMetadataResponse contains the response from method ManagementClient.ListProductFamiliesMetadata. -type ManagementClientListProductFamiliesMetadataResponse struct { - ProductFamiliesMetadata -} - -// ManagementClientListProductFamiliesResponse contains the response from method ManagementClient.ListProductFamilies. -type ManagementClientListProductFamiliesResponse struct { - ProductFamilies -} - -// ManagementClientReturnOrderItemResponse contains the response from method ManagementClient.ReturnOrderItem. -type ManagementClientReturnOrderItemResponse struct { - // placeholder for future response values -} - -// ManagementClientUpdateAddressResponse contains the response from method ManagementClient.UpdateAddress. -type ManagementClientUpdateAddressResponse struct { - AddressResource -} - -// ManagementClientUpdateOrderItemResponse contains the response from method ManagementClient.UpdateOrderItem. -type ManagementClientUpdateOrderItemResponse struct { - OrderItemResource -}