diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/CHANGELOG.md b/sdk/resourcemanager/edgeorder/armedgeorder/CHANGELOG.md index 5644a87ff9c7..937a06592026 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/CHANGELOG.md +++ b/sdk/resourcemanager/edgeorder/armedgeorder/CHANGELOG.md @@ -1,5 +1,132 @@ # Release History +## 2.0.0 (2025-05-12) +### Breaking Changes + +- Type of `ErrorAdditionalInfo.Info` has been changed from `any` to `*ErrorAdditionalInfoInfo` +- Function `*ClientFactory.NewManagementClient` has been removed +- 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 `BasicInformation` has been removed +- Struct `CommonProperties` has been removed +- Struct `ConfigurationFilters` has been removed +- Struct `ErrorResponse` has been removed +- Struct `ProxyResource` has been removed +- Struct `Resource` has been removed +- Struct `ShippingDetails` has been removed +- Struct `TrackedResource` has been removed +- Field `ConfigurationFilters` of struct `ConfigurationsRequest` has been removed +- Field `ManagementRpDetails` of struct `OrderItemDetails` has been removed +- Field `Count`, `DeviceDetails` of struct `ProductDetails` has been removed + +### Features Added + +- New value `AvailabilityStageDiscoverable` added to enum type `AvailabilityStage` +- New value `LinkTypeDiscoverable` added to enum type `LinkType` +- New value `OrderItemTypeExternal` added to enum type `OrderItemType` +- New value `StageNameReadyToSetup` added to enum type `StageName` +- New enum type `AddressClassification` with values `AddressClassificationShipping`, `AddressClassificationSite` +- New enum type `AutoProvisioningStatus` with values `AutoProvisioningStatusDisabled`, `AutoProvisioningStatusEnabled` +- New enum type `ChildConfigurationType` with values `ChildConfigurationTypeAdditionalConfiguration`, `ChildConfigurationTypeDeviceConfiguration` +- New enum type `DevicePresenceVerificationStatus` with values `DevicePresenceVerificationStatusCompleted`, `DevicePresenceVerificationStatusNotInitiated` +- New enum type `FulfillmentType` with values `FulfillmentTypeExternal`, `FulfillmentTypeMicrosoft` +- New enum type `IdentificationType` with values `IdentificationTypeNotSupported`, `IdentificationTypeSerialNumber` +- New enum type `OrderMode` with values `OrderModeDefault`, `OrderModeDoNotFulfill` +- New enum type `ProvisioningState` with values `ProvisioningStateCanceled`, `ProvisioningStateCreating`, `ProvisioningStateFailed`, `ProvisioningStateSucceeded` +- New enum type `ProvisioningSupport` with values `ProvisioningSupportCloudBased`, `ProvisioningSupportManual` +- New enum type `TermCommitmentType` with values `TermCommitmentTypeNone`, `TermCommitmentTypeTimed`, `TermCommitmentTypeTrial` +- New function `NewAddressResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AddressResourcesClient, error)` +- New function `*AddressResourcesClient.BeginCreate(context.Context, string, string, AddressResource, *AddressResourcesClientBeginCreateOptions) (*runtime.Poller[AddressResourcesClientCreateResponse], error)` +- New function `*AddressResourcesClient.BeginDelete(context.Context, string, string, *AddressResourcesClientBeginDeleteOptions) (*runtime.Poller[AddressResourcesClientDeleteResponse], error)` +- New function `*AddressResourcesClient.Get(context.Context, string, string, *AddressResourcesClientGetOptions) (AddressResourcesClientGetResponse, error)` +- New function `*AddressResourcesClient.NewListByResourceGroupPager(string, *AddressResourcesClientListByResourceGroupOptions) *runtime.Pager[AddressResourcesClientListByResourceGroupResponse]` +- New function `*AddressResourcesClient.NewListBySubscriptionPager(*AddressResourcesClientListBySubscriptionOptions) *runtime.Pager[AddressResourcesClientListBySubscriptionResponse]` +- New function `*AddressResourcesClient.BeginUpdate(context.Context, string, string, AddressUpdateParameter, *AddressResourcesClientBeginUpdateOptions) (*runtime.Poller[AddressResourcesClientUpdateResponse], error)` +- New function `*ClientFactory.NewAddressResourcesClient() *AddressResourcesClient` +- New function `*ClientFactory.NewOperationsClient() *OperationsClient` +- New function `*ClientFactory.NewOrderItemResourcesClient() *OrderItemResourcesClient` +- New function `*ClientFactory.NewOrderResourcesClient() *OrderResourcesClient` +- New function `*ClientFactory.NewOrdersOperationGroupClient() *OrdersOperationGroupClient` +- New function `*ClientFactory.NewProductsAndConfigurationsOperationGroupClient() *ProductsAndConfigurationsOperationGroupClient` +- New function `NewOperationsClient(azcore.TokenCredential, *arm.ClientOptions) (*OperationsClient, error)` +- New function `*OperationsClient.NewListPager(*OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]` +- New function `NewOrderItemResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OrderItemResourcesClient, error)` +- New function `*OrderItemResourcesClient.Cancel(context.Context, string, string, CancellationReason, *OrderItemResourcesClientCancelOptions) (OrderItemResourcesClientCancelResponse, error)` +- New function `*OrderItemResourcesClient.BeginCreate(context.Context, string, string, OrderItemResource, *OrderItemResourcesClientBeginCreateOptions) (*runtime.Poller[OrderItemResourcesClientCreateResponse], error)` +- New function `*OrderItemResourcesClient.BeginDelete(context.Context, string, string, *OrderItemResourcesClientBeginDeleteOptions) (*runtime.Poller[OrderItemResourcesClientDeleteResponse], error)` +- New function `*OrderItemResourcesClient.Get(context.Context, string, string, *OrderItemResourcesClientGetOptions) (OrderItemResourcesClientGetResponse, error)` +- New function `*OrderItemResourcesClient.NewListByResourceGroupPager(string, *OrderItemResourcesClientListByResourceGroupOptions) *runtime.Pager[OrderItemResourcesClientListByResourceGroupResponse]` +- New function `*OrderItemResourcesClient.NewListBySubscriptionPager(*OrderItemResourcesClientListBySubscriptionOptions) *runtime.Pager[OrderItemResourcesClientListBySubscriptionResponse]` +- New function `*OrderItemResourcesClient.BeginReturnOrderItem(context.Context, string, string, ReturnOrderItemDetails, *OrderItemResourcesClientBeginReturnOrderItemOptions) (*runtime.Poller[OrderItemResourcesClientReturnOrderItemResponse], error)` +- New function `*OrderItemResourcesClient.BeginUpdate(context.Context, string, string, OrderItemUpdateParameter, *OrderItemResourcesClientBeginUpdateOptions) (*runtime.Poller[OrderItemResourcesClientUpdateResponse], error)` +- New function `NewOrderResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OrderResourcesClient, error)` +- New function `*OrderResourcesClient.Get(context.Context, string, string, string, *OrderResourcesClientGetOptions) (OrderResourcesClientGetResponse, error)` +- New function `NewOrdersOperationGroupClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OrdersOperationGroupClient, error)` +- New function `*OrdersOperationGroupClient.NewListByResourceGroupPager(string, *OrdersOperationGroupClientListByResourceGroupOptions) *runtime.Pager[OrdersOperationGroupClientListByResourceGroupResponse]` +- New function `*OrdersOperationGroupClient.NewListBySubscriptionPager(*OrdersOperationGroupClientListBySubscriptionOptions) *runtime.Pager[OrdersOperationGroupClientListBySubscriptionResponse]` +- New function `NewProductsAndConfigurationsOperationGroupClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProductsAndConfigurationsOperationGroupClient, error)` +- New function `*ProductsAndConfigurationsOperationGroupClient.NewListConfigurationsPager(ConfigurationsRequest, *ProductsAndConfigurationsOperationGroupClientListConfigurationsOptions) *runtime.Pager[ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse]` +- New function `*ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesMetadataPager(*ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataOptions) *runtime.Pager[ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse]` +- New function `*ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesPager(ProductFamiliesRequest, *ProductsAndConfigurationsOperationGroupClientListProductFamiliesOptions) *runtime.Pager[ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse]` +- New struct `AdditionalConfiguration` +- New struct `CategoryInformation` +- New struct `ChildConfiguration` +- New struct `ChildConfigurationFilter` +- New struct `ChildConfigurationProperties` +- New struct `ConfigurationDeviceDetails` +- New struct `ConfigurationFilter` +- New struct `DevicePresenceVerificationDetails` +- New struct `ErrorAdditionalInfoInfo` +- New struct `GroupedChildConfigurations` +- New struct `OkResponse` +- New struct `OrderItemDetailsUpdateParameter` +- New struct `ProductDetailsUpdateParameter` +- New struct `ProvisioningDetails` +- New struct `SiteDetails` +- New struct `TermCommitmentInformation` +- New struct `TermCommitmentPreferences` +- New struct `TermTypeDetails` +- New struct `UserAssignedIdentity` +- New field `AddressClassification`, `ProvisioningState` in struct `AddressProperties` +- New field `TermTypeDetails` in struct `BillingMeterDetails` +- New field `ChildConfigurationTypes`, `FulfilledBy`, `GroupedChildConfigurations`, `ProvisioningSupport`, `SupportedTermCommitmentDurations` in struct `ConfigurationProperties` +- New field `ConfigurationFilter` in struct `ConfigurationsRequest` +- New field `DisplaySerialNumber`, `ProvisioningDetails`, `ProvisioningSupport` in struct `DeviceDetails` +- New field `ConfigurationIDDisplayName` in struct `HierarchyInformation` +- New field `OrderItemMode`, `SiteDetails` in struct `OrderItemDetails` +- New field `ProvisioningState` in struct `OrderItemProperties` +- New field `Identity` in struct `OrderItemResource` +- New field `Identity` in struct `OrderItemUpdateParameter` +- New field `OrderItemDetails` in struct `OrderItemUpdateProperties` +- New field `OrderMode` in struct `OrderProperties` +- New field `TermCommitmentPreferences` in struct `Preferences` +- New field `ChildConfigurationDeviceDetails`, `IdentificationType`, `OptInAdditionalConfigurations`, `ParentDeviceDetails`, `ParentProvisioningDetails`, `TermCommitmentInformation` in struct `ProductDetails` +- New field `FulfilledBy` in struct `ProductFamilyProperties` +- New field `FulfilledBy` in struct `ProductLineProperties` +- New field `FulfilledBy` in struct `ProductProperties` +- New field `UserAssignedIdentities` in struct `ResourceIdentity` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/README.md b/sdk/resourcemanager/edgeorder/armedgeorder/README.md index 6160eb7613ad..9eb89c778995 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/README.md +++ b/sdk/resourcemanager/edgeorder/armedgeorder/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Edge Order module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder/v2 ``` ## Authorization @@ -55,7 +55,7 @@ clientFactory, err := armedgeorder.NewClientFactory(, cred, &op A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewManagementClient() +client := clientFactory.NewAddressResourcesClient() ``` ## Fakes diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/addressresources_client.go b/sdk/resourcemanager/edgeorder/armedgeorder/addressresources_client.go new file mode 100644 index 000000000000..d7e5d784eb9f --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/addressresources_client.go @@ -0,0 +1,486 @@ +// 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) Go Code Generator. 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" + "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" +) + +// AddressResourcesClient contains the methods for the AddressResources group. +// Don't use this type directly, use NewAddressResourcesClient() instead. +type AddressResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAddressResourcesClient creates a new instance of AddressResourcesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAddressResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AddressResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AddressResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2024-02-01 +// - 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 - AddressResourcesClientBeginCreateOptions contains the optional parameters for the AddressResourcesClient.BeginCreate +// method. +func (client *AddressResourcesClient) BeginCreate(ctx context.Context, resourceGroupName string, addressName string, addressResource AddressResource, options *AddressResourcesClientBeginCreateOptions) (*runtime.Poller[AddressResourcesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, addressName, addressResource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AddressResourcesClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AddressResourcesClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2024-02-01 +func (client *AddressResourcesClient) create(ctx context.Context, resourceGroupName string, addressName string, addressResource AddressResource, options *AddressResourcesClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "AddressResourcesClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, addressName, addressResource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *AddressResourcesClient) createCreateRequest(ctx context.Context, resourceGroupName string, addressName string, addressResource AddressResource, _ *AddressResourcesClientBeginCreateOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, addressResource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete an address. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01 +// - 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 - AddressResourcesClientBeginDeleteOptions contains the optional parameters for the AddressResourcesClient.BeginDelete +// method. +func (client *AddressResourcesClient) BeginDelete(ctx context.Context, resourceGroupName string, addressName string, options *AddressResourcesClientBeginDeleteOptions) (*runtime.Poller[AddressResourcesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, addressName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AddressResourcesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AddressResourcesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete an address. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01 +func (client *AddressResourcesClient) deleteOperation(ctx context.Context, resourceGroupName string, addressName string, options *AddressResourcesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "AddressResourcesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, addressName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AddressResourcesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, addressName string, _ *AddressResourcesClientBeginDeleteOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01") + 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 2024-02-01 +// - 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 - AddressResourcesClientGetOptions contains the optional parameters for the AddressResourcesClient.Get method. +func (client *AddressResourcesClient) Get(ctx context.Context, resourceGroupName string, addressName string, options *AddressResourcesClientGetOptions) (AddressResourcesClientGetResponse, error) { + var err error + const operationName = "AddressResourcesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, addressName, options) + if err != nil { + return AddressResourcesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AddressResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AddressResourcesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AddressResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, addressName string, _ *AddressResourcesClientGetOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AddressResourcesClient) getHandleResponse(resp *http.Response) (AddressResourcesClientGetResponse, error) { + result := AddressResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AddressResource); err != nil { + return AddressResourcesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all the addresses available under the given resource group. +// +// Generated from API version 2024-02-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AddressResourcesClientListByResourceGroupOptions contains the optional parameters for the AddressResourcesClient.NewListByResourceGroupPager +// method. +func (client *AddressResourcesClient) NewListByResourceGroupPager(resourceGroupName string, options *AddressResourcesClientListByResourceGroupOptions) *runtime.Pager[AddressResourcesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AddressResourcesClientListByResourceGroupResponse]{ + More: func(page AddressResourcesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AddressResourcesClientListByResourceGroupResponse) (AddressResourcesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AddressResourcesClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return AddressResourcesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *AddressResourcesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AddressResourcesClientListByResourceGroupOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + 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)) + } + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *AddressResourcesClient) listByResourceGroupHandleResponse(resp *http.Response) (AddressResourcesClientListByResourceGroupResponse, error) { + result := AddressResourcesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AddressResourceList); err != nil { + return AddressResourcesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List all the addresses available under the subscription. +// +// Generated from API version 2024-02-01 +// - options - AddressResourcesClientListBySubscriptionOptions contains the optional parameters for the AddressResourcesClient.NewListBySubscriptionPager +// method. +func (client *AddressResourcesClient) NewListBySubscriptionPager(options *AddressResourcesClientListBySubscriptionOptions) *runtime.Pager[AddressResourcesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AddressResourcesClientListBySubscriptionResponse]{ + More: func(page AddressResourcesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AddressResourcesClientListBySubscriptionResponse) (AddressResourcesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AddressResourcesClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return AddressResourcesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *AddressResourcesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AddressResourcesClientListBySubscriptionOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + 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)) + } + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *AddressResourcesClient) listBySubscriptionHandleResponse(resp *http.Response) (AddressResourcesClientListBySubscriptionResponse, error) { + result := AddressResourcesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AddressResourceList); err != nil { + return AddressResourcesClientListBySubscriptionResponse{}, 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 2024-02-01 +// - 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 - AddressResourcesClientBeginUpdateOptions contains the optional parameters for the AddressResourcesClient.BeginUpdate +// method. +func (client *AddressResourcesClient) BeginUpdate(ctx context.Context, resourceGroupName string, addressName string, addressUpdateParameter AddressUpdateParameter, options *AddressResourcesClientBeginUpdateOptions) (*runtime.Poller[AddressResourcesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, addressName, addressUpdateParameter, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AddressResourcesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AddressResourcesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update the properties of an existing address. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01 +func (client *AddressResourcesClient) update(ctx context.Context, resourceGroupName string, addressName string, addressUpdateParameter AddressUpdateParameter, options *AddressResourcesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AddressResourcesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, addressName, addressUpdateParameter, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *AddressResourcesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, addressName string, addressUpdateParameter AddressUpdateParameter, options *AddressResourcesClientBeginUpdateOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, addressUpdateParameter); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/addressresources_client_example_test.go b/sdk/resourcemanager/edgeorder/armedgeorder/addressresources_client_example_test.go new file mode 100644 index 000000000000..d5f0fe03e0a0 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/addressresources_client_example_test.go @@ -0,0 +1,376 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armedgeorder_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder/v2" + "log" +) + +// Generated from example definition: 2024-02-01/CreateAddress.json +func ExampleAddressResourcesClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAddressResourcesClient().BeginCreate(ctx, "YourResourceGroupName", "TestAddressName2", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armedgeorder.AddressResourcesClientCreateResponse{ + // } +} + +// Generated from example definition: 2024-02-01/DeleteAddressByName.json +func ExampleAddressResourcesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAddressResourcesClient().BeginDelete(ctx, "YourResourceGroupName", "TestAddressName1", 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: 2024-02-01/GetAddressByName.json +func ExampleAddressResourcesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAddressResourcesClient().Get(ctx, "YourResourceGroupName", "TestAddressName1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armedgeorder.AddressResourcesClientGetResponse{ + // AddressResource: &armedgeorder.AddressResource{ + // Name: to.Ptr("TestAddressName1"), + // Type: to.Ptr("Microsoft.EdgeOrder/addresses"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/addresses/TestAddressName1"), + // Location: to.Ptr("eastus"), + // Properties: &armedgeorder.AddressProperties{ + // AddressClassification: to.Ptr(armedgeorder.AddressClassificationShipping), + // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), + // 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"), + // }, + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-02-01/ListAddressesAtResourceGroupLevel.json +func ExampleAddressResourcesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAddressResourcesClient().NewListByResourceGroupPager("YourResourceGroupName", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armedgeorder.AddressResourcesClientListByResourceGroupResponse{ + // AddressResourceList: armedgeorder.AddressResourceList{ + // Value: []*armedgeorder.AddressResource{ + // { + // Name: to.Ptr("TestAddressName1"), + // Type: to.Ptr("Microsoft.EdgeOrder/addresses"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/addresses/TestAddressName1"), + // Location: to.Ptr("eastus"), + // Properties: &armedgeorder.AddressProperties{ + // AddressClassification: to.Ptr(armedgeorder.AddressClassificationShipping), + // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), + // 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"), + // }, + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // Tags: map[string]*string{ + // }, + // }, + // { + // Name: to.Ptr("TestAddressName2"), + // Type: to.Ptr("Microsoft.EdgeOrder/addresses"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/addresses/TestAddressName2"), + // Location: to.Ptr("eastus"), + // Properties: &armedgeorder.AddressProperties{ + // AddressClassification: to.Ptr(armedgeorder.AddressClassificationShipping), + // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), + // 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"), + // }, + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // Tags: map[string]*string{ + // "tag1": to.Ptr("value1"), + // "tag2": to.Ptr("value2"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-02-01/ListAddressesAtSubscriptionLevel.json +func ExampleAddressResourcesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAddressResourcesClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armedgeorder.AddressResourcesClientListBySubscriptionResponse{ + // AddressResourceList: armedgeorder.AddressResourceList{ + // Value: []*armedgeorder.AddressResource{ + // { + // Name: to.Ptr("TestAddressName1"), + // Type: to.Ptr("Microsoft.EdgeOrder/addresses"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/addresses/TestAddressName1"), + // Location: to.Ptr("eastus"), + // Properties: &armedgeorder.AddressProperties{ + // AddressClassification: to.Ptr(armedgeorder.AddressClassificationShipping), + // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), + // 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"), + // }, + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // Tags: map[string]*string{ + // }, + // }, + // { + // Name: to.Ptr("TestAddressName2"), + // Type: to.Ptr("Microsoft.EdgeOrder/addresses"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/addresses/TestAddressName2"), + // Location: to.Ptr("eastus"), + // Properties: &armedgeorder.AddressProperties{ + // AddressClassification: to.Ptr(armedgeorder.AddressClassificationShipping), + // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), + // 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"), + // }, + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-02-01/UpdateAddress.json +func ExampleAddressResourcesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAddressResourcesClient().BeginUpdate(ctx, "YourResourceGroupName", "TestAddressName2", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armedgeorder.AddressResourcesClientUpdateResponse{ + // AddressResource: &armedgeorder.AddressResource{ + // Name: to.Ptr("TestAddressName2"), + // Type: to.Ptr("Microsoft.EdgeOrder/addresses"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/addresses/TestAddressName2"), + // Location: to.Ptr("eastus"), + // Properties: &armedgeorder.AddressProperties{ + // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), + // 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"), + // }, + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // Tags: map[string]*string{ + // "tag1": to.Ptr("value1"), + // "tag2": to.Ptr("value2"), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/autorest.md b/sdk/resourcemanager/edgeorder/armedgeorder/autorest.md deleted file mode 100644 index 3bd0dcfa678e..000000000000 --- a/sdk/resourcemanager/edgeorder/armedgeorder/autorest.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` 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 -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 - -``` \ No newline at end of file diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/build.go b/sdk/resourcemanager/edgeorder/armedgeorder/build.go deleted file mode 100644 index c9c70492a5b3..000000000000 --- a/sdk/resourcemanager/edgeorder/armedgeorder/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/edgeorder/armedgeorder - -package armedgeorder diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/client_factory.go b/sdk/resourcemanager/edgeorder/armedgeorder/client_factory.go index 18f6a0a250ae..e1d7171a59a5 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/client_factory.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/client_factory.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armedgeorder @@ -17,28 +13,68 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } -// NewManagementClient creates a new instance of ManagementClient. -func (c *ClientFactory) NewManagementClient() *ManagementClient { - subClient, _ := NewManagementClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewAddressResourcesClient creates a new instance of AddressResourcesClient. +func (c *ClientFactory) NewAddressResourcesClient() *AddressResourcesClient { + return &AddressResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewOrderItemResourcesClient creates a new instance of OrderItemResourcesClient. +func (c *ClientFactory) NewOrderItemResourcesClient() *OrderItemResourcesClient { + return &OrderItemResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOrderResourcesClient creates a new instance of OrderResourcesClient. +func (c *ClientFactory) NewOrderResourcesClient() *OrderResourcesClient { + return &OrderResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOrdersOperationGroupClient creates a new instance of OrdersOperationGroupClient. +func (c *ClientFactory) NewOrdersOperationGroupClient() *OrdersOperationGroupClient { + return &OrdersOperationGroupClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewProductsAndConfigurationsOperationGroupClient creates a new instance of ProductsAndConfigurationsOperationGroupClient. +func (c *ClientFactory) NewProductsAndConfigurationsOperationGroupClient() *ProductsAndConfigurationsOperationGroupClient { + return &ProductsAndConfigurationsOperationGroupClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/constants.go b/sdk/resourcemanager/edgeorder/armedgeorder/constants.go index b32ea1f46349..b7c7bce035f6 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/constants.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/constants.go @@ -1,16 +1,12 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armedgeorder const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder" - moduleVersion = "v1.2.0" + moduleVersion = "v2.0.0" ) // ActionStatusEnum - Describes whether the order item is deletable or not. @@ -31,10 +27,11 @@ func PossibleActionStatusEnumValues() []ActionStatusEnum { } } -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. type ActionType string const ( + // ActionTypeInternal - Actions are for internal-only APIs. ActionTypeInternal ActionType = "Internal" ) @@ -45,6 +42,24 @@ func PossibleActionTypeValues() []ActionType { } } +// AddressClassification - Type of address based on its usage context. +type AddressClassification string + +const ( + // AddressClassificationShipping - Shipping address for the order. + AddressClassificationShipping AddressClassification = "Shipping" + // AddressClassificationSite - Site Address. + AddressClassificationSite AddressClassification = "Site" +) + +// PossibleAddressClassificationValues returns the possible values for the AddressClassification const type. +func PossibleAddressClassificationValues() []AddressClassification { + return []AddressClassification{ + AddressClassificationShipping, + AddressClassificationSite, + } +} + // AddressType - Type of address. type AddressType string @@ -66,7 +81,7 @@ func PossibleAddressTypeValues() []AddressType { } } -// AddressValidationStatus - Status of address validation +// AddressValidationStatus - Status of address validation. type AddressValidationStatus string const ( @@ -87,7 +102,26 @@ func PossibleAddressValidationStatusValues() []AddressValidationStatus { } } -// AvailabilityStage - Current availability stage of the product. Availability stage +// AutoProvisioningStatus - Auto Provisioning Details. +type AutoProvisioningStatus string + +const ( + // AutoProvisioningStatusDisabled - Provisioning Disabled. + AutoProvisioningStatusDisabled AutoProvisioningStatus = "Disabled" + // AutoProvisioningStatusEnabled - Provisioning Enabled. Will act as pre-approved, and arc extension will be enabled as soon + // as the device is verified to be at the right edge location. + AutoProvisioningStatusEnabled AutoProvisioningStatus = "Enabled" +) + +// PossibleAutoProvisioningStatusValues returns the possible values for the AutoProvisioningStatus const type. +func PossibleAutoProvisioningStatusValues() []AutoProvisioningStatus { + return []AutoProvisioningStatus{ + AutoProvisioningStatusDisabled, + AutoProvisioningStatusEnabled, + } +} + +// AvailabilityStage - Current availability stage of the product. type AvailabilityStage string const ( @@ -97,6 +131,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 +147,7 @@ func PossibleAvailabilityStageValues() []AvailabilityStage { AvailabilityStageAvailable, AvailabilityStageComingSoon, AvailabilityStageDeprecated, + AvailabilityStageDiscoverable, AvailabilityStagePreview, AvailabilityStageSignup, AvailabilityStageUnavailable, @@ -153,14 +190,35 @@ func PossibleChargingTypeValues() []ChargingType { } } -// CreatedByType - The type of identity that created the resource. +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 kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -188,6 +246,26 @@ func PossibleDescriptionTypeValues() []DescriptionType { } } +// DevicePresenceVerificationStatus - Proof of possession status. +type DevicePresenceVerificationStatus string + +const ( + // DevicePresenceVerificationStatusCompleted - Confirms that the device is verified to be with the right edge operator or + // at the right location. + DevicePresenceVerificationStatusCompleted DevicePresenceVerificationStatus = "Completed" + // DevicePresenceVerificationStatusNotInitiated - The device has not yet been verified to be with the right edge operator + // or at the right location. + DevicePresenceVerificationStatusNotInitiated DevicePresenceVerificationStatus = "NotInitiated" +) + +// PossibleDevicePresenceVerificationStatusValues returns the possible values for the DevicePresenceVerificationStatus const type. +func PossibleDevicePresenceVerificationStatusValues() []DevicePresenceVerificationStatus { + return []DevicePresenceVerificationStatus{ + DevicePresenceVerificationStatusCompleted, + DevicePresenceVerificationStatusNotInitiated, + } +} + // DisabledReason - Reason why the product is disabled. type DisabledReason string @@ -230,9 +308,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 +322,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 +398,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 +421,7 @@ const ( // PossibleLinkTypeValues returns the possible values for the LinkType const type. func PossibleLinkTypeValues() []LinkType { return []LinkType{ + LinkTypeDiscoverable, LinkTypeDocumentation, LinkTypeGeneric, LinkTypeKnowMore, @@ -313,7 +431,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 ( @@ -398,6 +516,8 @@ func PossibleOrderItemReturnEnumValues() []OrderItemReturnEnum { type OrderItemType string const ( + // OrderItemTypeExternal - Orders placed outside of azure. + OrderItemTypeExternal OrderItemType = "External" // OrderItemTypePurchase - Purchase OrderItem. OrderItemTypePurchase OrderItemType = "Purchase" // OrderItemTypeRental - Rental OrderItem. @@ -407,18 +527,40 @@ const ( // PossibleOrderItemTypeValues returns the possible values for the OrderItemType const type. func PossibleOrderItemTypeValues() []OrderItemType { return []OrderItemType{ + OrderItemTypeExternal, OrderItemTypePurchase, OrderItemTypeRental, } } +// 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 const ( - OriginSystem Origin = "system" - OriginUser Origin = "user" + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. OriginUserSystem Origin = "user,system" ) @@ -431,33 +573,77 @@ func PossibleOriginValues() []Origin { } } -// StageName - Stage name +// ProvisioningState - Provisioning state +type ProvisioningState string + +const ( + // ProvisioningStateCanceled - Canceled state. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating - Creating state. + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateFailed - Failed state. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded - Succeeded state. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + } +} + +// ProvisioningSupport - Determining nature of provisioning that the configuration supports. +type ProvisioningSupport string + +const ( + // ProvisioningSupportCloudBased - The configuration can be provisioned from the cloud. + ProvisioningSupportCloudBased ProvisioningSupport = "CloudBased" + // ProvisioningSupportManual - The configuration need to be provisioned manually by the end user. + ProvisioningSupportManual ProvisioningSupport = "Manual" +) + +// PossibleProvisioningSupportValues returns the possible values for the ProvisioningSupport const type. +func PossibleProvisioningSupportValues() []ProvisioningSupport { + return []ProvisioningSupport{ + ProvisioningSupportCloudBased, + ProvisioningSupportManual, + } +} + +// 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 + // StageNameReadyToSetup - Order is ready to get cloud connected. + StageNameReadyToSetup StageName = "ReadyToSetup" + // 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" ) @@ -470,6 +656,7 @@ func PossibleStageNameValues() []StageName { StageNameInReview, StageNameInUse, StageNamePlaced, + StageNameReadyToSetup, StageNameReadyToShip, StageNameReturnCompleted, StageNameReturnInitiated, @@ -513,9 +700,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" ) @@ -527,6 +714,27 @@ func PossibleSupportedFilterTypesValues() []SupportedFilterTypes { } } +// TermCommitmentType - Term Commitment Type +type TermCommitmentType string + +const ( + // TermCommitmentTypeNone - Pay as you go Term Commitment Model. + TermCommitmentTypeNone TermCommitmentType = "None" + // TermCommitmentTypeTimed - Time based Term Commitment Model. + TermCommitmentTypeTimed TermCommitmentType = "Timed" + // TermCommitmentTypeTrial - Trial Term Commitment Model. + TermCommitmentTypeTrial TermCommitmentType = "Trial" +) + +// PossibleTermCommitmentTypeValues returns the possible values for the TermCommitmentType const type. +func PossibleTermCommitmentTypeValues() []TermCommitmentType { + return []TermCommitmentType{ + TermCommitmentTypeNone, + TermCommitmentTypeTimed, + TermCommitmentTypeTrial, + } +} + // TransportShipmentTypes - Indicates Shipment Logistics type that the customer preferred. type TransportShipmentTypes string diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/fake/addressresources_server.go b/sdk/resourcemanager/edgeorder/armedgeorder/fake/addressresources_server.go new file mode 100644 index 000000000000..22059339164e --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/fake/addressresources_server.go @@ -0,0 +1,448 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// AddressResourcesServer is a fake server for instances of the armedgeorder.AddressResourcesClient type. +type AddressResourcesServer struct { + // BeginCreate is the fake for method AddressResourcesClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginCreate func(ctx context.Context, resourceGroupName string, addressName string, addressResource armedgeorder.AddressResource, options *armedgeorder.AddressResourcesClientBeginCreateOptions) (resp azfake.PollerResponder[armedgeorder.AddressResourcesClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method AddressResourcesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, addressName string, options *armedgeorder.AddressResourcesClientBeginDeleteOptions) (resp azfake.PollerResponder[armedgeorder.AddressResourcesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AddressResourcesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, addressName string, options *armedgeorder.AddressResourcesClientGetOptions) (resp azfake.Responder[armedgeorder.AddressResourcesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method AddressResourcesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armedgeorder.AddressResourcesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armedgeorder.AddressResourcesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method AddressResourcesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armedgeorder.AddressResourcesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armedgeorder.AddressResourcesClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method AddressResourcesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, addressName string, addressUpdateParameter armedgeorder.AddressUpdateParameter, options *armedgeorder.AddressResourcesClientBeginUpdateOptions) (resp azfake.PollerResponder[armedgeorder.AddressResourcesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewAddressResourcesServerTransport creates a new instance of AddressResourcesServerTransport with the provided implementation. +// The returned AddressResourcesServerTransport instance is connected to an instance of armedgeorder.AddressResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAddressResourcesServerTransport(srv *AddressResourcesServer) *AddressResourcesServerTransport { + return &AddressResourcesServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armedgeorder.AddressResourcesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armedgeorder.AddressResourcesClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armedgeorder.AddressResourcesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armedgeorder.AddressResourcesClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armedgeorder.AddressResourcesClientUpdateResponse]](), + } +} + +// AddressResourcesServerTransport connects instances of armedgeorder.AddressResourcesClient to instances of AddressResourcesServer. +// Don't use this type directly, use NewAddressResourcesServerTransport instead. +type AddressResourcesServerTransport struct { + srv *AddressResourcesServer + beginCreate *tracker[azfake.PollerResponder[armedgeorder.AddressResourcesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armedgeorder.AddressResourcesClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armedgeorder.AddressResourcesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armedgeorder.AddressResourcesClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armedgeorder.AddressResourcesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for AddressResourcesServerTransport. +func (a *AddressResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *AddressResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if addressResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = addressResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AddressResourcesClient.BeginCreate": + res.resp, res.err = a.dispatchBeginCreate(req) + case "AddressResourcesClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AddressResourcesClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AddressResourcesClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AddressResourcesClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + case "AddressResourcesClient.BeginUpdate": + res.resp, res.err = a.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *AddressResourcesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := a.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/addresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armedgeorder.AddressResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + addressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("addressName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreate(req.Context(), resourceGroupNameParam, addressNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + a.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + a.beginCreate.remove(req) + } + + return resp, nil +} + +func (a *AddressResourcesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/addresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + addressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("addressName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, addressNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *AddressResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/addresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + addressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("addressName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, addressNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AddressResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AddressResourcesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/addresses` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armedgeorder.AddressResourcesClientListByResourceGroupOptions + if filterParam != nil || skipTokenParam != nil || topParam != nil { + options = &armedgeorder.AddressResourcesClientListByResourceGroupOptions{ + Filter: filterParam, + SkipToken: skipTokenParam, + Top: topParam, + } + } + resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) + newListByResourceGroupPager = &resp + a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armedgeorder.AddressResourcesClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + a.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (a *AddressResourcesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := a.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/addresses` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armedgeorder.AddressResourcesClientListBySubscriptionOptions + if filterParam != nil || skipTokenParam != nil || topParam != nil { + options = &armedgeorder.AddressResourcesClientListBySubscriptionOptions{ + Filter: filterParam, + SkipToken: skipTokenParam, + Top: topParam, + } + } + resp := a.srv.NewListBySubscriptionPager(options) + newListBySubscriptionPager = &resp + a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armedgeorder.AddressResourcesClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + a.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (a *AddressResourcesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := a.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/addresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armedgeorder.AddressUpdateParameter](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + addressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("addressName")]) + if err != nil { + return nil, err + } + ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) + var options *armedgeorder.AddressResourcesClientBeginUpdateOptions + if ifMatchParam != nil { + options = &armedgeorder.AddressResourcesClientBeginUpdateOptions{ + IfMatch: ifMatchParam, + } + } + respr, errRespr := a.srv.BeginUpdate(req.Context(), resourceGroupNameParam, addressNameParam, body, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + a.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + a.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to AddressResourcesServerTransport +var addressResourcesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/fake/internal.go b/sdk/resourcemanager/edgeorder/armedgeorder/fake/internal.go index 45777d4ec6e6..d46bc9665f2e 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/fake/internal.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/fake/internal.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -15,6 +11,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } @@ -47,6 +48,17 @@ func getOptional[T any](v T) *T { return &v } +func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { + if v == "" { + return nil, nil + } + t, err := parse(v) + if err != nil { + return nil, err + } + return &t, err +} + func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/fake/management_server.go b/sdk/resourcemanager/edgeorder/armedgeorder/fake/management_server.go deleted file mode 100644 index 6cf8eec5554e..000000000000 --- a/sdk/resourcemanager/edgeorder/armedgeorder/fake/management_server.go +++ /dev/null @@ -1,1212 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder" - "net/http" - "net/url" - "regexp" -) - -// ManagementServer is a fake server for instances of the armedgeorder.ManagementClient type. -type ManagementServer struct { - // CancelOrderItem is the fake for method ManagementClient.CancelOrderItem - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - CancelOrderItem func(ctx context.Context, orderItemName string, resourceGroupName string, cancellationReason armedgeorder.CancellationReason, options *armedgeorder.ManagementClientCancelOrderItemOptions) (resp azfake.Responder[armedgeorder.ManagementClientCancelOrderItemResponse], errResp azfake.ErrorResponder) - - // BeginCreateAddress is the fake for method ManagementClient.BeginCreateAddress - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginCreateAddress func(ctx context.Context, addressName string, resourceGroupName string, addressResource armedgeorder.AddressResource, options *armedgeorder.ManagementClientBeginCreateAddressOptions) (resp azfake.PollerResponder[armedgeorder.ManagementClientCreateAddressResponse], errResp azfake.ErrorResponder) - - // BeginCreateOrderItem is the fake for method ManagementClient.BeginCreateOrderItem - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginCreateOrderItem func(ctx context.Context, orderItemName string, resourceGroupName string, orderItemResource armedgeorder.OrderItemResource, options *armedgeorder.ManagementClientBeginCreateOrderItemOptions) (resp azfake.PollerResponder[armedgeorder.ManagementClientCreateOrderItemResponse], errResp azfake.ErrorResponder) - - // BeginDeleteAddressByName is the fake for method ManagementClient.BeginDeleteAddressByName - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDeleteAddressByName func(ctx context.Context, addressName string, resourceGroupName string, options *armedgeorder.ManagementClientBeginDeleteAddressByNameOptions) (resp azfake.PollerResponder[armedgeorder.ManagementClientDeleteAddressByNameResponse], errResp azfake.ErrorResponder) - - // BeginDeleteOrderItemByName is the fake for method ManagementClient.BeginDeleteOrderItemByName - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDeleteOrderItemByName func(ctx context.Context, orderItemName string, resourceGroupName string, options *armedgeorder.ManagementClientBeginDeleteOrderItemByNameOptions) (resp azfake.PollerResponder[armedgeorder.ManagementClientDeleteOrderItemByNameResponse], errResp azfake.ErrorResponder) - - // GetAddressByName is the fake for method ManagementClient.GetAddressByName - // HTTP status codes to indicate success: http.StatusOK - GetAddressByName func(ctx context.Context, addressName string, resourceGroupName string, options *armedgeorder.ManagementClientGetAddressByNameOptions) (resp azfake.Responder[armedgeorder.ManagementClientGetAddressByNameResponse], errResp azfake.ErrorResponder) - - // GetOrderByName is the fake for method ManagementClient.GetOrderByName - // HTTP status codes to indicate success: http.StatusOK - GetOrderByName func(ctx context.Context, orderName string, resourceGroupName string, location string, options *armedgeorder.ManagementClientGetOrderByNameOptions) (resp azfake.Responder[armedgeorder.ManagementClientGetOrderByNameResponse], errResp azfake.ErrorResponder) - - // GetOrderItemByName is the fake for method ManagementClient.GetOrderItemByName - // HTTP status codes to indicate success: http.StatusOK - GetOrderItemByName func(ctx context.Context, orderItemName string, resourceGroupName string, options *armedgeorder.ManagementClientGetOrderItemByNameOptions) (resp azfake.Responder[armedgeorder.ManagementClientGetOrderItemByNameResponse], errResp azfake.ErrorResponder) - - // NewListAddressesAtResourceGroupLevelPager is the fake for method ManagementClient.NewListAddressesAtResourceGroupLevelPager - // HTTP status codes to indicate success: http.StatusOK - NewListAddressesAtResourceGroupLevelPager func(resourceGroupName string, options *armedgeorder.ManagementClientListAddressesAtResourceGroupLevelOptions) (resp azfake.PagerResponder[armedgeorder.ManagementClientListAddressesAtResourceGroupLevelResponse]) - - // NewListAddressesAtSubscriptionLevelPager is the fake for method ManagementClient.NewListAddressesAtSubscriptionLevelPager - // HTTP status codes to indicate success: http.StatusOK - NewListAddressesAtSubscriptionLevelPager func(options *armedgeorder.ManagementClientListAddressesAtSubscriptionLevelOptions) (resp azfake.PagerResponder[armedgeorder.ManagementClientListAddressesAtSubscriptionLevelResponse]) - - // NewListConfigurationsPager is the fake for method ManagementClient.NewListConfigurationsPager - // HTTP status codes to indicate success: http.StatusOK - NewListConfigurationsPager func(configurationsRequest armedgeorder.ConfigurationsRequest, options *armedgeorder.ManagementClientListConfigurationsOptions) (resp azfake.PagerResponder[armedgeorder.ManagementClientListConfigurationsResponse]) - - // NewListOperationsPager is the fake for method ManagementClient.NewListOperationsPager - // HTTP status codes to indicate success: http.StatusOK - NewListOperationsPager func(options *armedgeorder.ManagementClientListOperationsOptions) (resp azfake.PagerResponder[armedgeorder.ManagementClientListOperationsResponse]) - - // NewListOrderAtResourceGroupLevelPager is the fake for method ManagementClient.NewListOrderAtResourceGroupLevelPager - // HTTP status codes to indicate success: http.StatusOK - NewListOrderAtResourceGroupLevelPager func(resourceGroupName string, options *armedgeorder.ManagementClientListOrderAtResourceGroupLevelOptions) (resp azfake.PagerResponder[armedgeorder.ManagementClientListOrderAtResourceGroupLevelResponse]) - - // NewListOrderAtSubscriptionLevelPager is the fake for method ManagementClient.NewListOrderAtSubscriptionLevelPager - // HTTP status codes to indicate success: http.StatusOK - NewListOrderAtSubscriptionLevelPager func(options *armedgeorder.ManagementClientListOrderAtSubscriptionLevelOptions) (resp azfake.PagerResponder[armedgeorder.ManagementClientListOrderAtSubscriptionLevelResponse]) - - // NewListOrderItemsAtResourceGroupLevelPager is the fake for method ManagementClient.NewListOrderItemsAtResourceGroupLevelPager - // HTTP status codes to indicate success: http.StatusOK - NewListOrderItemsAtResourceGroupLevelPager func(resourceGroupName string, options *armedgeorder.ManagementClientListOrderItemsAtResourceGroupLevelOptions) (resp azfake.PagerResponder[armedgeorder.ManagementClientListOrderItemsAtResourceGroupLevelResponse]) - - // NewListOrderItemsAtSubscriptionLevelPager is the fake for method ManagementClient.NewListOrderItemsAtSubscriptionLevelPager - // HTTP status codes to indicate success: http.StatusOK - NewListOrderItemsAtSubscriptionLevelPager func(options *armedgeorder.ManagementClientListOrderItemsAtSubscriptionLevelOptions) (resp azfake.PagerResponder[armedgeorder.ManagementClientListOrderItemsAtSubscriptionLevelResponse]) - - // NewListProductFamiliesPager is the fake for method ManagementClient.NewListProductFamiliesPager - // HTTP status codes to indicate success: http.StatusOK - NewListProductFamiliesPager func(productFamiliesRequest armedgeorder.ProductFamiliesRequest, options *armedgeorder.ManagementClientListProductFamiliesOptions) (resp azfake.PagerResponder[armedgeorder.ManagementClientListProductFamiliesResponse]) - - // NewListProductFamiliesMetadataPager is the fake for method ManagementClient.NewListProductFamiliesMetadataPager - // HTTP status codes to indicate success: http.StatusOK - NewListProductFamiliesMetadataPager func(options *armedgeorder.ManagementClientListProductFamiliesMetadataOptions) (resp azfake.PagerResponder[armedgeorder.ManagementClientListProductFamiliesMetadataResponse]) - - // BeginReturnOrderItem is the fake for method ManagementClient.BeginReturnOrderItem - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginReturnOrderItem func(ctx context.Context, orderItemName string, resourceGroupName string, returnOrderItemDetails armedgeorder.ReturnOrderItemDetails, options *armedgeorder.ManagementClientBeginReturnOrderItemOptions) (resp azfake.PollerResponder[armedgeorder.ManagementClientReturnOrderItemResponse], errResp azfake.ErrorResponder) - - // BeginUpdateAddress is the fake for method ManagementClient.BeginUpdateAddress - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdateAddress func(ctx context.Context, addressName string, resourceGroupName string, addressUpdateParameter armedgeorder.AddressUpdateParameter, options *armedgeorder.ManagementClientBeginUpdateAddressOptions) (resp azfake.PollerResponder[armedgeorder.ManagementClientUpdateAddressResponse], errResp azfake.ErrorResponder) - - // BeginUpdateOrderItem is the fake for method ManagementClient.BeginUpdateOrderItem - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdateOrderItem func(ctx context.Context, orderItemName string, resourceGroupName string, orderItemUpdateParameter armedgeorder.OrderItemUpdateParameter, options *armedgeorder.ManagementClientBeginUpdateOrderItemOptions) (resp azfake.PollerResponder[armedgeorder.ManagementClientUpdateOrderItemResponse], errResp azfake.ErrorResponder) -} - -// NewManagementServerTransport creates a new instance of ManagementServerTransport with the provided implementation. -// The returned ManagementServerTransport instance is connected to an instance of armedgeorder.ManagementClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewManagementServerTransport(srv *ManagementServer) *ManagementServerTransport { - return &ManagementServerTransport{ - srv: srv, - beginCreateAddress: newTracker[azfake.PollerResponder[armedgeorder.ManagementClientCreateAddressResponse]](), - beginCreateOrderItem: newTracker[azfake.PollerResponder[armedgeorder.ManagementClientCreateOrderItemResponse]](), - beginDeleteAddressByName: newTracker[azfake.PollerResponder[armedgeorder.ManagementClientDeleteAddressByNameResponse]](), - beginDeleteOrderItemByName: newTracker[azfake.PollerResponder[armedgeorder.ManagementClientDeleteOrderItemByNameResponse]](), - newListAddressesAtResourceGroupLevelPager: newTracker[azfake.PagerResponder[armedgeorder.ManagementClientListAddressesAtResourceGroupLevelResponse]](), - newListAddressesAtSubscriptionLevelPager: newTracker[azfake.PagerResponder[armedgeorder.ManagementClientListAddressesAtSubscriptionLevelResponse]](), - newListConfigurationsPager: newTracker[azfake.PagerResponder[armedgeorder.ManagementClientListConfigurationsResponse]](), - newListOperationsPager: newTracker[azfake.PagerResponder[armedgeorder.ManagementClientListOperationsResponse]](), - newListOrderAtResourceGroupLevelPager: newTracker[azfake.PagerResponder[armedgeorder.ManagementClientListOrderAtResourceGroupLevelResponse]](), - newListOrderAtSubscriptionLevelPager: newTracker[azfake.PagerResponder[armedgeorder.ManagementClientListOrderAtSubscriptionLevelResponse]](), - newListOrderItemsAtResourceGroupLevelPager: newTracker[azfake.PagerResponder[armedgeorder.ManagementClientListOrderItemsAtResourceGroupLevelResponse]](), - newListOrderItemsAtSubscriptionLevelPager: newTracker[azfake.PagerResponder[armedgeorder.ManagementClientListOrderItemsAtSubscriptionLevelResponse]](), - newListProductFamiliesPager: newTracker[azfake.PagerResponder[armedgeorder.ManagementClientListProductFamiliesResponse]](), - newListProductFamiliesMetadataPager: newTracker[azfake.PagerResponder[armedgeorder.ManagementClientListProductFamiliesMetadataResponse]](), - beginReturnOrderItem: newTracker[azfake.PollerResponder[armedgeorder.ManagementClientReturnOrderItemResponse]](), - beginUpdateAddress: newTracker[azfake.PollerResponder[armedgeorder.ManagementClientUpdateAddressResponse]](), - beginUpdateOrderItem: newTracker[azfake.PollerResponder[armedgeorder.ManagementClientUpdateOrderItemResponse]](), - } -} - -// ManagementServerTransport connects instances of armedgeorder.ManagementClient to instances of ManagementServer. -// Don't use this type directly, use NewManagementServerTransport instead. -type ManagementServerTransport struct { - srv *ManagementServer - beginCreateAddress *tracker[azfake.PollerResponder[armedgeorder.ManagementClientCreateAddressResponse]] - beginCreateOrderItem *tracker[azfake.PollerResponder[armedgeorder.ManagementClientCreateOrderItemResponse]] - beginDeleteAddressByName *tracker[azfake.PollerResponder[armedgeorder.ManagementClientDeleteAddressByNameResponse]] - beginDeleteOrderItemByName *tracker[azfake.PollerResponder[armedgeorder.ManagementClientDeleteOrderItemByNameResponse]] - newListAddressesAtResourceGroupLevelPager *tracker[azfake.PagerResponder[armedgeorder.ManagementClientListAddressesAtResourceGroupLevelResponse]] - newListAddressesAtSubscriptionLevelPager *tracker[azfake.PagerResponder[armedgeorder.ManagementClientListAddressesAtSubscriptionLevelResponse]] - newListConfigurationsPager *tracker[azfake.PagerResponder[armedgeorder.ManagementClientListConfigurationsResponse]] - newListOperationsPager *tracker[azfake.PagerResponder[armedgeorder.ManagementClientListOperationsResponse]] - newListOrderAtResourceGroupLevelPager *tracker[azfake.PagerResponder[armedgeorder.ManagementClientListOrderAtResourceGroupLevelResponse]] - newListOrderAtSubscriptionLevelPager *tracker[azfake.PagerResponder[armedgeorder.ManagementClientListOrderAtSubscriptionLevelResponse]] - newListOrderItemsAtResourceGroupLevelPager *tracker[azfake.PagerResponder[armedgeorder.ManagementClientListOrderItemsAtResourceGroupLevelResponse]] - newListOrderItemsAtSubscriptionLevelPager *tracker[azfake.PagerResponder[armedgeorder.ManagementClientListOrderItemsAtSubscriptionLevelResponse]] - newListProductFamiliesPager *tracker[azfake.PagerResponder[armedgeorder.ManagementClientListProductFamiliesResponse]] - newListProductFamiliesMetadataPager *tracker[azfake.PagerResponder[armedgeorder.ManagementClientListProductFamiliesMetadataResponse]] - beginReturnOrderItem *tracker[azfake.PollerResponder[armedgeorder.ManagementClientReturnOrderItemResponse]] - beginUpdateAddress *tracker[azfake.PollerResponder[armedgeorder.ManagementClientUpdateAddressResponse]] - beginUpdateOrderItem *tracker[azfake.PollerResponder[armedgeorder.ManagementClientUpdateOrderItemResponse]] -} - -// Do implements the policy.Transporter interface for ManagementServerTransport. -func (m *ManagementServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ManagementClient.CancelOrderItem": - resp, err = m.dispatchCancelOrderItem(req) - case "ManagementClient.BeginCreateAddress": - resp, err = m.dispatchBeginCreateAddress(req) - case "ManagementClient.BeginCreateOrderItem": - resp, err = m.dispatchBeginCreateOrderItem(req) - case "ManagementClient.BeginDeleteAddressByName": - resp, err = m.dispatchBeginDeleteAddressByName(req) - case "ManagementClient.BeginDeleteOrderItemByName": - resp, err = m.dispatchBeginDeleteOrderItemByName(req) - case "ManagementClient.GetAddressByName": - resp, err = m.dispatchGetAddressByName(req) - case "ManagementClient.GetOrderByName": - resp, err = m.dispatchGetOrderByName(req) - case "ManagementClient.GetOrderItemByName": - resp, err = m.dispatchGetOrderItemByName(req) - case "ManagementClient.NewListAddressesAtResourceGroupLevelPager": - resp, err = m.dispatchNewListAddressesAtResourceGroupLevelPager(req) - case "ManagementClient.NewListAddressesAtSubscriptionLevelPager": - resp, err = m.dispatchNewListAddressesAtSubscriptionLevelPager(req) - case "ManagementClient.NewListConfigurationsPager": - resp, err = m.dispatchNewListConfigurationsPager(req) - case "ManagementClient.NewListOperationsPager": - resp, err = m.dispatchNewListOperationsPager(req) - case "ManagementClient.NewListOrderAtResourceGroupLevelPager": - resp, err = m.dispatchNewListOrderAtResourceGroupLevelPager(req) - case "ManagementClient.NewListOrderAtSubscriptionLevelPager": - resp, err = m.dispatchNewListOrderAtSubscriptionLevelPager(req) - case "ManagementClient.NewListOrderItemsAtResourceGroupLevelPager": - resp, err = m.dispatchNewListOrderItemsAtResourceGroupLevelPager(req) - case "ManagementClient.NewListOrderItemsAtSubscriptionLevelPager": - resp, err = m.dispatchNewListOrderItemsAtSubscriptionLevelPager(req) - case "ManagementClient.NewListProductFamiliesPager": - resp, err = m.dispatchNewListProductFamiliesPager(req) - case "ManagementClient.NewListProductFamiliesMetadataPager": - resp, err = m.dispatchNewListProductFamiliesMetadataPager(req) - case "ManagementClient.BeginReturnOrderItem": - resp, err = m.dispatchBeginReturnOrderItem(req) - case "ManagementClient.BeginUpdateAddress": - resp, err = m.dispatchBeginUpdateAddress(req) - case "ManagementClient.BeginUpdateOrderItem": - resp, err = m.dispatchBeginUpdateOrderItem(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *ManagementServerTransport) dispatchCancelOrderItem(req *http.Request) (*http.Response, error) { - if m.srv.CancelOrderItem == nil { - return nil, &nonRetriableError{errors.New("fake for method CancelOrderItem not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cancel` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armedgeorder.CancellationReason](req) - if err != nil { - return nil, err - } - orderItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderItemName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.CancelOrderItem(req.Context(), orderItemNameParam, resourceGroupNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchBeginCreateAddress(req *http.Request) (*http.Response, error) { - if m.srv.BeginCreateAddress == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateAddress not implemented")} - } - beginCreateAddress := m.beginCreateAddress.get(req) - if beginCreateAddress == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/addresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armedgeorder.AddressResource](req) - if err != nil { - return nil, err - } - addressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("addressName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.BeginCreateAddress(req.Context(), addressNameParam, resourceGroupNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateAddress = &respr - m.beginCreateAddress.add(req, beginCreateAddress) - } - - resp, err := server.PollerResponderNext(beginCreateAddress, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - m.beginCreateAddress.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreateAddress) { - m.beginCreateAddress.remove(req) - } - - return resp, nil -} - -func (m *ManagementServerTransport) dispatchBeginCreateOrderItem(req *http.Request) (*http.Response, error) { - if m.srv.BeginCreateOrderItem == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrderItem not implemented")} - } - beginCreateOrderItem := m.beginCreateOrderItem.get(req) - if beginCreateOrderItem == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armedgeorder.OrderItemResource](req) - if err != nil { - return nil, err - } - orderItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderItemName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.BeginCreateOrderItem(req.Context(), orderItemNameParam, resourceGroupNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrderItem = &respr - m.beginCreateOrderItem.add(req, beginCreateOrderItem) - } - - resp, err := server.PollerResponderNext(beginCreateOrderItem, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - m.beginCreateOrderItem.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreateOrderItem) { - m.beginCreateOrderItem.remove(req) - } - - return resp, nil -} - -func (m *ManagementServerTransport) dispatchBeginDeleteAddressByName(req *http.Request) (*http.Response, error) { - if m.srv.BeginDeleteAddressByName == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDeleteAddressByName not implemented")} - } - beginDeleteAddressByName := m.beginDeleteAddressByName.get(req) - if beginDeleteAddressByName == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/addresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - addressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("addressName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.BeginDeleteAddressByName(req.Context(), addressNameParam, resourceGroupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDeleteAddressByName = &respr - m.beginDeleteAddressByName.add(req, beginDeleteAddressByName) - } - - resp, err := server.PollerResponderNext(beginDeleteAddressByName, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - m.beginDeleteAddressByName.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDeleteAddressByName) { - m.beginDeleteAddressByName.remove(req) - } - - return resp, nil -} - -func (m *ManagementServerTransport) dispatchBeginDeleteOrderItemByName(req *http.Request) (*http.Response, error) { - if m.srv.BeginDeleteOrderItemByName == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDeleteOrderItemByName not implemented")} - } - beginDeleteOrderItemByName := m.beginDeleteOrderItemByName.get(req) - if beginDeleteOrderItemByName == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - orderItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderItemName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.BeginDeleteOrderItemByName(req.Context(), orderItemNameParam, resourceGroupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDeleteOrderItemByName = &respr - m.beginDeleteOrderItemByName.add(req, beginDeleteOrderItemByName) - } - - resp, err := server.PollerResponderNext(beginDeleteOrderItemByName, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - m.beginDeleteOrderItemByName.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDeleteOrderItemByName) { - m.beginDeleteOrderItemByName.remove(req) - } - - return resp, nil -} - -func (m *ManagementServerTransport) dispatchGetAddressByName(req *http.Request) (*http.Response, error) { - if m.srv.GetAddressByName == nil { - return nil, &nonRetriableError{errors.New("fake for method GetAddressByName not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/addresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - addressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("addressName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.GetAddressByName(req.Context(), addressNameParam, resourceGroupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AddressResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchGetOrderByName(req *http.Request) (*http.Response, error) { - if m.srv.GetOrderByName == nil { - return nil, &nonRetriableError{errors.New("fake for method GetOrderByName not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/orders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - orderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.GetOrderByName(req.Context(), orderNameParam, resourceGroupNameParam, locationParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OrderResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchGetOrderItemByName(req *http.Request) (*http.Response, error) { - if m.srv.GetOrderItemByName == nil { - return nil, &nonRetriableError{errors.New("fake for method GetOrderItemByName not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - orderItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderItemName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(expandUnescaped) - var options *armedgeorder.ManagementClientGetOrderItemByNameOptions - if expandParam != nil { - options = &armedgeorder.ManagementClientGetOrderItemByNameOptions{ - Expand: expandParam, - } - } - respr, errRespr := m.srv.GetOrderItemByName(req.Context(), orderItemNameParam, resourceGroupNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OrderItemResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchNewListAddressesAtResourceGroupLevelPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListAddressesAtResourceGroupLevelPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListAddressesAtResourceGroupLevelPager not implemented")} - } - newListAddressesAtResourceGroupLevelPager := m.newListAddressesAtResourceGroupLevelPager.get(req) - if newListAddressesAtResourceGroupLevelPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/addresses` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armedgeorder.ManagementClientListAddressesAtResourceGroupLevelOptions - if filterParam != nil || skipTokenParam != nil { - options = &armedgeorder.ManagementClientListAddressesAtResourceGroupLevelOptions{ - Filter: filterParam, - SkipToken: skipTokenParam, - } - } - resp := m.srv.NewListAddressesAtResourceGroupLevelPager(resourceGroupNameParam, options) - newListAddressesAtResourceGroupLevelPager = &resp - m.newListAddressesAtResourceGroupLevelPager.add(req, newListAddressesAtResourceGroupLevelPager) - server.PagerResponderInjectNextLinks(newListAddressesAtResourceGroupLevelPager, req, func(page *armedgeorder.ManagementClientListAddressesAtResourceGroupLevelResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListAddressesAtResourceGroupLevelPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListAddressesAtResourceGroupLevelPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListAddressesAtResourceGroupLevelPager) { - m.newListAddressesAtResourceGroupLevelPager.remove(req) - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchNewListAddressesAtSubscriptionLevelPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListAddressesAtSubscriptionLevelPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListAddressesAtSubscriptionLevelPager not implemented")} - } - newListAddressesAtSubscriptionLevelPager := m.newListAddressesAtSubscriptionLevelPager.get(req) - if newListAddressesAtSubscriptionLevelPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/addresses` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armedgeorder.ManagementClientListAddressesAtSubscriptionLevelOptions - if filterParam != nil || skipTokenParam != nil { - options = &armedgeorder.ManagementClientListAddressesAtSubscriptionLevelOptions{ - Filter: filterParam, - SkipToken: skipTokenParam, - } - } - resp := m.srv.NewListAddressesAtSubscriptionLevelPager(options) - newListAddressesAtSubscriptionLevelPager = &resp - m.newListAddressesAtSubscriptionLevelPager.add(req, newListAddressesAtSubscriptionLevelPager) - server.PagerResponderInjectNextLinks(newListAddressesAtSubscriptionLevelPager, req, func(page *armedgeorder.ManagementClientListAddressesAtSubscriptionLevelResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListAddressesAtSubscriptionLevelPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListAddressesAtSubscriptionLevelPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListAddressesAtSubscriptionLevelPager) { - m.newListAddressesAtSubscriptionLevelPager.remove(req) - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchNewListConfigurationsPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListConfigurationsPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListConfigurationsPager not implemented")} - } - newListConfigurationsPager := m.newListConfigurationsPager.get(req) - if newListConfigurationsPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/listConfigurations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - body, err := server.UnmarshalRequestAsJSON[armedgeorder.ConfigurationsRequest](req) - if err != nil { - return nil, err - } - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armedgeorder.ManagementClientListConfigurationsOptions - if skipTokenParam != nil { - options = &armedgeorder.ManagementClientListConfigurationsOptions{ - SkipToken: skipTokenParam, - } - } - resp := m.srv.NewListConfigurationsPager(body, options) - newListConfigurationsPager = &resp - m.newListConfigurationsPager.add(req, newListConfigurationsPager) - server.PagerResponderInjectNextLinks(newListConfigurationsPager, req, func(page *armedgeorder.ManagementClientListConfigurationsResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListConfigurationsPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListConfigurationsPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListConfigurationsPager) { - m.newListConfigurationsPager.remove(req) - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchNewListOperationsPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListOperationsPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListOperationsPager not implemented")} - } - newListOperationsPager := m.newListOperationsPager.get(req) - if newListOperationsPager == nil { - resp := m.srv.NewListOperationsPager(nil) - newListOperationsPager = &resp - m.newListOperationsPager.add(req, newListOperationsPager) - server.PagerResponderInjectNextLinks(newListOperationsPager, req, func(page *armedgeorder.ManagementClientListOperationsResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListOperationsPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListOperationsPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListOperationsPager) { - m.newListOperationsPager.remove(req) - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchNewListOrderAtResourceGroupLevelPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListOrderAtResourceGroupLevelPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListOrderAtResourceGroupLevelPager not implemented")} - } - newListOrderAtResourceGroupLevelPager := m.newListOrderAtResourceGroupLevelPager.get(req) - if newListOrderAtResourceGroupLevelPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orders` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armedgeorder.ManagementClientListOrderAtResourceGroupLevelOptions - if skipTokenParam != nil { - options = &armedgeorder.ManagementClientListOrderAtResourceGroupLevelOptions{ - SkipToken: skipTokenParam, - } - } - resp := m.srv.NewListOrderAtResourceGroupLevelPager(resourceGroupNameParam, options) - newListOrderAtResourceGroupLevelPager = &resp - m.newListOrderAtResourceGroupLevelPager.add(req, newListOrderAtResourceGroupLevelPager) - server.PagerResponderInjectNextLinks(newListOrderAtResourceGroupLevelPager, req, func(page *armedgeorder.ManagementClientListOrderAtResourceGroupLevelResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListOrderAtResourceGroupLevelPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListOrderAtResourceGroupLevelPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListOrderAtResourceGroupLevelPager) { - m.newListOrderAtResourceGroupLevelPager.remove(req) - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchNewListOrderAtSubscriptionLevelPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListOrderAtSubscriptionLevelPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListOrderAtSubscriptionLevelPager not implemented")} - } - newListOrderAtSubscriptionLevelPager := m.newListOrderAtSubscriptionLevelPager.get(req) - if newListOrderAtSubscriptionLevelPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orders` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armedgeorder.ManagementClientListOrderAtSubscriptionLevelOptions - if skipTokenParam != nil { - options = &armedgeorder.ManagementClientListOrderAtSubscriptionLevelOptions{ - SkipToken: skipTokenParam, - } - } - resp := m.srv.NewListOrderAtSubscriptionLevelPager(options) - newListOrderAtSubscriptionLevelPager = &resp - m.newListOrderAtSubscriptionLevelPager.add(req, newListOrderAtSubscriptionLevelPager) - server.PagerResponderInjectNextLinks(newListOrderAtSubscriptionLevelPager, req, func(page *armedgeorder.ManagementClientListOrderAtSubscriptionLevelResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListOrderAtSubscriptionLevelPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListOrderAtSubscriptionLevelPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListOrderAtSubscriptionLevelPager) { - m.newListOrderAtSubscriptionLevelPager.remove(req) - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchNewListOrderItemsAtResourceGroupLevelPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListOrderItemsAtResourceGroupLevelPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListOrderItemsAtResourceGroupLevelPager not implemented")} - } - newListOrderItemsAtResourceGroupLevelPager := m.newListOrderItemsAtResourceGroupLevelPager.get(req) - if newListOrderItemsAtResourceGroupLevelPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(expandUnescaped) - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armedgeorder.ManagementClientListOrderItemsAtResourceGroupLevelOptions - if filterParam != nil || expandParam != nil || skipTokenParam != nil { - options = &armedgeorder.ManagementClientListOrderItemsAtResourceGroupLevelOptions{ - Filter: filterParam, - Expand: expandParam, - SkipToken: skipTokenParam, - } - } - resp := m.srv.NewListOrderItemsAtResourceGroupLevelPager(resourceGroupNameParam, options) - newListOrderItemsAtResourceGroupLevelPager = &resp - m.newListOrderItemsAtResourceGroupLevelPager.add(req, newListOrderItemsAtResourceGroupLevelPager) - server.PagerResponderInjectNextLinks(newListOrderItemsAtResourceGroupLevelPager, req, func(page *armedgeorder.ManagementClientListOrderItemsAtResourceGroupLevelResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListOrderItemsAtResourceGroupLevelPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListOrderItemsAtResourceGroupLevelPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListOrderItemsAtResourceGroupLevelPager) { - m.newListOrderItemsAtResourceGroupLevelPager.remove(req) - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchNewListOrderItemsAtSubscriptionLevelPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListOrderItemsAtSubscriptionLevelPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListOrderItemsAtSubscriptionLevelPager not implemented")} - } - newListOrderItemsAtSubscriptionLevelPager := m.newListOrderItemsAtSubscriptionLevelPager.get(req) - if newListOrderItemsAtSubscriptionLevelPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(expandUnescaped) - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armedgeorder.ManagementClientListOrderItemsAtSubscriptionLevelOptions - if filterParam != nil || expandParam != nil || skipTokenParam != nil { - options = &armedgeorder.ManagementClientListOrderItemsAtSubscriptionLevelOptions{ - Filter: filterParam, - Expand: expandParam, - SkipToken: skipTokenParam, - } - } - resp := m.srv.NewListOrderItemsAtSubscriptionLevelPager(options) - newListOrderItemsAtSubscriptionLevelPager = &resp - m.newListOrderItemsAtSubscriptionLevelPager.add(req, newListOrderItemsAtSubscriptionLevelPager) - server.PagerResponderInjectNextLinks(newListOrderItemsAtSubscriptionLevelPager, req, func(page *armedgeorder.ManagementClientListOrderItemsAtSubscriptionLevelResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListOrderItemsAtSubscriptionLevelPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListOrderItemsAtSubscriptionLevelPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListOrderItemsAtSubscriptionLevelPager) { - m.newListOrderItemsAtSubscriptionLevelPager.remove(req) - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchNewListProductFamiliesPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListProductFamiliesPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListProductFamiliesPager not implemented")} - } - newListProductFamiliesPager := m.newListProductFamiliesPager.get(req) - if newListProductFamiliesPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/listProductFamilies` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - body, err := server.UnmarshalRequestAsJSON[armedgeorder.ProductFamiliesRequest](req) - if err != nil { - return nil, err - } - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(expandUnescaped) - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armedgeorder.ManagementClientListProductFamiliesOptions - if expandParam != nil || skipTokenParam != nil { - options = &armedgeorder.ManagementClientListProductFamiliesOptions{ - Expand: expandParam, - SkipToken: skipTokenParam, - } - } - resp := m.srv.NewListProductFamiliesPager(body, options) - newListProductFamiliesPager = &resp - m.newListProductFamiliesPager.add(req, newListProductFamiliesPager) - server.PagerResponderInjectNextLinks(newListProductFamiliesPager, req, func(page *armedgeorder.ManagementClientListProductFamiliesResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListProductFamiliesPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListProductFamiliesPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListProductFamiliesPager) { - m.newListProductFamiliesPager.remove(req) - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchNewListProductFamiliesMetadataPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListProductFamiliesMetadataPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListProductFamiliesMetadataPager not implemented")} - } - newListProductFamiliesMetadataPager := m.newListProductFamiliesMetadataPager.get(req) - if newListProductFamiliesMetadataPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/productFamiliesMetadata` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armedgeorder.ManagementClientListProductFamiliesMetadataOptions - if skipTokenParam != nil { - options = &armedgeorder.ManagementClientListProductFamiliesMetadataOptions{ - SkipToken: skipTokenParam, - } - } - resp := m.srv.NewListProductFamiliesMetadataPager(options) - newListProductFamiliesMetadataPager = &resp - m.newListProductFamiliesMetadataPager.add(req, newListProductFamiliesMetadataPager) - server.PagerResponderInjectNextLinks(newListProductFamiliesMetadataPager, req, func(page *armedgeorder.ManagementClientListProductFamiliesMetadataResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListProductFamiliesMetadataPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListProductFamiliesMetadataPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListProductFamiliesMetadataPager) { - m.newListProductFamiliesMetadataPager.remove(req) - } - return resp, nil -} - -func (m *ManagementServerTransport) dispatchBeginReturnOrderItem(req *http.Request) (*http.Response, error) { - if m.srv.BeginReturnOrderItem == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginReturnOrderItem not implemented")} - } - beginReturnOrderItem := m.beginReturnOrderItem.get(req) - if beginReturnOrderItem == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/return` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armedgeorder.ReturnOrderItemDetails](req) - if err != nil { - return nil, err - } - orderItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderItemName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.BeginReturnOrderItem(req.Context(), orderItemNameParam, resourceGroupNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginReturnOrderItem = &respr - m.beginReturnOrderItem.add(req, beginReturnOrderItem) - } - - resp, err := server.PollerResponderNext(beginReturnOrderItem, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - m.beginReturnOrderItem.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginReturnOrderItem) { - m.beginReturnOrderItem.remove(req) - } - - return resp, nil -} - -func (m *ManagementServerTransport) dispatchBeginUpdateAddress(req *http.Request) (*http.Response, error) { - if m.srv.BeginUpdateAddress == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdateAddress not implemented")} - } - beginUpdateAddress := m.beginUpdateAddress.get(req) - if beginUpdateAddress == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/addresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armedgeorder.AddressUpdateParameter](req) - if err != nil { - return nil, err - } - addressNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("addressName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) - var options *armedgeorder.ManagementClientBeginUpdateAddressOptions - if ifMatchParam != nil { - options = &armedgeorder.ManagementClientBeginUpdateAddressOptions{ - IfMatch: ifMatchParam, - } - } - respr, errRespr := m.srv.BeginUpdateAddress(req.Context(), addressNameParam, resourceGroupNameParam, body, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdateAddress = &respr - m.beginUpdateAddress.add(req, beginUpdateAddress) - } - - resp, err := server.PollerResponderNext(beginUpdateAddress, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - m.beginUpdateAddress.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdateAddress) { - m.beginUpdateAddress.remove(req) - } - - return resp, nil -} - -func (m *ManagementServerTransport) dispatchBeginUpdateOrderItem(req *http.Request) (*http.Response, error) { - if m.srv.BeginUpdateOrderItem == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdateOrderItem not implemented")} - } - beginUpdateOrderItem := m.beginUpdateOrderItem.get(req) - if beginUpdateOrderItem == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armedgeorder.OrderItemUpdateParameter](req) - if err != nil { - return nil, err - } - orderItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderItemName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) - var options *armedgeorder.ManagementClientBeginUpdateOrderItemOptions - if ifMatchParam != nil { - options = &armedgeorder.ManagementClientBeginUpdateOrderItemOptions{ - IfMatch: ifMatchParam, - } - } - respr, errRespr := m.srv.BeginUpdateOrderItem(req.Context(), orderItemNameParam, resourceGroupNameParam, body, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdateOrderItem = &respr - m.beginUpdateOrderItem.add(req, beginUpdateOrderItem) - } - - resp, err := server.PollerResponderNext(beginUpdateOrderItem, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - m.beginUpdateOrderItem.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdateOrderItem) { - m.beginUpdateOrderItem.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/fake/operations_server.go b/sdk/resourcemanager/edgeorder/armedgeorder/fake/operations_server.go new file mode 100644 index 000000000000..91321db6bce0 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/fake/operations_server.go @@ -0,0 +1,117 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder/v2" + "net/http" +) + +// OperationsServer is a fake server for instances of the armedgeorder.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armedgeorder.OperationsClientListOptions) (resp azfake.PagerResponder[armedgeorder.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armedgeorder.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armedgeorder.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armedgeorder.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armedgeorder.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armedgeorder.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/fake/orderitemresources_server.go b/sdk/resourcemanager/edgeorder/armedgeorder/fake/orderitemresources_server.go new file mode 100644 index 000000000000..5a3f6bcf433a --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/fake/orderitemresources_server.go @@ -0,0 +1,571 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// OrderItemResourcesServer is a fake server for instances of the armedgeorder.OrderItemResourcesClient type. +type OrderItemResourcesServer struct { + // Cancel is the fake for method OrderItemResourcesClient.Cancel + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Cancel func(ctx context.Context, resourceGroupName string, orderItemName string, cancellationReason armedgeorder.CancellationReason, options *armedgeorder.OrderItemResourcesClientCancelOptions) (resp azfake.Responder[armedgeorder.OrderItemResourcesClientCancelResponse], errResp azfake.ErrorResponder) + + // BeginCreate is the fake for method OrderItemResourcesClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginCreate func(ctx context.Context, resourceGroupName string, orderItemName string, orderItemResource armedgeorder.OrderItemResource, options *armedgeorder.OrderItemResourcesClientBeginCreateOptions) (resp azfake.PollerResponder[armedgeorder.OrderItemResourcesClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method OrderItemResourcesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, orderItemName string, options *armedgeorder.OrderItemResourcesClientBeginDeleteOptions) (resp azfake.PollerResponder[armedgeorder.OrderItemResourcesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method OrderItemResourcesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, orderItemName string, options *armedgeorder.OrderItemResourcesClientGetOptions) (resp azfake.Responder[armedgeorder.OrderItemResourcesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method OrderItemResourcesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armedgeorder.OrderItemResourcesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armedgeorder.OrderItemResourcesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method OrderItemResourcesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armedgeorder.OrderItemResourcesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armedgeorder.OrderItemResourcesClientListBySubscriptionResponse]) + + // BeginReturnOrderItem is the fake for method OrderItemResourcesClient.BeginReturnOrderItem + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginReturnOrderItem func(ctx context.Context, resourceGroupName string, orderItemName string, returnOrderItemDetails armedgeorder.ReturnOrderItemDetails, options *armedgeorder.OrderItemResourcesClientBeginReturnOrderItemOptions) (resp azfake.PollerResponder[armedgeorder.OrderItemResourcesClientReturnOrderItemResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method OrderItemResourcesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, orderItemName string, orderItemUpdateParameter armedgeorder.OrderItemUpdateParameter, options *armedgeorder.OrderItemResourcesClientBeginUpdateOptions) (resp azfake.PollerResponder[armedgeorder.OrderItemResourcesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewOrderItemResourcesServerTransport creates a new instance of OrderItemResourcesServerTransport with the provided implementation. +// The returned OrderItemResourcesServerTransport instance is connected to an instance of armedgeorder.OrderItemResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOrderItemResourcesServerTransport(srv *OrderItemResourcesServer) *OrderItemResourcesServerTransport { + return &OrderItemResourcesServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armedgeorder.OrderItemResourcesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armedgeorder.OrderItemResourcesClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armedgeorder.OrderItemResourcesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armedgeorder.OrderItemResourcesClientListBySubscriptionResponse]](), + beginReturnOrderItem: newTracker[azfake.PollerResponder[armedgeorder.OrderItemResourcesClientReturnOrderItemResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armedgeorder.OrderItemResourcesClientUpdateResponse]](), + } +} + +// OrderItemResourcesServerTransport connects instances of armedgeorder.OrderItemResourcesClient to instances of OrderItemResourcesServer. +// Don't use this type directly, use NewOrderItemResourcesServerTransport instead. +type OrderItemResourcesServerTransport struct { + srv *OrderItemResourcesServer + beginCreate *tracker[azfake.PollerResponder[armedgeorder.OrderItemResourcesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armedgeorder.OrderItemResourcesClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armedgeorder.OrderItemResourcesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armedgeorder.OrderItemResourcesClientListBySubscriptionResponse]] + beginReturnOrderItem *tracker[azfake.PollerResponder[armedgeorder.OrderItemResourcesClientReturnOrderItemResponse]] + beginUpdate *tracker[azfake.PollerResponder[armedgeorder.OrderItemResourcesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for OrderItemResourcesServerTransport. +func (o *OrderItemResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OrderItemResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if orderItemResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = orderItemResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OrderItemResourcesClient.Cancel": + res.resp, res.err = o.dispatchCancel(req) + case "OrderItemResourcesClient.BeginCreate": + res.resp, res.err = o.dispatchBeginCreate(req) + case "OrderItemResourcesClient.BeginDelete": + res.resp, res.err = o.dispatchBeginDelete(req) + case "OrderItemResourcesClient.Get": + res.resp, res.err = o.dispatchGet(req) + case "OrderItemResourcesClient.NewListByResourceGroupPager": + res.resp, res.err = o.dispatchNewListByResourceGroupPager(req) + case "OrderItemResourcesClient.NewListBySubscriptionPager": + res.resp, res.err = o.dispatchNewListBySubscriptionPager(req) + case "OrderItemResourcesClient.BeginReturnOrderItem": + res.resp, res.err = o.dispatchBeginReturnOrderItem(req) + case "OrderItemResourcesClient.BeginUpdate": + res.resp, res.err = o.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OrderItemResourcesServerTransport) dispatchCancel(req *http.Request) (*http.Response, error) { + if o.srv.Cancel == nil { + return nil, &nonRetriableError{errors.New("fake for method Cancel not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cancel` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armedgeorder.CancellationReason](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + orderItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderItemName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.Cancel(req.Context(), resourceGroupNameParam, orderItemNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (o *OrderItemResourcesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if o.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := o.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armedgeorder.OrderItemResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + orderItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderItemName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginCreate(req.Context(), resourceGroupNameParam, orderItemNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + o.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + o.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + o.beginCreate.remove(req) + } + + return resp, nil +} + +func (o *OrderItemResourcesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if o.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := o.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + orderItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderItemName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginDelete(req.Context(), resourceGroupNameParam, orderItemNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + o.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + o.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + o.beginDelete.remove(req) + } + + return resp, nil +} + +func (o *OrderItemResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if o.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + orderItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderItemName")]) + if err != nil { + return nil, err + } + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armedgeorder.OrderItemResourcesClientGetOptions + if expandParam != nil { + options = &armedgeorder.OrderItemResourcesClientGetOptions{ + Expand: expandParam, + } + } + respr, errRespr := o.srv.Get(req.Context(), resourceGroupNameParam, orderItemNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OrderItemResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (o *OrderItemResourcesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := o.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armedgeorder.OrderItemResourcesClientListByResourceGroupOptions + if filterParam != nil || expandParam != nil || skipTokenParam != nil || topParam != nil { + options = &armedgeorder.OrderItemResourcesClientListByResourceGroupOptions{ + Filter: filterParam, + Expand: expandParam, + SkipToken: skipTokenParam, + Top: topParam, + } + } + resp := o.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) + newListByResourceGroupPager = &resp + o.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armedgeorder.OrderItemResourcesClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + o.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (o *OrderItemResourcesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := o.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armedgeorder.OrderItemResourcesClientListBySubscriptionOptions + if filterParam != nil || expandParam != nil || skipTokenParam != nil || topParam != nil { + options = &armedgeorder.OrderItemResourcesClientListBySubscriptionOptions{ + Filter: filterParam, + Expand: expandParam, + SkipToken: skipTokenParam, + Top: topParam, + } + } + resp := o.srv.NewListBySubscriptionPager(options) + newListBySubscriptionPager = &resp + o.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armedgeorder.OrderItemResourcesClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + o.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (o *OrderItemResourcesServerTransport) dispatchBeginReturnOrderItem(req *http.Request) (*http.Response, error) { + if o.srv.BeginReturnOrderItem == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginReturnOrderItem not implemented")} + } + beginReturnOrderItem := o.beginReturnOrderItem.get(req) + if beginReturnOrderItem == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/return` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armedgeorder.ReturnOrderItemDetails](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + orderItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderItemName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginReturnOrderItem(req.Context(), resourceGroupNameParam, orderItemNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginReturnOrderItem = &respr + o.beginReturnOrderItem.add(req, beginReturnOrderItem) + } + + resp, err := server.PollerResponderNext(beginReturnOrderItem, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + o.beginReturnOrderItem.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginReturnOrderItem) { + o.beginReturnOrderItem.remove(req) + } + + return resp, nil +} + +func (o *OrderItemResourcesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if o.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := o.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orderItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armedgeorder.OrderItemUpdateParameter](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + orderItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderItemName")]) + if err != nil { + return nil, err + } + ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) + var options *armedgeorder.OrderItemResourcesClientBeginUpdateOptions + if ifMatchParam != nil { + options = &armedgeorder.OrderItemResourcesClientBeginUpdateOptions{ + IfMatch: ifMatchParam, + } + } + respr, errRespr := o.srv.BeginUpdate(req.Context(), resourceGroupNameParam, orderItemNameParam, body, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + o.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + o.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + o.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to OrderItemResourcesServerTransport +var orderItemResourcesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/fake/orderresources_server.go b/sdk/resourcemanager/edgeorder/armedgeorder/fake/orderresources_server.go new file mode 100644 index 000000000000..979202300523 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/fake/orderresources_server.go @@ -0,0 +1,125 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder/v2" + "net/http" + "net/url" + "regexp" +) + +// OrderResourcesServer is a fake server for instances of the armedgeorder.OrderResourcesClient type. +type OrderResourcesServer struct { + // Get is the fake for method OrderResourcesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, location string, orderName string, options *armedgeorder.OrderResourcesClientGetOptions) (resp azfake.Responder[armedgeorder.OrderResourcesClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewOrderResourcesServerTransport creates a new instance of OrderResourcesServerTransport with the provided implementation. +// The returned OrderResourcesServerTransport instance is connected to an instance of armedgeorder.OrderResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOrderResourcesServerTransport(srv *OrderResourcesServer) *OrderResourcesServerTransport { + return &OrderResourcesServerTransport{srv: srv} +} + +// OrderResourcesServerTransport connects instances of armedgeorder.OrderResourcesClient to instances of OrderResourcesServer. +// Don't use this type directly, use NewOrderResourcesServerTransport instead. +type OrderResourcesServerTransport struct { + srv *OrderResourcesServer +} + +// Do implements the policy.Transporter interface for OrderResourcesServerTransport. +func (o *OrderResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OrderResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if orderResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = orderResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OrderResourcesClient.Get": + res.resp, res.err = o.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OrderResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if o.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/orders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + orderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orderName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.Get(req.Context(), resourceGroupNameParam, locationParam, orderNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OrderResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OrderResourcesServerTransport +var orderResourcesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/fake/ordersoperationgroup_server.go b/sdk/resourcemanager/edgeorder/armedgeorder/fake/ordersoperationgroup_server.go new file mode 100644 index 000000000000..5475c980ffbd --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/fake/ordersoperationgroup_server.go @@ -0,0 +1,225 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// OrdersOperationGroupServer is a fake server for instances of the armedgeorder.OrdersOperationGroupClient type. +type OrdersOperationGroupServer struct { + // NewListByResourceGroupPager is the fake for method OrdersOperationGroupClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armedgeorder.OrdersOperationGroupClientListByResourceGroupOptions) (resp azfake.PagerResponder[armedgeorder.OrdersOperationGroupClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method OrdersOperationGroupClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armedgeorder.OrdersOperationGroupClientListBySubscriptionOptions) (resp azfake.PagerResponder[armedgeorder.OrdersOperationGroupClientListBySubscriptionResponse]) +} + +// NewOrdersOperationGroupServerTransport creates a new instance of OrdersOperationGroupServerTransport with the provided implementation. +// The returned OrdersOperationGroupServerTransport instance is connected to an instance of armedgeorder.OrdersOperationGroupClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOrdersOperationGroupServerTransport(srv *OrdersOperationGroupServer) *OrdersOperationGroupServerTransport { + return &OrdersOperationGroupServerTransport{ + srv: srv, + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armedgeorder.OrdersOperationGroupClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armedgeorder.OrdersOperationGroupClientListBySubscriptionResponse]](), + } +} + +// OrdersOperationGroupServerTransport connects instances of armedgeorder.OrdersOperationGroupClient to instances of OrdersOperationGroupServer. +// Don't use this type directly, use NewOrdersOperationGroupServerTransport instead. +type OrdersOperationGroupServerTransport struct { + srv *OrdersOperationGroupServer + newListByResourceGroupPager *tracker[azfake.PagerResponder[armedgeorder.OrdersOperationGroupClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armedgeorder.OrdersOperationGroupClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for OrdersOperationGroupServerTransport. +func (o *OrdersOperationGroupServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OrdersOperationGroupServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if ordersOperationGroupServerTransportInterceptor != nil { + res.resp, res.err, intercepted = ordersOperationGroupServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OrdersOperationGroupClient.NewListByResourceGroupPager": + res.resp, res.err = o.dispatchNewListByResourceGroupPager(req) + case "OrdersOperationGroupClient.NewListBySubscriptionPager": + res.resp, res.err = o.dispatchNewListBySubscriptionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OrdersOperationGroupServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := o.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orders` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armedgeorder.OrdersOperationGroupClientListByResourceGroupOptions + if skipTokenParam != nil || topParam != nil { + options = &armedgeorder.OrdersOperationGroupClientListByResourceGroupOptions{ + SkipToken: skipTokenParam, + Top: topParam, + } + } + resp := o.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) + newListByResourceGroupPager = &resp + o.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armedgeorder.OrdersOperationGroupClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + o.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (o *OrdersOperationGroupServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := o.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/orders` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armedgeorder.OrdersOperationGroupClientListBySubscriptionOptions + if skipTokenParam != nil || topParam != nil { + options = &armedgeorder.OrdersOperationGroupClientListBySubscriptionOptions{ + SkipToken: skipTokenParam, + Top: topParam, + } + } + resp := o.srv.NewListBySubscriptionPager(options) + newListBySubscriptionPager = &resp + o.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armedgeorder.OrdersOperationGroupClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + o.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OrdersOperationGroupServerTransport +var ordersOperationGroupServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/fake/productsandconfigurationsoperationgroup_server.go b/sdk/resourcemanager/edgeorder/armedgeorder/fake/productsandconfigurationsoperationgroup_server.go new file mode 100644 index 000000000000..22c4f3dbd2be --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/fake/productsandconfigurationsoperationgroup_server.go @@ -0,0 +1,257 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder/v2" + "net/http" + "net/url" + "regexp" +) + +// ProductsAndConfigurationsOperationGroupServer is a fake server for instances of the armedgeorder.ProductsAndConfigurationsOperationGroupClient type. +type ProductsAndConfigurationsOperationGroupServer struct { + // NewListConfigurationsPager is the fake for method ProductsAndConfigurationsOperationGroupClient.NewListConfigurationsPager + // HTTP status codes to indicate success: http.StatusOK + NewListConfigurationsPager func(configurationsRequest armedgeorder.ConfigurationsRequest, options *armedgeorder.ProductsAndConfigurationsOperationGroupClientListConfigurationsOptions) (resp azfake.PagerResponder[armedgeorder.ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse]) + + // NewListProductFamiliesPager is the fake for method ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesPager + // HTTP status codes to indicate success: http.StatusOK + NewListProductFamiliesPager func(productFamiliesRequest armedgeorder.ProductFamiliesRequest, options *armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesOptions) (resp azfake.PagerResponder[armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse]) + + // NewListProductFamiliesMetadataPager is the fake for method ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesMetadataPager + // HTTP status codes to indicate success: http.StatusOK + NewListProductFamiliesMetadataPager func(options *armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataOptions) (resp azfake.PagerResponder[armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse]) +} + +// NewProductsAndConfigurationsOperationGroupServerTransport creates a new instance of ProductsAndConfigurationsOperationGroupServerTransport with the provided implementation. +// The returned ProductsAndConfigurationsOperationGroupServerTransport instance is connected to an instance of armedgeorder.ProductsAndConfigurationsOperationGroupClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProductsAndConfigurationsOperationGroupServerTransport(srv *ProductsAndConfigurationsOperationGroupServer) *ProductsAndConfigurationsOperationGroupServerTransport { + return &ProductsAndConfigurationsOperationGroupServerTransport{ + srv: srv, + newListConfigurationsPager: newTracker[azfake.PagerResponder[armedgeorder.ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse]](), + newListProductFamiliesPager: newTracker[azfake.PagerResponder[armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse]](), + newListProductFamiliesMetadataPager: newTracker[azfake.PagerResponder[armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse]](), + } +} + +// ProductsAndConfigurationsOperationGroupServerTransport connects instances of armedgeorder.ProductsAndConfigurationsOperationGroupClient to instances of ProductsAndConfigurationsOperationGroupServer. +// Don't use this type directly, use NewProductsAndConfigurationsOperationGroupServerTransport instead. +type ProductsAndConfigurationsOperationGroupServerTransport struct { + srv *ProductsAndConfigurationsOperationGroupServer + newListConfigurationsPager *tracker[azfake.PagerResponder[armedgeorder.ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse]] + newListProductFamiliesPager *tracker[azfake.PagerResponder[armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse]] + newListProductFamiliesMetadataPager *tracker[azfake.PagerResponder[armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse]] +} + +// Do implements the policy.Transporter interface for ProductsAndConfigurationsOperationGroupServerTransport. +func (p *ProductsAndConfigurationsOperationGroupServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *ProductsAndConfigurationsOperationGroupServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if productsAndConfigurationsOperationGroupServerTransportInterceptor != nil { + res.resp, res.err, intercepted = productsAndConfigurationsOperationGroupServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ProductsAndConfigurationsOperationGroupClient.NewListConfigurationsPager": + res.resp, res.err = p.dispatchNewListConfigurationsPager(req) + case "ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesPager": + res.resp, res.err = p.dispatchNewListProductFamiliesPager(req) + case "ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesMetadataPager": + res.resp, res.err = p.dispatchNewListProductFamiliesMetadataPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (p *ProductsAndConfigurationsOperationGroupServerTransport) dispatchNewListConfigurationsPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListConfigurationsPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListConfigurationsPager not implemented")} + } + newListConfigurationsPager := p.newListConfigurationsPager.get(req) + if newListConfigurationsPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/listConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + body, err := server.UnmarshalRequestAsJSON[armedgeorder.ConfigurationsRequest](req) + if err != nil { + return nil, err + } + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + var options *armedgeorder.ProductsAndConfigurationsOperationGroupClientListConfigurationsOptions + if skipTokenParam != nil { + options = &armedgeorder.ProductsAndConfigurationsOperationGroupClientListConfigurationsOptions{ + SkipToken: skipTokenParam, + } + } + resp := p.srv.NewListConfigurationsPager(body, options) + newListConfigurationsPager = &resp + p.newListConfigurationsPager.add(req, newListConfigurationsPager) + server.PagerResponderInjectNextLinks(newListConfigurationsPager, req, func(page *armedgeorder.ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListConfigurationsPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListConfigurationsPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListConfigurationsPager) { + p.newListConfigurationsPager.remove(req) + } + return resp, nil +} + +func (p *ProductsAndConfigurationsOperationGroupServerTransport) dispatchNewListProductFamiliesPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListProductFamiliesPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListProductFamiliesPager not implemented")} + } + newListProductFamiliesPager := p.newListProductFamiliesPager.get(req) + if newListProductFamiliesPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/listProductFamilies` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + body, err := server.UnmarshalRequestAsJSON[armedgeorder.ProductFamiliesRequest](req) + if err != nil { + return nil, err + } + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + var options *armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesOptions + if expandParam != nil || skipTokenParam != nil { + options = &armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesOptions{ + Expand: expandParam, + SkipToken: skipTokenParam, + } + } + resp := p.srv.NewListProductFamiliesPager(body, options) + newListProductFamiliesPager = &resp + p.newListProductFamiliesPager.add(req, newListProductFamiliesPager) + server.PagerResponderInjectNextLinks(newListProductFamiliesPager, req, func(page *armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListProductFamiliesPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListProductFamiliesPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListProductFamiliesPager) { + p.newListProductFamiliesPager.remove(req) + } + return resp, nil +} + +func (p *ProductsAndConfigurationsOperationGroupServerTransport) dispatchNewListProductFamiliesMetadataPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListProductFamiliesMetadataPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListProductFamiliesMetadataPager not implemented")} + } + newListProductFamiliesMetadataPager := p.newListProductFamiliesMetadataPager.get(req) + if newListProductFamiliesMetadataPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeOrder/productFamiliesMetadata` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + var options *armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataOptions + if skipTokenParam != nil { + options = &armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataOptions{ + SkipToken: skipTokenParam, + } + } + resp := p.srv.NewListProductFamiliesMetadataPager(options) + newListProductFamiliesMetadataPager = &resp + p.newListProductFamiliesMetadataPager.add(req, newListProductFamiliesMetadataPager) + server.PagerResponderInjectNextLinks(newListProductFamiliesMetadataPager, req, func(page *armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListProductFamiliesMetadataPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListProductFamiliesMetadataPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListProductFamiliesMetadataPager) { + p.newListProductFamiliesMetadataPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ProductsAndConfigurationsOperationGroupServerTransport +var productsAndConfigurationsOperationGroupServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/fake/server_factory.go b/sdk/resourcemanager/edgeorder/armedgeorder/fake/server_factory.go index 57620d3cc16e..6158f81709aa 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/fake/server_factory.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/fake/server_factory.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -19,7 +15,23 @@ import ( // ServerFactory is a fake server for instances of the armedgeorder.ClientFactory type. type ServerFactory struct { - ManagementServer ManagementServer + // AddressResourcesServer contains the fakes for client AddressResourcesClient + AddressResourcesServer AddressResourcesServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // OrderItemResourcesServer contains the fakes for client OrderItemResourcesClient + OrderItemResourcesServer OrderItemResourcesServer + + // OrderResourcesServer contains the fakes for client OrderResourcesClient + OrderResourcesServer OrderResourcesServer + + // OrdersOperationGroupServer contains the fakes for client OrdersOperationGroupClient + OrdersOperationGroupServer OrdersOperationGroupServer + + // ProductsAndConfigurationsOperationGroupServer contains the fakes for client ProductsAndConfigurationsOperationGroupClient + ProductsAndConfigurationsOperationGroupServer ProductsAndConfigurationsOperationGroupServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -34,9 +46,14 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armedgeorder.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trManagementServer *ManagementServerTransport + srv *ServerFactory + trMu sync.Mutex + trAddressResourcesServer *AddressResourcesServerTransport + trOperationsServer *OperationsServerTransport + trOrderItemResourcesServer *OrderItemResourcesServerTransport + trOrderResourcesServer *OrderResourcesServerTransport + trOrdersOperationGroupServer *OrdersOperationGroupServerTransport + trProductsAndConfigurationsOperationGroupServer *ProductsAndConfigurationsOperationGroupServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -52,9 +69,34 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "ManagementClient": - initServer(s, &s.trManagementServer, func() *ManagementServerTransport { return NewManagementServerTransport(&s.srv.ManagementServer) }) - resp, err = s.trManagementServer.Do(req) + case "AddressResourcesClient": + initServer(s, &s.trAddressResourcesServer, func() *AddressResourcesServerTransport { + return NewAddressResourcesServerTransport(&s.srv.AddressResourcesServer) + }) + resp, err = s.trAddressResourcesServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "OrderItemResourcesClient": + initServer(s, &s.trOrderItemResourcesServer, func() *OrderItemResourcesServerTransport { + return NewOrderItemResourcesServerTransport(&s.srv.OrderItemResourcesServer) + }) + resp, err = s.trOrderItemResourcesServer.Do(req) + case "OrderResourcesClient": + initServer(s, &s.trOrderResourcesServer, func() *OrderResourcesServerTransport { + return NewOrderResourcesServerTransport(&s.srv.OrderResourcesServer) + }) + resp, err = s.trOrderResourcesServer.Do(req) + case "OrdersOperationGroupClient": + initServer(s, &s.trOrdersOperationGroupServer, func() *OrdersOperationGroupServerTransport { + return NewOrdersOperationGroupServerTransport(&s.srv.OrdersOperationGroupServer) + }) + resp, err = s.trOrdersOperationGroupServer.Do(req) + case "ProductsAndConfigurationsOperationGroupClient": + initServer(s, &s.trProductsAndConfigurationsOperationGroupServer, func() *ProductsAndConfigurationsOperationGroupServerTransport { + return NewProductsAndConfigurationsOperationGroupServerTransport(&s.srv.ProductsAndConfigurationsOperationGroupServer) + }) + resp, err = s.trProductsAndConfigurationsOperationGroupServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/fake/time_rfc3339.go b/sdk/resourcemanager/edgeorder/armedgeorder/fake/time_rfc3339.go deleted file mode 100644 index b0535a7b63e6..000000000000 --- a/sdk/resourcemanager/edgeorder/armedgeorder/fake/time_rfc3339.go +++ /dev/null @@ -1,86 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) - -const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { - layout = dateTimeJSON - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { - layout = time.RFC3339Nano - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/go.mod b/sdk/resourcemanager/edgeorder/armedgeorder/go.mod index d613df6bcf4e..49ef5d901d43 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/go.mod +++ b/sdk/resourcemanager/edgeorder/armedgeorder/go.mod @@ -1,4 +1,4 @@ -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.23.0 diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/interfaces.go b/sdk/resourcemanager/edgeorder/armedgeorder/interfaces.go index 8d1cc2220b1b..176a4f5f86af 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/interfaces.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/interfaces.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armedgeorder diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/management_client.go b/sdk/resourcemanager/edgeorder/armedgeorder/management_client.go deleted file mode 100644 index 39fb916eb9fa..000000000000 --- a/sdk/resourcemanager/edgeorder/armedgeorder/management_client.go +++ /dev/null @@ -1,1488 +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. DO NOT EDIT. -// 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" - "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 { - internal *arm.Client - subscriptionID string -} - -// 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) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ManagementClient{ - subscriptionID: subscriptionID, - internal: cl, - } - 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) { - var err error - const operationName = "ManagementClient.CancelOrderItem" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.cancelOrderItemCreateRequest(ctx, orderItemName, resourceGroupName, cancellationReason, options) - if err != nil { - return ManagementClientCancelOrderItemResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ManagementClientCancelOrderItemResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ManagementClientCancelOrderItemResponse{}, err - } - 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.internal.Endpoint(), 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"} - if err := runtime.MarshalAsJSON(req, cancellationReason); err != nil { - return nil, err - } - return req, nil -} - -// 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 - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagementClientCreateAddressResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagementClientCreateAddressResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// 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) { - var err error - const operationName = "ManagementClient.BeginCreateAddress" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createAddressCreateRequest(ctx, addressName, resourceGroupName, addressResource, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// 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.internal.Endpoint(), 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"} - if err := runtime.MarshalAsJSON(req, addressResource); err != nil { - return nil, err - } - return req, nil -} - -// 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 - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagementClientCreateOrderItemResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagementClientCreateOrderItemResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// 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) { - var err error - const operationName = "ManagementClient.BeginCreateOrderItem" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrderItemCreateRequest(ctx, orderItemName, resourceGroupName, orderItemResource, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// 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.internal.Endpoint(), 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"} - if err := runtime.MarshalAsJSON(req, orderItemResource); err != nil { - return nil, err - } - return req, nil -} - -// 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 - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagementClientDeleteAddressByNameResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagementClientDeleteAddressByNameResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// 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) { - var err error - const operationName = "ManagementClient.BeginDeleteAddressByName" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteAddressByNameCreateRequest(ctx, addressName, resourceGroupName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, 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.internal.Endpoint(), 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 - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagementClientDeleteOrderItemByNameResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagementClientDeleteOrderItemByNameResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// 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) { - var err error - const operationName = "ManagementClient.BeginDeleteOrderItemByName" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteOrderItemByNameCreateRequest(ctx, orderItemName, resourceGroupName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, 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.internal.Endpoint(), 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) { - var err error - const operationName = "ManagementClient.GetAddressByName" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getAddressByNameCreateRequest(ctx, addressName, resourceGroupName, options) - if err != nil { - return ManagementClientGetAddressByNameResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ManagementClientGetAddressByNameResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ManagementClientGetAddressByNameResponse{}, err - } - resp, err := client.getAddressByNameHandleResponse(httpResp) - return resp, err -} - -// 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.internal.Endpoint(), 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) { - var err error - const operationName = "ManagementClient.GetOrderByName" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getOrderByNameCreateRequest(ctx, orderName, resourceGroupName, location, options) - if err != nil { - return ManagementClientGetOrderByNameResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ManagementClientGetOrderByNameResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ManagementClientGetOrderByNameResponse{}, err - } - resp, err := client.getOrderByNameHandleResponse(httpResp) - return resp, err -} - -// 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.internal.Endpoint(), 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) { - var err error - const operationName = "ManagementClient.GetOrderItemByName" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getOrderItemByNameCreateRequest(ctx, orderItemName, resourceGroupName, options) - if err != nil { - return ManagementClientGetOrderItemByNameResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ManagementClientGetOrderItemByNameResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ManagementClientGetOrderItemByNameResponse{}, err - } - resp, err := client.getOrderItemByNameHandleResponse(httpResp) - return resp, err -} - -// 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.internal.Endpoint(), 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. -// -// 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.NewListAddressesAtResourceGroupLevelPager -// 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) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.NewListAddressesAtResourceGroupLevelPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listAddressesAtResourceGroupLevelCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return ManagementClientListAddressesAtResourceGroupLevelResponse{}, err - } - return client.listAddressesAtResourceGroupLevelHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// 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.internal.Endpoint(), 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. -// -// Generated from API version 2021-12-01 -// - options - ManagementClientListAddressesAtSubscriptionLevelOptions contains the optional parameters for the ManagementClient.NewListAddressesAtSubscriptionLevelPager -// 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) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.NewListAddressesAtSubscriptionLevelPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listAddressesAtSubscriptionLevelCreateRequest(ctx, options) - }, nil) - if err != nil { - return ManagementClientListAddressesAtSubscriptionLevelResponse{}, err - } - return client.listAddressesAtSubscriptionLevelHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// 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.internal.Endpoint(), 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. -// -// Generated from API version 2021-12-01 -// - configurationsRequest - Filters for showing the configurations. -// - options - ManagementClientListConfigurationsOptions contains the optional parameters for the ManagementClient.NewListConfigurationsPager -// 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) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.NewListConfigurationsPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listConfigurationsCreateRequest(ctx, configurationsRequest, options) - }, nil) - if err != nil { - return ManagementClientListConfigurationsResponse{}, err - } - return client.listConfigurationsHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// 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.internal.Endpoint(), 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"} - if err := runtime.MarshalAsJSON(req, configurationsRequest); err != nil { - return nil, err - } - return req, nil -} - -// 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. -// -// Generated from API version 2021-12-01 -// - options - ManagementClientListOperationsOptions contains the optional parameters for the ManagementClient.NewListOperationsPager -// 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) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.NewListOperationsPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listOperationsCreateRequest(ctx, options) - }, nil) - if err != nil { - return ManagementClientListOperationsResponse{}, err - } - return client.listOperationsHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// 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.internal.Endpoint(), 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. -// -// 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.NewListOrderAtResourceGroupLevelPager -// 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) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.NewListOrderAtResourceGroupLevelPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listOrderAtResourceGroupLevelCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return ManagementClientListOrderAtResourceGroupLevelResponse{}, err - } - return client.listOrderAtResourceGroupLevelHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// 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.internal.Endpoint(), 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. -// -// Generated from API version 2021-12-01 -// - options - ManagementClientListOrderAtSubscriptionLevelOptions contains the optional parameters for the ManagementClient.NewListOrderAtSubscriptionLevelPager -// 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) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.NewListOrderAtSubscriptionLevelPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listOrderAtSubscriptionLevelCreateRequest(ctx, options) - }, nil) - if err != nil { - return ManagementClientListOrderAtSubscriptionLevelResponse{}, err - } - return client.listOrderAtSubscriptionLevelHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// 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.internal.Endpoint(), 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. -// -// 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.NewListOrderItemsAtResourceGroupLevelPager -// 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) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.NewListOrderItemsAtResourceGroupLevelPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listOrderItemsAtResourceGroupLevelCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return ManagementClientListOrderItemsAtResourceGroupLevelResponse{}, err - } - return client.listOrderItemsAtResourceGroupLevelHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// 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.internal.Endpoint(), 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. -// -// Generated from API version 2021-12-01 -// - options - ManagementClientListOrderItemsAtSubscriptionLevelOptions contains the optional parameters for the ManagementClient.NewListOrderItemsAtSubscriptionLevelPager -// 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) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.NewListOrderItemsAtSubscriptionLevelPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listOrderItemsAtSubscriptionLevelCreateRequest(ctx, options) - }, nil) - if err != nil { - return ManagementClientListOrderItemsAtSubscriptionLevelResponse{}, err - } - return client.listOrderItemsAtSubscriptionLevelHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// 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.internal.Endpoint(), 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. -// -// Generated from API version 2021-12-01 -// - productFamiliesRequest - Filters for showing the product families. -// - options - ManagementClientListProductFamiliesOptions contains the optional parameters for the ManagementClient.NewListProductFamiliesPager -// 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) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.NewListProductFamiliesPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listProductFamiliesCreateRequest(ctx, productFamiliesRequest, options) - }, nil) - if err != nil { - return ManagementClientListProductFamiliesResponse{}, err - } - return client.listProductFamiliesHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// 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.internal.Endpoint(), 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"} - if err := runtime.MarshalAsJSON(req, productFamiliesRequest); err != nil { - return nil, err - } - return req, nil -} - -// 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. -// -// Generated from API version 2021-12-01 -// - options - ManagementClientListProductFamiliesMetadataOptions contains the optional parameters for the ManagementClient.NewListProductFamiliesMetadataPager -// 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) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.NewListProductFamiliesMetadataPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listProductFamiliesMetadataCreateRequest(ctx, options) - }, nil) - if err != nil { - return ManagementClientListProductFamiliesMetadataResponse{}, err - } - return client.listProductFamiliesMetadataHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// 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.internal.Endpoint(), 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 - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagementClientReturnOrderItemResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagementClientReturnOrderItemResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// 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) { - var err error - const operationName = "ManagementClient.BeginReturnOrderItem" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.returnOrderItemCreateRequest(ctx, orderItemName, resourceGroupName, returnOrderItemDetails, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// 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.internal.Endpoint(), 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"} - if err := runtime.MarshalAsJSON(req, returnOrderItemDetails); err != nil { - return nil, err - } - return req, nil -} - -// 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 - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagementClientUpdateAddressResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagementClientUpdateAddressResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// 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) { - var err error - const operationName = "ManagementClient.BeginUpdateAddress" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateAddressCreateRequest(ctx, addressName, resourceGroupName, addressUpdateParameter, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// 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.internal.Endpoint(), 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"} - if err := runtime.MarshalAsJSON(req, addressUpdateParameter); err != nil { - return nil, err - } - return req, nil -} - -// 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 - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagementClientUpdateOrderItemResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagementClientUpdateOrderItemResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// 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) { - var err error - const operationName = "ManagementClient.BeginUpdateOrderItem" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateOrderItemCreateRequest(ctx, orderItemName, resourceGroupName, orderItemUpdateParameter, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// 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.internal.Endpoint(), 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"} - if err := runtime.MarshalAsJSON(req, orderItemUpdateParameter); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/management_client_example_test.go b/sdk/resourcemanager/edgeorder/armedgeorder/management_client_example_test.go deleted file mode 100644 index 838abf0fbf1b..000000000000 --- a/sdk/resourcemanager/edgeorder/armedgeorder/management_client_example_test.go +++ /dev/null @@ -1,2203 +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. -// DO NOT EDIT. - -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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementClient().NewListOperationsPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armedgeorder.OperationListResult{ - // Value: []*armedgeorder.Operation{ - // { - // Name: to.Ptr("Microsoft.EdgeOrder/addresses/read"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("List or get the Addresses"), - // Operation: to.Ptr("List or Get Addresses"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("Addresses"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/addresses/delete"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("Delete the Addresses"), - // Operation: to.Ptr("Delete Addresses"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("Addresses"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/addresses/write"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("Create or update the Addresses"), - // Operation: to.Ptr("Create or Update Addresses"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("Addresses"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/locations/operationResults/read"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("List or get the Operation Results"), - // Operation: to.Ptr("List or Get Operation Results"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("Operation Results"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/operations/read"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("List or get the Operations"), - // Operation: to.Ptr("List or Get Operations"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("Operations"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/locations/orders/read"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("List or get the Order"), - // Operation: to.Ptr("List or Get Order"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("Order"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/orders/read"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("List or get the Order"), - // Operation: to.Ptr("List or Get Order"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("Order"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/orderItems/cancel/action"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("Cancels an OrderItem in progress."), - // Operation: to.Ptr("Cancel OrderItem"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("OrderItem"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/orderItems/return/action"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("Return an OrderItem."), - // Operation: to.Ptr("Return OrderItem"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("OrderItem"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/orderItems/read"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("List or get the OrderItem"), - // Operation: to.Ptr("List or Get OrderItem"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("OrderItem"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/orderItems/delete"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("Delete the OrderItem"), - // Operation: to.Ptr("Delete OrderItem"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("OrderItem"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/orderItems/write"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("Create or update the OrderItem"), - // Operation: to.Ptr("Create or Update OrderItem"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("OrderItem"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/productFamiliesMetadata/action"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("This method lists or gets the product families metadata."), - // Operation: to.Ptr("List or Get product families metadata"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("ArmApiRes_Microsoft.EdgeOrder"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/listProductFamilies/read"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("This method returns list of product families."), - // Operation: to.Ptr("List Product Families"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("ArmApiRes_Microsoft.EdgeOrder"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }, - // { - // Name: to.Ptr("Microsoft.EdgeOrder/listConfigurations/action"), - // Display: &armedgeorder.OperationDisplay{ - // Description: to.Ptr("This method returns list of product configurations."), - // Operation: to.Ptr("List Product Configurations"), - // Provider: to.Ptr("Edge Ordering"), - // Resource: to.Ptr("ArmApiRes_Microsoft.EdgeOrder"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armedgeorder.OriginUser), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementClient().NewListAddressesAtSubscriptionLevelPager(&armedgeorder.ManagementClientListAddressesAtSubscriptionLevelOptions{Filter: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AddressResourceList = armedgeorder.AddressResourceList{ - // Value: []*armedgeorder.AddressResource{ - // { - // Name: to.Ptr("TestAddressName1"), - // Type: to.Ptr("Microsoft.EdgeOrder/addresses"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/addresses/TestAddressName1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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"), - // }, - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("TestAddressName2"), - // Type: to.Ptr("Microsoft.EdgeOrder/addresses"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/addresses/TestAddressName2"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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"), - // }, - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementClient().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() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProductFamilies = armedgeorder.ProductFamilies{ - // Value: []*armedgeorder.ProductFamily{ - // { - // Properties: &armedgeorder.ProductFamilyProperties{ - // Description: &armedgeorder.Description{ - // Attributes: []*string{ - // }, - // DescriptionType: to.Ptr(armedgeorder.DescriptionTypeBase), - // Keywords: []*string{ - // }, - // Links: []*armedgeorder.Link{ - // }, - // ShortDescription: to.Ptr("Azure managed physical edge compute device"), - // }, - // AvailabilityInformation: &armedgeorder.AvailabilityInformation{ - // AvailabilityStage: to.Ptr(armedgeorder.AvailabilityStageAvailable), - // DisabledReason: to.Ptr(armedgeorder.DisabledReasonNone), - // }, - // DisplayName: to.Ptr("Azure Stack Edge"), - // HierarchyInformation: &armedgeorder.HierarchyInformation{ - // ConfigurationName: to.Ptr(""), - // ProductFamilyName: to.Ptr("azurestackedge"), - // ProductLineName: to.Ptr(""), - // ProductName: to.Ptr(""), - // }, - // ImageInformation: []*armedgeorder.ImageInformation{ - // }, - // FilterableProperties: []*armedgeorder.FilterableProperty{ - // { - // Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), - // SupportedValues: []*string{ - // to.Ptr("US")}, - // }, - // { - // Type: to.Ptr(armedgeorder.SupportedFilterTypesDoubleEncryptionStatus), - // SupportedValues: []*string{ - // to.Ptr("Enabled")}, - // }}, - // ProductLines: []*armedgeorder.ProductLine{ - // { - // Properties: &armedgeorder.ProductLineProperties{ - // Description: &armedgeorder.Description{ - // Attributes: []*string{ - // }, - // DescriptionType: to.Ptr(armedgeorder.DescriptionTypeBase), - // Keywords: []*string{ - // }, - // Links: []*armedgeorder.Link{ - // }, - // }, - // AvailabilityInformation: &armedgeorder.AvailabilityInformation{ - // AvailabilityStage: to.Ptr(armedgeorder.AvailabilityStageAvailable), - // DisabledReason: to.Ptr(armedgeorder.DisabledReasonNone), - // }, - // DisplayName: to.Ptr("Azure Stack Edge"), - // HierarchyInformation: &armedgeorder.HierarchyInformation{ - // ConfigurationName: to.Ptr(""), - // ProductFamilyName: to.Ptr("azurestackedge"), - // ProductLineName: to.Ptr("azurestackedge"), - // ProductName: to.Ptr(""), - // }, - // ImageInformation: []*armedgeorder.ImageInformation{ - // }, - // FilterableProperties: []*armedgeorder.FilterableProperty{ - // { - // Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), - // SupportedValues: []*string{ - // to.Ptr("US")}, - // }, - // { - // Type: to.Ptr(armedgeorder.SupportedFilterTypesDoubleEncryptionStatus), - // SupportedValues: []*string{ - // to.Ptr("Enabled")}, - // }}, - // Products: []*armedgeorder.Product{ - // { - // Properties: &armedgeorder.ProductProperties{ - // Description: &armedgeorder.Description{ - // Attributes: []*string{ - // to.Ptr("1U rack mount device with network data transfer capabilities"), - // to.Ptr("Hardware accelerated ML using Nvidia T4 GPU"), - // to.Ptr("Azure Private Edge Zones enabled")}, - // DescriptionType: to.Ptr(armedgeorder.DescriptionTypeBase), - // Keywords: []*string{ - // to.Ptr("GPU")}, - // Links: []*armedgeorder.Link{ - // { - // LinkType: to.Ptr(armedgeorder.LinkTypeSpecification), - // LinkURL: to.Ptr("https://aka.ms/edgeHWcenter-asepro-devicespec"), - // }, - // { - // LinkType: to.Ptr(armedgeorder.LinkTypeGeneric), - // LinkURL: to.Ptr("https://aka.ms/ase-gpu-billing"), - // }, - // { - // LinkType: to.Ptr(armedgeorder.LinkTypeTermsAndConditions), - // LinkURL: to.Ptr("https://aka.ms/ase-gpu-product-terms"), - // }, - // { - // LinkType: to.Ptr(armedgeorder.LinkTypeKnowMore), - // LinkURL: to.Ptr("https://aka.ms/edgeHWcenter-asepro-documentation"), - // }}, - // LongDescription: to.Ptr("Azure Stack Edge Pro is an AI-enabled edge computing device with network data transfer capabilities. The device is powered with NVIDIA T4 GPUs to provide accelerated AI inferencing at the edge. You can choose from the following configurations based upon your business need"), - // ShortDescription: to.Ptr("Azure managed physical edge compute device"), - // }, - // AvailabilityInformation: &armedgeorder.AvailabilityInformation{ - // AvailabilityStage: to.Ptr(armedgeorder.AvailabilityStageAvailable), - // DisabledReason: to.Ptr(armedgeorder.DisabledReasonNone), - // }, - // DisplayName: to.Ptr("Azure Stack Edge Pro - GPU"), - // HierarchyInformation: &armedgeorder.HierarchyInformation{ - // ConfigurationName: to.Ptr(""), - // ProductFamilyName: to.Ptr("azurestackedge"), - // ProductLineName: to.Ptr("azurestackedge"), - // ProductName: to.Ptr("azurestackedgegpu"), - // }, - // ImageInformation: []*armedgeorder.ImageInformation{ - // }, - // FilterableProperties: []*armedgeorder.FilterableProperty{ - // { - // Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), - // SupportedValues: []*string{ - // to.Ptr("US")}, - // }}, - // Configurations: []*armedgeorder.Configuration{ - // { - // Properties: &armedgeorder.ConfigurationProperties{ - // Description: &armedgeorder.Description{ - // Attributes: []*string{ - // }, - // DescriptionType: to.Ptr(armedgeorder.DescriptionTypeBase), - // Keywords: []*string{ - // to.Ptr("GPU")}, - // Links: []*armedgeorder.Link{ - // }, - // LongDescription: to.Ptr(""), - // ShortDescription: to.Ptr(""), - // }, - // AvailabilityInformation: &armedgeorder.AvailabilityInformation{ - // AvailabilityStage: to.Ptr(armedgeorder.AvailabilityStageAvailable), - // DisabledReason: to.Ptr(armedgeorder.DisabledReasonNone), - // }, - // CostInformation: &armedgeorder.CostInformation{ - // BillingMeterDetails: []*armedgeorder.BillingMeterDetails{ - // }, - // }, - // DisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), - // HierarchyInformation: &armedgeorder.HierarchyInformation{ - // ConfigurationName: to.Ptr("edgep_base"), - // ProductFamilyName: to.Ptr("azurestackedge"), - // ProductLineName: to.Ptr("azurestackedge"), - // ProductName: to.Ptr("azurestackedgegpu"), - // }, - // ImageInformation: []*armedgeorder.ImageInformation{ - // }, - // FilterableProperties: []*armedgeorder.FilterableProperty{ - // { - // Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), - // SupportedValues: []*string{ - // to.Ptr("US")}, - // }}, - // Dimensions: &armedgeorder.Dimensions{ - // Depth: to.Ptr[float64](2), - // Height: to.Ptr[float64](15), - // Length: to.Ptr[float64](50), - // LengthHeightUnit: to.Ptr(armedgeorder.LengthHeightUnitIN), - // Weight: to.Ptr[float64](50), - // WeightUnit: to.Ptr(armedgeorder.WeightMeasurementUnitLBS), - // Width: to.Ptr[float64](5), - // }, - // Specifications: []*armedgeorder.Specification{ - // { - // Name: to.Ptr("Usable compute"), - // Value: to.Ptr("40 vCPU"), - // }, - // { - // Name: to.Ptr("Usable memory"), - // Value: to.Ptr("102 GB"), - // }, - // { - // Name: to.Ptr("Usable storage"), - // Value: to.Ptr("4.2 TB"), - // }}, - // }, - // }}, - // }, - // }}, - // }, - // }}, - // ResourceProviderDetails: []*armedgeorder.ResourceProviderDetails{ - // { - // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementClient().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() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.Configurations = armedgeorder.Configurations{ - // Value: []*armedgeorder.Configuration{ - // { - // Properties: &armedgeorder.ConfigurationProperties{ - // Description: &armedgeorder.Description{ - // Attributes: []*string{ - // }, - // DescriptionType: to.Ptr(armedgeorder.DescriptionTypeBase), - // Keywords: []*string{ - // to.Ptr("GPU")}, - // Links: []*armedgeorder.Link{ - // }, - // LongDescription: to.Ptr(""), - // ShortDescription: to.Ptr(""), - // }, - // AvailabilityInformation: &armedgeorder.AvailabilityInformation{ - // AvailabilityStage: to.Ptr(armedgeorder.AvailabilityStageAvailable), - // DisabledReason: to.Ptr(armedgeorder.DisabledReasonNone), - // }, - // CostInformation: &armedgeorder.CostInformation{ - // BillingMeterDetails: []*armedgeorder.BillingMeterDetails{ - // }, - // }, - // DisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), - // HierarchyInformation: &armedgeorder.HierarchyInformation{ - // ConfigurationName: to.Ptr("edgep_base"), - // ProductFamilyName: to.Ptr("azurestackedge"), - // ProductLineName: to.Ptr("azurestackedge"), - // ProductName: to.Ptr("azurestackedgegpu"), - // }, - // ImageInformation: []*armedgeorder.ImageInformation{ - // }, - // FilterableProperties: []*armedgeorder.FilterableProperty{ - // { - // Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), - // SupportedValues: []*string{ - // to.Ptr("US")}, - // }}, - // Dimensions: &armedgeorder.Dimensions{ - // Depth: to.Ptr[float64](2), - // Height: to.Ptr[float64](15), - // Length: to.Ptr[float64](50), - // LengthHeightUnit: to.Ptr(armedgeorder.LengthHeightUnitIN), - // Weight: to.Ptr[float64](50), - // WeightUnit: to.Ptr(armedgeorder.WeightMeasurementUnitLBS), - // Width: to.Ptr[float64](5), - // }, - // Specifications: []*armedgeorder.Specification{ - // { - // Name: to.Ptr("Usable compute"), - // Value: to.Ptr("40 vCPU"), - // }, - // { - // Name: to.Ptr("Usable memory"), - // Value: to.Ptr("102 GB"), - // }, - // { - // Name: to.Ptr("Usable storage"), - // Value: to.Ptr("4.2 TB"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementClient().NewListProductFamiliesMetadataPager(&armedgeorder.ManagementClientListProductFamiliesMetadataOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProductFamiliesMetadata = armedgeorder.ProductFamiliesMetadata{ - // Value: []*armedgeorder.ProductFamiliesMetadataDetails{ - // { - // Properties: &armedgeorder.ProductFamilyProperties{ - // Description: &armedgeorder.Description{ - // Attributes: []*string{ - // }, - // DescriptionType: to.Ptr(armedgeorder.DescriptionTypeBase), - // Keywords: []*string{ - // }, - // Links: []*armedgeorder.Link{ - // }, - // ShortDescription: to.Ptr("Azure managed physical edge compute device"), - // }, - // AvailabilityInformation: &armedgeorder.AvailabilityInformation{ - // AvailabilityStage: to.Ptr(armedgeorder.AvailabilityStageAvailable), - // DisabledReason: to.Ptr(armedgeorder.DisabledReasonNone), - // }, - // DisplayName: to.Ptr("Azure Stack Edge"), - // HierarchyInformation: &armedgeorder.HierarchyInformation{ - // ConfigurationName: to.Ptr(""), - // ProductFamilyName: to.Ptr("azurestackedge"), - // ProductLineName: to.Ptr(""), - // ProductName: to.Ptr(""), - // }, - // ImageInformation: []*armedgeorder.ImageInformation{ - // }, - // FilterableProperties: []*armedgeorder.FilterableProperty{ - // { - // Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), - // SupportedValues: []*string{ - // to.Ptr("US")}, - // }, - // { - // Type: to.Ptr(armedgeorder.SupportedFilterTypesDoubleEncryptionStatus), - // SupportedValues: []*string{ - // to.Ptr("Enabled")}, - // }}, - // ProductLines: []*armedgeorder.ProductLine{ - // }, - // ResourceProviderDetails: []*armedgeorder.ResourceProviderDetails{ - // { - // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementClient().NewListOrderAtSubscriptionLevelPager(&armedgeorder.ManagementClientListOrderAtSubscriptionLevelOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OrderResourceList = armedgeorder.OrderResourceList{ - // Value: []*armedgeorder.OrderResource{ - // { - // Name: to.Ptr("TestOrderItemName1"), - // Type: to.Ptr("Microsoft.EdgeOrder/orders"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName1"), - // Properties: &armedgeorder.OrderProperties{ - // CurrentStage: &armedgeorder.StageDetails{ - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:25:46.943Z"); return t}()), - // }, - // OrderItemIDs: []*string{ - // to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName1")}, - // OrderStageHistory: []*armedgeorder.StageDetails{ - // { - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:25:46.943Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameInReview), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }}, - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("TestOrderItemName2"), - // Type: to.Ptr("Microsoft.EdgeOrder/orders"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName2"), - // Properties: &armedgeorder.OrderProperties{ - // CurrentStage: &armedgeorder.StageDetails{ - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusInProgress), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:28:46.524Z"); return t}()), - // }, - // OrderItemIDs: []*string{ - // to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName2")}, - // OrderStageHistory: []*armedgeorder.StageDetails{ - // { - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameInReview), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }}, - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementClient().NewListOrderItemsAtSubscriptionLevelPager(&armedgeorder.ManagementClientListOrderItemsAtSubscriptionLevelOptions{Filter: nil, - Expand: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OrderItemResourceList = armedgeorder.OrderItemResourceList{ - // Value: []*armedgeorder.OrderItemResource{ - // { - // Name: to.Ptr("TestOrderItemName1"), - // Type: to.Ptr("Microsoft.EdgeOrder/orderItems"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armedgeorder.OrderItemProperties{ - // AddressDetails: &armedgeorder.AddressDetails{ - // ForwardAddress: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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/TestOrderName1"), - // OrderItemDetails: &armedgeorder.OrderItemDetails{ - // CancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumNotCancellable), - // CurrentStage: &armedgeorder.StageDetails{ - // StageName: to.Ptr(armedgeorder.StageNameConfirmed), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:35:00.357Z"); return t}()), - // }, - // DeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed), - // ManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{ - // { - // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), - // }}, - // NotificationEmailList: []*string{ - // }, - // OrderItemStageHistory: []*armedgeorder.StageDetails{ - // { - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:25:54.342Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameConfirmed), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:35:00.357Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameReadyToShip), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameShipped), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameDelivered), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameInUse), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }}, - // OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), - // Preferences: &armedgeorder.Preferences{ - // TransportPreferences: &armedgeorder.TransportPreferences{ - // PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged), - // }, - // }, - // ProductDetails: &armedgeorder.ProductDetails{ - // Count: to.Ptr[int32](0), - // DisplayInfo: &armedgeorder.DisplayInfo{ - // ConfigurationDisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), - // ProductFamilyDisplayName: to.Ptr("Azure Stack Edge"), - // }, - // HierarchyInformation: &armedgeorder.HierarchyInformation{ - // ConfigurationName: to.Ptr("edgep_base"), - // ProductFamilyName: to.Ptr("azurestackedge"), - // ProductLineName: to.Ptr("azurestackedge"), - // ProductName: to.Ptr("azurestackedgegpu"), - // }, - // ProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled), - // }, - // ReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:25:10.282Z"); return t}()), - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("TestOrderItemName2"), - // Type: to.Ptr("Microsoft.EdgeOrder/orderItems"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName2"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armedgeorder.OrderItemProperties{ - // AddressDetails: &armedgeorder.AddressDetails{ - // ForwardAddress: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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{ - // CancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumNotCancellable), - // CurrentStage: &armedgeorder.StageDetails{ - // StageName: to.Ptr(armedgeorder.StageNameConfirmed), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:37:29.989Z"); return t}()), - // }, - // DeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed), - // ManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{ - // { - // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), - // }}, - // NotificationEmailList: []*string{ - // }, - // OrderItemStageHistory: []*armedgeorder.StageDetails{ - // { - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:29:04.970Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameConfirmed), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:37:29.989Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameReadyToShip), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameShipped), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameDelivered), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameInUse), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }}, - // OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), - // Preferences: &armedgeorder.Preferences{ - // TransportPreferences: &armedgeorder.TransportPreferences{ - // PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged), - // }, - // }, - // ProductDetails: &armedgeorder.ProductDetails{ - // Count: to.Ptr[int32](0), - // DisplayInfo: &armedgeorder.DisplayInfo{ - // ConfigurationDisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), - // ProductFamilyDisplayName: to.Ptr("Azure Stack Edge"), - // }, - // HierarchyInformation: &armedgeorder.HierarchyInformation{ - // ConfigurationName: to.Ptr("edgep_base"), - // ProductFamilyName: to.Ptr("azurestackedge"), - // ProductLineName: to.Ptr("azurestackedge"), - // ProductName: to.Ptr("azurestackedgegpu"), - // }, - // ProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled), - // }, - // ReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:28:27.582Z"); return t}()), - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementClient().NewListAddressesAtResourceGroupLevelPager("YourResourceGroupName", &armedgeorder.ManagementClientListAddressesAtResourceGroupLevelOptions{Filter: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AddressResourceList = armedgeorder.AddressResourceList{ - // Value: []*armedgeorder.AddressResource{ - // { - // Name: to.Ptr("TestAddressName1"), - // Type: to.Ptr("Microsoft.EdgeOrder/addresses"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/addresses/TestAddressName1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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"), - // }, - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("TestAddressName2"), - // Type: to.Ptr("Microsoft.EdgeOrder/addresses"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/addresses/TestAddressName2"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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"), - // }, - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementClient().GetAddressByName(ctx, "TestAddressName1", "YourResourceGroupName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AddressResource = armedgeorder.AddressResource{ - // Name: to.Ptr("TestAddressName1"), - // Type: to.Ptr("Microsoft.EdgeOrder/addresses"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/addresses/TestAddressName1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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"), - // }, - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AddressResource = armedgeorder.AddressResource{ - // Name: to.Ptr("TestAddressName2"), - // Type: to.Ptr("Microsoft.EdgeOrder/addresses"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/addresses/TestAddressName2"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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"), - // }, - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AddressResource = armedgeorder.AddressResource{ - // Name: to.Ptr("TestAddressName2"), - // Type: to.Ptr("Microsoft.EdgeOrder/addresses"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/addresses/TestAddressName2"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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"), - // }, - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementClient().NewListOrderAtResourceGroupLevelPager("YourResourceGroupName", &armedgeorder.ManagementClientListOrderAtResourceGroupLevelOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OrderResourceList = armedgeorder.OrderResourceList{ - // Value: []*armedgeorder.OrderResource{ - // { - // Name: to.Ptr("TestOrderItemName1"), - // Type: to.Ptr("Microsoft.EdgeOrder/orders"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName1"), - // Properties: &armedgeorder.OrderProperties{ - // CurrentStage: &armedgeorder.StageDetails{ - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:25:46.943Z"); return t}()), - // }, - // OrderItemIDs: []*string{ - // to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName1")}, - // OrderStageHistory: []*armedgeorder.StageDetails{ - // { - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:25:46.943Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameInReview), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }}, - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("TestOrderItemName2"), - // Type: to.Ptr("Microsoft.EdgeOrder/orders"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName2"), - // Properties: &armedgeorder.OrderProperties{ - // CurrentStage: &armedgeorder.StageDetails{ - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusInProgress), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:28:46.524Z"); return t}()), - // }, - // OrderItemIDs: []*string{ - // to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName2")}, - // OrderStageHistory: []*armedgeorder.StageDetails{ - // { - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameInReview), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }}, - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementClient().GetOrderByName(ctx, "TestOrderName3", "YourResourceGroupName", "eastus", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OrderResource = armedgeorder.OrderResource{ - // Name: to.Ptr("TestOrderName3"), - // Type: to.Ptr("Microsoft.EdgeOrder/orders"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName3"), - // Properties: &armedgeorder.OrderProperties{ - // CurrentStage: &armedgeorder.StageDetails{ - // StageName: to.Ptr(armedgeorder.StageNameInReview), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T06:05:20.852Z"); return t}()), - // }, - // OrderItemIDs: []*string{ - // to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName3")}, - // OrderStageHistory: []*armedgeorder.StageDetails{ - // { - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T06:00:30.271Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameInReview), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T06:05:20.852Z"); return t}()), - // }}, - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementClient().NewListOrderItemsAtResourceGroupLevelPager("YourResourceGroupName", &armedgeorder.ManagementClientListOrderItemsAtResourceGroupLevelOptions{Filter: nil, - Expand: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OrderItemResourceList = armedgeorder.OrderItemResourceList{ - // Value: []*armedgeorder.OrderItemResource{ - // { - // Name: to.Ptr("TestOrderItemName1"), - // Type: to.Ptr("Microsoft.EdgeOrder/orderItems"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armedgeorder.OrderItemProperties{ - // AddressDetails: &armedgeorder.AddressDetails{ - // ForwardAddress: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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/TestOrderName1"), - // OrderItemDetails: &armedgeorder.OrderItemDetails{ - // CancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumNotCancellable), - // CurrentStage: &armedgeorder.StageDetails{ - // StageName: to.Ptr(armedgeorder.StageNameConfirmed), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:35:00.357Z"); return t}()), - // }, - // DeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed), - // ManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{ - // { - // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), - // }}, - // NotificationEmailList: []*string{ - // }, - // OrderItemStageHistory: []*armedgeorder.StageDetails{ - // { - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:25:54.342Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameConfirmed), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:35:00.357Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameReadyToShip), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameShipped), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameDelivered), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameInUse), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }}, - // OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), - // Preferences: &armedgeorder.Preferences{ - // TransportPreferences: &armedgeorder.TransportPreferences{ - // PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged), - // }, - // }, - // ProductDetails: &armedgeorder.ProductDetails{ - // Count: to.Ptr[int32](0), - // DisplayInfo: &armedgeorder.DisplayInfo{ - // ConfigurationDisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), - // ProductFamilyDisplayName: to.Ptr("Azure Stack Edge"), - // }, - // HierarchyInformation: &armedgeorder.HierarchyInformation{ - // ConfigurationName: to.Ptr("edgep_base"), - // ProductFamilyName: to.Ptr("azurestackedge"), - // ProductLineName: to.Ptr("azurestackedge"), - // ProductName: to.Ptr("azurestackedgegpu"), - // }, - // ProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled), - // }, - // ReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:25:10.282Z"); return t}()), - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("TestOrderItemName2"), - // Type: to.Ptr("Microsoft.EdgeOrder/orderItems"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName2"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armedgeorder.OrderItemProperties{ - // AddressDetails: &armedgeorder.AddressDetails{ - // ForwardAddress: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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{ - // CancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumNotCancellable), - // CurrentStage: &armedgeorder.StageDetails{ - // StageName: to.Ptr(armedgeorder.StageNameConfirmed), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:37:29.989Z"); return t}()), - // }, - // DeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed), - // ManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{ - // { - // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), - // }}, - // NotificationEmailList: []*string{ - // }, - // OrderItemStageHistory: []*armedgeorder.StageDetails{ - // { - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:29:04.970Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameConfirmed), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:37:29.989Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameReadyToShip), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameShipped), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameDelivered), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameInUse), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }}, - // OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), - // Preferences: &armedgeorder.Preferences{ - // TransportPreferences: &armedgeorder.TransportPreferences{ - // PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged), - // }, - // }, - // ProductDetails: &armedgeorder.ProductDetails{ - // Count: to.Ptr[int32](0), - // DisplayInfo: &armedgeorder.DisplayInfo{ - // ConfigurationDisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), - // ProductFamilyDisplayName: to.Ptr("Azure Stack Edge"), - // }, - // HierarchyInformation: &armedgeorder.HierarchyInformation{ - // ConfigurationName: to.Ptr("edgep_base"), - // ProductFamilyName: to.Ptr("azurestackedge"), - // ProductLineName: to.Ptr("azurestackedge"), - // ProductName: to.Ptr("azurestackedgegpu"), - // }, - // ProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled), - // }, - // ReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:28:27.582Z"); return t}()), - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementClient().GetOrderItemByName(ctx, "TestOrderItemName1", "YourResourceGroupName", &armedgeorder.ManagementClientGetOrderItemByNameOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OrderItemResource = armedgeorder.OrderItemResource{ - // Name: to.Ptr("TestOrderItemName1"), - // Type: to.Ptr("Microsoft.EdgeOrder/orderItems"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armedgeorder.OrderItemProperties{ - // AddressDetails: &armedgeorder.AddressDetails{ - // ForwardAddress: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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/TestOrderName1"), - // OrderItemDetails: &armedgeorder.OrderItemDetails{ - // CancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumNotCancellable), - // CurrentStage: &armedgeorder.StageDetails{ - // StageName: to.Ptr(armedgeorder.StageNameConfirmed), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:35:00.357Z"); return t}()), - // }, - // DeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed), - // ManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{ - // { - // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), - // }}, - // NotificationEmailList: []*string{ - // }, - // OrderItemStageHistory: []*armedgeorder.StageDetails{ - // { - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:25:54.342Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameConfirmed), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:35:00.357Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameReadyToShip), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameShipped), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameDelivered), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameInUse), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }}, - // OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), - // Preferences: &armedgeorder.Preferences{ - // TransportPreferences: &armedgeorder.TransportPreferences{ - // PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged), - // }, - // }, - // ProductDetails: &armedgeorder.ProductDetails{ - // Count: to.Ptr[int32](0), - // DisplayInfo: &armedgeorder.DisplayInfo{ - // ConfigurationDisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), - // ProductFamilyDisplayName: to.Ptr("Azure Stack Edge"), - // }, - // HierarchyInformation: &armedgeorder.HierarchyInformation{ - // ConfigurationName: to.Ptr("edgep_base"), - // ProductFamilyName: to.Ptr("azurestackedge"), - // ProductLineName: to.Ptr("azurestackedge"), - // ProductName: to.Ptr("azurestackedgegpu"), - // }, - // ProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled), - // }, - // ReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:25:10.282Z"); return t}()), - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OrderItemResource = armedgeorder.OrderItemResource{ - // Name: to.Ptr("TestOrderItemName2"), - // Type: to.Ptr("Microsoft.EdgeOrder/orderItems"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName2"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armedgeorder.OrderItemProperties{ - // AddressDetails: &armedgeorder.AddressDetails{ - // ForwardAddress: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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{ - // CancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumCancellable), - // CurrentStage: &armedgeorder.StageDetails{ - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusInProgress), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:28:27.582Z"); return t}()), - // }, - // DeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed), - // ManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{ - // { - // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), - // }}, - // NotificationEmailList: []*string{ - // }, - // OrderItemStageHistory: []*armedgeorder.StageDetails{ - // { - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameConfirmed), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameReadyToShip), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameShipped), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameDelivered), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameInUse), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }}, - // OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), - // Preferences: &armedgeorder.Preferences{ - // TransportPreferences: &armedgeorder.TransportPreferences{ - // PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged), - // }, - // }, - // ProductDetails: &armedgeorder.ProductDetails{ - // Count: to.Ptr[int32](0), - // DisplayInfo: &armedgeorder.DisplayInfo{ - // ConfigurationDisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), - // ProductFamilyDisplayName: to.Ptr("Azure Stack Edge"), - // }, - // HierarchyInformation: &armedgeorder.HierarchyInformation{ - // ConfigurationName: to.Ptr("edgep_base"), - // ProductFamilyName: to.Ptr("azurestackedge"), - // ProductLineName: to.Ptr("azurestackedge"), - // ProductName: to.Ptr("azurestackedgegpu"), - // }, - // ProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled), - // }, - // ReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:28:27.582Z"); return t}()), - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OrderItemResource = armedgeorder.OrderItemResource{ - // Name: to.Ptr("TestOrderItemName3"), - // Type: to.Ptr("Microsoft.EdgeOrder/orderItems"), - // ID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName3"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armedgeorder.OrderItemProperties{ - // AddressDetails: &armedgeorder.AddressDetails{ - // ForwardAddress: &armedgeorder.AddressProperties{ - // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), - // 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/TestOrderName3"), - // OrderItemDetails: &armedgeorder.OrderItemDetails{ - // CancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumCancellable), - // CurrentStage: &armedgeorder.StageDetails{ - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T06:00:31.583Z"); return t}()), - // }, - // DeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed), - // ManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{ - // { - // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), - // }}, - // NotificationEmailList: []*string{ - // }, - // OrderItemStageHistory: []*armedgeorder.StageDetails{ - // { - // StageName: to.Ptr(armedgeorder.StageNamePlaced), - // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T06:00:31.583Z"); return t}()), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameConfirmed), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameReadyToShip), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameShipped), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameDelivered), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }, - // { - // StageName: to.Ptr(armedgeorder.StageNameInUse), - // StageStatus: to.Ptr(armedgeorder.StageStatusNone), - // }}, - // OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), - // Preferences: &armedgeorder.Preferences{ - // TransportPreferences: &armedgeorder.TransportPreferences{ - // PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesCustomerManaged), - // }, - // }, - // ProductDetails: &armedgeorder.ProductDetails{ - // Count: to.Ptr[int32](0), - // DisplayInfo: &armedgeorder.DisplayInfo{ - // ConfigurationDisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), - // ProductFamilyDisplayName: to.Ptr("Azure Stack Edge"), - // }, - // HierarchyInformation: &armedgeorder.HierarchyInformation{ - // ConfigurationName: to.Ptr("edgep_base"), - // ProductFamilyName: to.Ptr("azurestackedge"), - // ProductLineName: to.Ptr("azurestackedge"), - // ProductName: to.Ptr("azurestackedgegpu"), - // }, - // ProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled), - // }, - // ReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:59:47.348Z"); return t}()), - // }, - // SystemData: &armedgeorder.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewManagementClient().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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().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/models.go b/sdk/resourcemanager/edgeorder/armedgeorder/models.go index cbb76a95a01a..be03502d700e 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/models.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/models.go @@ -1,34 +1,48 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. 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 + + // REQUIRED; Quantity of the product. + Quantity *int32 + + // List Provisioning Details for Devices in Additional Config. + ProvisioningDetails []*ProvisioningDetails +} + // 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 - // READ-ONLY; Return shipping address + // READ-ONLY; Return shipping address. ReturnAddress *AddressProperties } -// AddressProperties - Address Properties +// AddressProperties - Address Properties. type AddressProperties struct { - // REQUIRED; Contact details for the address + // Type of address based on its usage context. + AddressClassification *AddressClassification + + // Contact details for the address. ContactDetails *ContactDetails - // Shipping details for the address + // Shipping details for the address. ShippingAddress *ShippingAddress - // READ-ONLY; Status of address validation + // READ-ONLY; Status of address validation. AddressValidationStatus *AddressValidationStatus + + // READ-ONLY; Provisioning state + ProvisioningState *ProvisioningState } // AddressResource - Address Resource. @@ -42,31 +56,32 @@ type AddressResource struct { // Resource tags. Tags map[string]*string + // READ-ONLY; 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. + Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Represents resource creation and update time + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// AddressResourceList - Address Resource Collection +// AddressResourceList - Address Resource Collection. type AddressResourceList struct { - // Link for the next set of job resources. - NextLink *string - - // READ-ONLY; List of address resources. + // READ-ONLY; The AddressResource items on this page Value []*AddressResource + + // The link to the next page of items + NextLink *string } -// 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 // The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across @@ -74,18 +89,18 @@ type AddressUpdateParameter struct { Tags map[string]*string } -// AddressUpdateProperties - Address Properties +// AddressUpdateProperties - Address Update Properties. type AddressUpdateProperties struct { - // Contact details for the address + // Contact details for the address. ContactDetails *ContactDetails - // Shipping details for the address + // Shipping details for the address. ShippingAddress *ShippingAddress } // 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 // READ-ONLY; Reason why the product is disabled. @@ -95,40 +110,22 @@ type AvailabilityInformation struct { DisabledReasonMessage *string } -// BasicInformation - Basic information for any product system -type BasicInformation struct { - // READ-ONLY; Availability information of the product system. - AvailabilityInformation *AvailabilityInformation - - // READ-ONLY; Cost information for the product system. - CostInformation *CostInformation - - // READ-ONLY; Description related to the product system. - Description *Description - - // READ-ONLY; Display Name for the product system. - DisplayName *string - - // READ-ONLY; Hierarchy information of a product. - HierarchyInformation *HierarchyInformation - - // READ-ONLY; Image information for the product system. - ImageInformation []*ImageInformation -} - -// 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 - // READ-ONLY; Represents MeterDetails + // READ-ONLY; Represents MeterDetails. MeterDetails MeterDetailsClassification - // READ-ONLY; Represents Metering type (eg one-time or recurrent) + // READ-ONLY; Represents Metering type (eg one-time or recurrent). MeteringType *MeteringType - // READ-ONLY; Represents Billing type name + // READ-ONLY; Represents Billing type name. Name *string + + // READ-ONLY; Represent Term Type details. + TermTypeDetails *TermTypeDetails } // CancellationReason - Reason for cancellation. @@ -137,115 +134,223 @@ type CancellationReason struct { Reason *string } -// CommonProperties - Represents common properties across product hierarchy -type CommonProperties struct { +// CategoryInformation - Category related properties of a child configuration. +type CategoryInformation struct { + // Category display name of the child configuration. + CategoryDisplayName *string + + // Category name of the child configuration. + CategoryName *string + + // Description text for the category. + Description *string + + // Links for the category. + Links []*Link +} + +// ChildConfiguration - Child configuration object. +type ChildConfiguration struct { + // READ-ONLY; Properties of child configuration. + Properties *ChildConfigurationProperties +} + +// ChildConfigurationFilter - Child configuration filter. +type ChildConfigurationFilter struct { + // Filter to fetch all child configurations belonging to the given list of configuration types. + ChildConfigurationTypes []*ChildConfigurationType + + // The list of child configuration hierarchy customer wants to filter for the given configuration. + HierarchyInformations []*HierarchyInformation +} + +// ChildConfigurationProperties - Properties of child configuration. +type ChildConfigurationProperties struct { // READ-ONLY; Availability information of the product system. AvailabilityInformation *AvailabilityInformation + // READ-ONLY; Child configuration type. + ChildConfigurationType *ChildConfigurationType + + // READ-ONLY; Different types of child configurations which exist for this configuration, these can be used to populate the + // child configuration filter. + ChildConfigurationTypes []*ChildConfigurationType + // READ-ONLY; Cost information for the product system. CostInformation *CostInformation // READ-ONLY; Description related to the product system. Description *Description + // READ-ONLY; Dimensions of the configuration. + Dimensions *Dimensions + // READ-ONLY; Display Name for the product system. DisplayName *string - // READ-ONLY; list of filters supported for a product + // READ-ONLY; List of filters supported for a product. FilterableProperties []*FilterableProperty + // READ-ONLY; The entity responsible for fulfillment of the item at the given hierarchy level. + FulfilledBy *FulfillmentType + + // READ-ONLY; Child configurations present for the configuration after applying child configuration filter, grouped by the + // category name of the child configuration. + GroupedChildConfigurations []*GroupedChildConfigurations + // READ-ONLY; Hierarchy information of a product. HierarchyInformation *HierarchyInformation // READ-ONLY; Image information for the product system. ImageInformation []*ImageInformation + + // 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 + + // READ-ONLY; Maximum quantity a customer can order while choosing this configuration. + MaximumQuantity *int32 + + // READ-ONLY; Minimum quantity a customer can order while choosing this configuration. + MinimumQuantity *int32 + + // READ-ONLY; Determining nature of provisioning that the configuration supports. + ProvisioningSupport *ProvisioningSupport + + // READ-ONLY; Specifications of the configuration. + Specifications []*Specification + + // READ-ONLY; The Term Commitment Durations that are supported for a configuration. + SupportedTermCommitmentDurations []*string } // Configuration object. type Configuration struct { - // READ-ONLY; Properties of configuration + // READ-ONLY; Properties of configuration. Properties *ConfigurationProperties } -// 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 + + // READ-ONLY; List of device details. + DeviceDetails []*DeviceDetails + + // READ-ONLY; Hierarchy of the product which uniquely identifies the configuration. HierarchyInformation *HierarchyInformation - // Filters specific to product + // READ-ONLY; Identification type of the configuration. + IdentificationType *IdentificationType + + // READ-ONLY; Quantity of the product. + Quantity *int32 + + // READ-ONLY; Term Commitment Information of the Device. + TermCommitmentInformation *TermCommitmentInformation +} + +// ConfigurationFilter - Configuration filters. +type ConfigurationFilter struct { + // REQUIRED; Product hierarchy information. + HierarchyInformation *HierarchyInformation + + // 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 + + // Filters specific to product. FilterableProperty []*FilterableProperty } -// ConfigurationProperties - Properties of configuration +// ConfigurationProperties - Properties of configuration. type ConfigurationProperties struct { // READ-ONLY; Availability information of the product system. AvailabilityInformation *AvailabilityInformation + // READ-ONLY; Different types of child configurations which exist for this configuration, these can be used to populate the + // child configuration filter. + ChildConfigurationTypes []*ChildConfigurationType + // READ-ONLY; Cost information for the product system. CostInformation *CostInformation // READ-ONLY; Description related to the product system. Description *Description - // READ-ONLY; Dimensions of the configuration + // READ-ONLY; Dimensions of the configuration. Dimensions *Dimensions // READ-ONLY; Display Name for the product system. DisplayName *string - // READ-ONLY; list of filters supported for a product + // READ-ONLY; List of filters supported for a product. FilterableProperties []*FilterableProperty + // READ-ONLY; The entity responsible for fulfillment of the item at the given hierarchy level. + FulfilledBy *FulfillmentType + + // READ-ONLY; Child configurations present for the configuration after applying child configuration filter, grouped by the + // category name of the child configuration. + GroupedChildConfigurations []*GroupedChildConfigurations + // READ-ONLY; Hierarchy information of a product. HierarchyInformation *HierarchyInformation // READ-ONLY; Image information for the product system. ImageInformation []*ImageInformation - // READ-ONLY; Specifications of the configuration + // READ-ONLY; Determining nature of provisioning that the configuration supports. + ProvisioningSupport *ProvisioningSupport + + // READ-ONLY; Specifications of the configuration. Specifications []*Specification + + // READ-ONLY; The Term Commitment Durations that are supported for a configuration. + SupportedTermCommitmentDurations []*string } // Configurations - The list of configurations. type Configurations struct { - // Link for the next set of configurations. - NextLink *string - - // READ-ONLY; List of configurations. + // READ-ONLY; The Configuration items on this page Value []*Configuration + + // The link to the next page of items + NextLink *string } // ConfigurationsRequest - Configuration request object. type ConfigurationsRequest struct { - // REQUIRED; Holds details about product hierarchy information and filterable property. - ConfigurationFilters []*ConfigurationFilters + // Holds details about product hierarchy information and filterable property. + ConfigurationFilter *ConfigurationFilter // Customer subscription properties. Clients can display available products to unregistered customers by explicitly passing - // subscription details + // subscription details. CustomerSubscriptionDetails *CustomerSubscriptionDetails } // ContactDetails - Contact Details. type ContactDetails struct { - // REQUIRED; Contact name of the person. + // Contact name of the person. ContactName *string - // REQUIRED; List of Email-ids to be notified about job progress. + // List of Email-ids to be notified about job progress. EmailList []*string - // REQUIRED; Phone number of the contact person. - Phone *string - // Mobile number of the contact person. Mobile *string + // Phone number of the contact person. + Phone *string + // Phone extension number of the contact person. PhoneExtension *string } -// 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 // READ-ONLY; Details on the various billing aspects for the product system. @@ -253,24 +358,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 - // Location placement Id of a subscription + // Location placement Id of a subscription. LocationPlacementID *string - // List of registered feature flags for subscription + // List of registered feature flags for subscription. RegisteredFeatures []*CustomerSubscriptionRegisteredFeatures } -// 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 - // State of subscription registered feature + // State of subscription registered feature. State *string } @@ -297,16 +402,34 @@ type Description struct { // DeviceDetails - Device details. type DeviceDetails struct { - // READ-ONLY; Management Resource Id + // READ-ONLY; Device serial number to be displayed. + DisplaySerialNumber *string + + // READ-ONLY; Management Resource Id. ManagementResourceID *string - // READ-ONLY; Management Resource Tenant ID + // READ-ONLY; Management Resource Tenant ID. ManagementResourceTenantID *string - // READ-ONLY; device serial number + // READ-ONLY; Provisioning Details for the device. + ProvisioningDetails *ProvisioningDetails + + // READ-ONLY; Determining nature of provisioning that the configuration supports. + ProvisioningSupport *ProvisioningSupport + + // READ-ONLY; Device serial number. SerialNumber *string } +// DevicePresenceVerificationDetails - Proof of possession details. +type DevicePresenceVerificationDetails struct { + // READ-ONLY; Insights on current status. + Message *string + + // READ-ONLY; Proof of possession status. + Status *DevicePresenceVerificationStatus +} + // Dimensions of a configuration. type Dimensions struct { // READ-ONLY; Depth of the device. @@ -331,16 +454,16 @@ type Dimensions struct { Width *float64 } -// 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 - // READ-ONLY; Product family display name + // READ-ONLY; Product family display name. ProductFamilyDisplayName *string } -// 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,12 +473,15 @@ type EncryptionPreferences struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info any + Info *ErrorAdditionalInfoInfo // READ-ONLY; The additional info type. Type *string } +type ErrorAdditionalInfoInfo struct { +} + // ErrorDetail - The error detail. type ErrorDetail struct { // READ-ONLY; The error additional info. @@ -374,13 +500,6 @@ type ErrorDetail struct { Target *string } -// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type ErrorResponse struct { - // The error object. - Error *ErrorDetail -} - // FilterableProperty - Different types of filters supported and its values. type FilterableProperty struct { // REQUIRED; Values to be filtered. @@ -398,53 +517,65 @@ type ForwardShippingDetails struct { // READ-ONLY; Name of the carrier. CarrierName *string - // READ-ONLY; TrackingId of the package + // READ-ONLY; TrackingId of the package. TrackingID *string // READ-ONLY; TrackingUrl of the package. TrackingURL *string } -// HierarchyInformation - Holds details about product hierarchy information +// GroupedChildConfigurations - Grouped child configuration object. +type GroupedChildConfigurations struct { + // READ-ONLY; Category information. + CategoryInformation *CategoryInformation + + // READ-ONLY; List of child configurations. + ChildConfigurations []*ChildConfiguration +} + +// HierarchyInformation - Holds details about product hierarchy information. type HierarchyInformation struct { - // Represents configuration name that uniquely identifies configuration + // Represents Model Display Name. + ConfigurationIDDisplayName *string + + // Represents configuration name that uniquely identifies configuration. ConfigurationName *string - // Represents product family name that uniquely identifies product family + // Represents product family name that uniquely identifies product family. ProductFamilyName *string - // Represents product line name that uniquely identifies product line + // Represents product line name that uniquely identifies product line. ProductLineName *string - // Represents product name that uniquely identifies product + // Represents product name that uniquely identifies product. ProductName *string } -// 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 - // READ-ONLY; Url of the image + // READ-ONLY; Url of the image. ImageURL *string } -// 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 - // READ-ONLY; Url of the link + // READ-ONLY; Url of the link. LinkURL *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 } -// 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 @@ -452,7 +583,7 @@ type MeterDetails struct { // READ-ONLY; Charging type. ChargingType *ChargingType - // READ-ONLY; Billing unit applicable for Pav2 billing + // READ-ONLY; Billing unit applicable for Pav2 billing. Multiplier *float64 } @@ -468,16 +599,22 @@ type NotificationPreference struct { StageName *NotificationStageName } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// OkResponse - The request has succeeded. +type OkResponse struct { +} + +// Operation - REST API Operation +// +// Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + // READ-ONLY; Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane - // operations. + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/control-plane operations. IsDataAction *bool // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", @@ -489,7 +626,7 @@ type Operation struct { Origin *Origin } -// OperationDisplay - Localized display information for this particular operation. +// OperationDisplay - Localized display information for and operation. type OperationDisplay struct { // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string @@ -510,34 +647,40 @@ type OperationDisplay struct { // OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to // get the next set of results. type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string - - // READ-ONLY; List of operations supported by the resource provider + // REQUIRED; The Operation items on this page Value []*Operation + + // The link to the next page of items + NextLink *string } -// OrderItemDetails - Order item details +// OrderItemDetails - Order item details. type OrderItemDetails struct { // REQUIRED; Order item type. OrderItemType *OrderItemType - // REQUIRED; Unique identifier for configuration. + // REQUIRED; Represents product details. ProductDetails *ProductDetails - // Additional notification email list + // Additional notification email list. NotificationEmailList []*string - // Customer notification Preferences + // Defines the mode of the Order item. + OrderItemMode *OrderMode + + // Customer notification Preferences. Preferences *Preferences + // Site Related Details. + SiteDetails *SiteDetails + // READ-ONLY; Cancellation reason. CancellationReason *string // READ-ONLY; Describes whether the order item is cancellable or not. CancellationStatus *OrderItemCancellationEnum - // READ-ONLY; Current Order item Status + // READ-ONLY; Current Order item Status. CurrentStage *StageDetails // READ-ONLY; Describes whether the order item is deletable or not. @@ -546,16 +689,13 @@ type OrderItemDetails struct { // READ-ONLY; Top level error for the job. Error *ErrorDetail - // READ-ONLY; Forward Package Shipping details + // READ-ONLY; Forward Package Shipping details. ForwardShippingDetails *ForwardShippingDetails - // READ-ONLY; Parent RP details - this returns only the first or default parent RP from the entire list - ManagementRpDetails *ResourceProviderDetails - // READ-ONLY; List of parent RP details supported for configuration. ManagementRpDetailsList []*ResourceProviderDetails - // READ-ONLY; Order item status history + // READ-ONLY; Order item status history. OrderItemStageHistory []*StageDetails // READ-ONLY; Return reason. @@ -564,61 +704,79 @@ type OrderItemDetails struct { // READ-ONLY; Describes whether the order item is returnable or not. ReturnStatus *OrderItemReturnEnum - // READ-ONLY; Reverse Package Shipping details + // READ-ONLY; Reverse Package Shipping details. ReverseShippingDetails *ReverseShippingDetails } -// OrderItemProperties - Represents order item details. -type OrderItemProperties struct { - // REQUIRED; Represents shipping and return address for order item - AddressDetails *AddressDetails +// OrderItemDetailsUpdateParameter - Order item details Patchable Properties. +type OrderItemDetailsUpdateParameter struct { + // Represents product details. + ProductDetails *ProductDetailsUpdateParameter - // REQUIRED; Id of the order to which order item belongs to + // Site Related Details. + SiteDetails *SiteDetails +} + +// OrderItemProperties - Represents order item properties. +type OrderItemProperties struct { + // REQUIRED; Id of the order to which order item belongs to. OrderID *string // REQUIRED; Represents order item details. OrderItemDetails *OrderItemDetails - // READ-ONLY; Start time of order item + // Represents shipping and return address for order item. + AddressDetails *AddressDetails + + // READ-ONLY; Provisioning state + ProvisioningState *ProvisioningState + + // READ-ONLY; Start time of order item. StartTime *time.Time } -// OrderItemResource - Represents order item contract +// OrderItemResource - Represents order item resource. type OrderItemResource struct { // REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; Order item properties + // REQUIRED; Order item properties. Properties *OrderItemProperties + // READ-ONLY; The name of the order item. + Name *string + + // Msi identity of the resource + Identity *ResourceIdentity + // Resource tags. Tags map[string]*string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Represents resource creation and update time + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// OrderItemResourceList - List of orderItems. +// OrderItemResourceList - List of order items. type OrderItemResourceList struct { - // Link for the next set of order item resources. - NextLink *string - - // READ-ONLY; List of order item resources. + // READ-ONLY; The OrderItemResource items on this page Value []*OrderItemResource + + // The link to the next page of items + NextLink *string } // OrderItemUpdateParameter - Updates order item parameters. type OrderItemUpdateParameter struct { - // Order item update properties + // Msi identity of the resource + Identity *ResourceIdentity + + // Order item update properties. Properties *OrderItemUpdateProperties // The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across @@ -634,6 +792,9 @@ type OrderItemUpdateProperties struct { // Additional notification email list. NotificationEmailList []*string + // Represents order item details. + OrderItemDetails *OrderItemDetailsUpdateParameter + // Customer preference. Preferences *Preferences } @@ -646,22 +807,25 @@ type OrderProperties struct { // READ-ONLY; List of order item ARM Ids which are part of an order. OrderItemIDs []*string + // READ-ONLY; Order mode. + OrderMode *OrderMode + // READ-ONLY; Order status history. OrderStageHistory []*StageDetails } // 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 + // READ-ONLY; The name of the order. + Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Represents resource creation and update time + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -670,14 +834,14 @@ type OrderResource struct { // OrderResourceList - List of orders. type OrderResourceList struct { - // Link for the next set of order resources. - NextLink *string - - // READ-ONLY; List of order resources. + // READ-ONLY; The OrderResource items on this page Value []*OrderResource + + // The link to the next page of items + NextLink *string } -// Pav2MeterDetails - Billing type PAV2 meter details +// Pav2MeterDetails - Billing type PAV2 meter details. type Pav2MeterDetails struct { // REQUIRED; Represents billing type. BillingType *BillingType @@ -688,7 +852,7 @@ type Pav2MeterDetails struct { // READ-ONLY; Validation status of requested data center and transport. MeterGUID *string - // READ-ONLY; Billing unit applicable for Pav2 billing + // READ-ONLY; Billing unit applicable for Pav2 billing. Multiplier *float64 } @@ -701,7 +865,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 @@ -712,55 +876,76 @@ type Preferences struct { // Notification preferences. NotificationPreferences []*NotificationPreference + // Preferences related to the Term commitment. + TermCommitmentPreferences *TermCommitmentPreferences + // Preferences related to the shipment logistics of the order. TransportPreferences *TransportPreferences } -// Product - List of Products +// Product - Represents a product. type Product struct { - // READ-ONLY; Properties of product + // READ-ONLY; Properties of product. Properties *ProductProperties } -// 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 - // Display details of the product + // Display details of the product. DisplayInfo *DisplayInfo - // READ-ONLY; Quantity of the product - Count *int32 + // List of additional configurations customer wants in the order item apart from the ones included in the base configuration. + OptInAdditionalConfigurations []*AdditionalConfiguration - // READ-ONLY; list of device details - DeviceDetails []*DeviceDetails + // Device Provisioning Details for Parent. + ParentProvisioningDetails *ProvisioningDetails + + // READ-ONLY; Details of all child configurations that are part of the order item. + ChildConfigurationDeviceDetails []*ConfigurationDeviceDetails + + // READ-ONLY; Identification type of the configuration. + IdentificationType *IdentificationType + + // READ-ONLY; Device details of the parent configuration. + ParentDeviceDetails *DeviceDetails // READ-ONLY; Double encryption status of the configuration. Read-only field. ProductDoubleEncryptionStatus *DoubleEncryptionStatus + + // READ-ONLY; Term Commitment Information of the Device. + TermCommitmentInformation *TermCommitmentInformation +} + +// ProductDetailsUpdateParameter - Represents product details patchable properties. +type ProductDetailsUpdateParameter struct { + // Device Provisioning Details for Parent. + ParentProvisioningDetails *ProvisioningDetails } // ProductFamilies - The list of product families. type ProductFamilies struct { - // Link for the next set of product families. - NextLink *string - - // READ-ONLY; List of product families. + // READ-ONLY; The ProductFamily items on this page Value []*ProductFamily -} -// ProductFamiliesMetadata - Holds details about product family metadata -type ProductFamiliesMetadata struct { - // READ-ONLY; Link for the next set of product families. + // The link to the next page of items NextLink *string +} - // READ-ONLY; List of product family metadata details. +// ProductFamiliesMetadata - Holds details about product family metadata. +type ProductFamiliesMetadata struct { + // READ-ONLY; The ProductFamiliesMetadataDetails items on this page Value []*ProductFamiliesMetadataDetails + + // The link to the next page of items + NextLink *string } // ProductFamiliesMetadataDetails - Product families metadata details. type ProductFamiliesMetadataDetails struct { - // READ-ONLY; Product family properties + // READ-ONLY; Product family properties. Properties *ProductFamilyProperties } @@ -770,19 +955,19 @@ type ProductFamiliesRequest struct { FilterableProperties map[string][]*FilterableProperty // Customer subscription properties. Clients can display available products to unregistered customers by explicitly passing - // subscription details + // subscription details. CustomerSubscriptionDetails *CustomerSubscriptionDetails } -// ProductFamily - Product Family +// ProductFamily - Product Family. type ProductFamily struct { - // READ-ONLY; Properties of product family + // READ-ONLY; Properties of product family. Properties *ProductFamilyProperties } -// 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 // READ-ONLY; Availability information of the product system. @@ -797,26 +982,29 @@ type ProductFamilyProperties struct { // READ-ONLY; Display Name for the product system. DisplayName *string - // READ-ONLY; list of filters supported for a product + // READ-ONLY; List of filters supported for a product. FilterableProperties []*FilterableProperty + // READ-ONLY; The entity responsible for fulfillment of the item at the given hierarchy level. + FulfilledBy *FulfillmentType + // READ-ONLY; Hierarchy information of a product. HierarchyInformation *HierarchyInformation // READ-ONLY; Image information for the product system. ImageInformation []*ImageInformation - // READ-ONLY; List of product lines supported in the product family + // READ-ONLY; List of product lines supported in the product family. ProductLines []*ProductLine } -// ProductLine - Product line +// ProductLine - Product line. type ProductLine struct { - // READ-ONLY; Properties of product line + // READ-ONLY; Properties of product line. Properties *ProductLineProperties } -// ProductLineProperties - Properties of product line +// ProductLineProperties - Properties of product line. type ProductLineProperties struct { // READ-ONLY; Availability information of the product system. AvailabilityInformation *AvailabilityInformation @@ -830,25 +1018,28 @@ type ProductLineProperties struct { // READ-ONLY; Display Name for the product system. DisplayName *string - // READ-ONLY; list of filters supported for a product + // READ-ONLY; List of filters supported for a product. FilterableProperties []*FilterableProperty + // READ-ONLY; The entity responsible for fulfillment of the item at the given hierarchy level. + FulfilledBy *FulfillmentType + // READ-ONLY; Hierarchy information of a product. HierarchyInformation *HierarchyInformation // READ-ONLY; Image information for the product system. ImageInformation []*ImageInformation - // READ-ONLY; List of products in the product line + // READ-ONLY; List of products in the product line. Products []*Product } -// ProductProperties - Properties of products +// ProductProperties - Properties of product. type ProductProperties struct { // READ-ONLY; Availability information of the product system. AvailabilityInformation *AvailabilityInformation - // READ-ONLY; List of configurations for the product + // READ-ONLY; List of configurations for the product. Configurations []*Configuration // READ-ONLY; Cost information for the product system. @@ -860,9 +1051,12 @@ type ProductProperties struct { // READ-ONLY; Display Name for the product system. DisplayName *string - // READ-ONLY; list of filters supported for a product + // READ-ONLY; List of filters supported for a product. FilterableProperties []*FilterableProperty + // READ-ONLY; The entity responsible for fulfillment of the item at the given hierarchy level. + FulfilledBy *FulfillmentType + // READ-ONLY; Hierarchy information of a product. HierarchyInformation *HierarchyInformation @@ -870,20 +1064,40 @@ type ProductProperties struct { ImageInformation []*ImageInformation } -// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a -// location -type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string +// ProvisioningDetails - Details Related To Provision Resource. +type ProvisioningDetails struct { + // Auto Provisioning Details. + AutoProvisioningStatus *AutoProvisioningStatus - // READ-ONLY; The name of the resource - Name *string + // Proof of possession details. + DevicePresenceVerification *DevicePresenceVerificationDetails - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string + // Management Resource ArmId. + ManagementResourceArmID *string + + // Provisioning Resource Arm ID. + ProvisioningArmID *string + + // Provisioning End Point. + ProvisioningEndPoint *string + + // Quantity of the devices. + Quantity *int32 + + // Arc Enabled Resource Arm id. + ReadyToConnectArmID *string + + // Serial Number for the Device. + SerialNumber *string + + // Vendor Name for the Device , (for 1P devices - Microsoft). + VendorName *string + + // READ-ONLY; Unique Identity for a Device. + UniqueDeviceIdentifier *string } -// PurchaseMeterDetails - Billing type Purchase meter details +// PurchaseMeterDetails - Billing type Purchase meter details. type PurchaseMeterDetails struct { // REQUIRED; Represents billing type. BillingType *BillingType @@ -891,16 +1105,16 @@ type PurchaseMeterDetails struct { // READ-ONLY; Charging type. ChargingType *ChargingType - // READ-ONLY; Billing unit applicable for Pav2 billing + // READ-ONLY; Billing unit applicable for Pav2 billing. Multiplier *float64 - // READ-ONLY; Product Id + // READ-ONLY; Product Id. ProductID *string - // READ-ONLY; Sku Id + // READ-ONLY; Sku Id. SKUID *string - // READ-ONLY; Term Id + // READ-ONLY; Term Id. TermID *string } @@ -913,23 +1127,14 @@ func (p *PurchaseMeterDetails) GetMeterDetails() *MeterDetails { } } -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - // ResourceIdentity - Msi identity details of the resource type ResourceIdentity struct { // Identity type Type *string + // User Assigned Identities + UserAssignedIdentities map[string]*UserAssignedIdentity + // READ-ONLY; Service Principal Id backing the Msi PrincipalID *string @@ -937,24 +1142,24 @@ type ResourceIdentity struct { TenantID *string } -// ResourceProviderDetails - Management RP details +// ResourceProviderDetails - Management RP details. type ResourceProviderDetails struct { - // READ-ONLY; Resource provider namespace + // READ-ONLY; Resource provider namespace. ResourceProviderNamespace *string } -// ReturnOrderItemDetails - Return order item request body +// ReturnOrderItemDetails - Return order item request body. type ReturnOrderItemDetails struct { // REQUIRED; Return Reason. ReturnReason *string - // customer return address. + // Customer return address. ReturnAddress *AddressProperties - // Service tag (located on the bottom-right corner of the device) + // Service tag (located on the bottom-right corner of the device). ServiceTag *string - // Shipping Box required + // Shipping Box required. ShippingBoxRequired *bool } @@ -969,7 +1174,7 @@ type ReverseShippingDetails struct { // READ-ONLY; SAS key to download the reverse shipment label of the package. SasKeyForLabel *string - // READ-ONLY; TrackingId of the package + // READ-ONLY; TrackingId of the package. TrackingID *string // READ-ONLY; TrackingUrl of the package. @@ -981,9 +1186,6 @@ type ShippingAddress struct { // REQUIRED; Name of the Country. Country *string - // REQUIRED; Street Address line 1. - StreetAddress1 *string - // Type of address. AddressType *AddressType @@ -999,6 +1201,9 @@ type ShippingAddress struct { // Name of the State or Province. StateOrProvince *string + // Street Address line 1. + StreetAddress1 *string + // Street Address line 2. StreetAddress2 *string @@ -1009,27 +1214,18 @@ type ShippingAddress struct { ZipExtendedCode *string } -// ShippingDetails - Package shipping details -type ShippingDetails struct { - // READ-ONLY; Carrier Name for display purpose. Not to be used for any processing. - CarrierDisplayName *string - - // READ-ONLY; Name of the carrier. - CarrierName *string - - // READ-ONLY; TrackingId of the package - TrackingID *string - - // READ-ONLY; TrackingUrl of the package. - TrackingURL *string +// SiteDetails - Represents Site Related Details. +type SiteDetails struct { + // REQUIRED; Unique Id, Identifying A Site. + SiteID *string } -// 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 - // READ-ONLY; Value of the specification + // READ-ONLY; Value of the specification. Value *string } @@ -1038,13 +1234,13 @@ type StageDetails struct { // READ-ONLY; Display name of the resource stage. DisplayName *string - // READ-ONLY; Stage name + // READ-ONLY; Stage name. StageName *StageName // READ-ONLY; Stage status. StageStatus *StageStatus - // READ-ONLY; Stage start time + // READ-ONLY; Stage start time. StartTime *time.Time } @@ -1069,27 +1265,47 @@ type SystemData struct { LastModifiedByType *CreatedByType } -// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' -// and a 'location' -type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string +// TermCommitmentInformation - Term Commitment Information. +type TermCommitmentInformation struct { + // REQUIRED; Term Commitment Type + TermCommitmentType *TermCommitmentType - // Resource tags. - Tags map[string]*string + // READ-ONLY; Number of Days Pending for Term Commitment + PendingDaysForTerm *int32 - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string + // READ-ONLY; Term Commitment Duration. Currently Supporting P365D, P1095D + TermCommitmentTypeDuration *string +} - // READ-ONLY; The name of the resource - Name *string +// TermCommitmentPreferences - Term Commitment preference received from customer. +type TermCommitmentPreferences struct { + // REQUIRED; Term Commitment Type + PreferredTermCommitmentType *TermCommitmentType - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string + // Customer preferred Term Duration. + PreferredTermCommitmentDuration *string } -// TransportPreferences - Preferences related to the shipment logistics of the sku +// TermTypeDetails - Holds details about term type and duration. +type TermTypeDetails struct { + // REQUIRED; Term Commitment Type + TermType *TermCommitmentType + + // REQUIRED; Duration for the term type. + TermTypeDuration *string +} + +// TransportPreferences - Preferences related to the shipment logistics of the sku. type TransportPreferences struct { // REQUIRED; Indicates Shipment Logistics type that the customer preferred. PreferredShipmentType *TransportShipmentTypes } + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/models_serde.go b/sdk/resourcemanager/edgeorder/armedgeorder/models_serde.go index 63a64b8a7bb3..33dd72ded287 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/models_serde.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/models_serde.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armedgeorder @@ -15,6 +11,41 @@ import ( "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, "provisioningDetails", a.ProvisioningDetails) + 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 "provisioningDetails": + err = unpopulate(val, "ProvisioningDetails", &a.ProvisioningDetails) + 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) @@ -49,8 +80,10 @@ func (a *AddressDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AddressProperties. func (a AddressProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "addressClassification", a.AddressClassification) populate(objectMap, "addressValidationStatus", a.AddressValidationStatus) populate(objectMap, "contactDetails", a.ContactDetails) + populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "shippingAddress", a.ShippingAddress) return json.Marshal(objectMap) } @@ -64,12 +97,18 @@ func (a *AddressProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "addressClassification": + err = unpopulate(val, "AddressClassification", &a.AddressClassification) + delete(rawMsg, key) case "addressValidationStatus": err = unpopulate(val, "AddressValidationStatus", &a.AddressValidationStatus) delete(rawMsg, key) case "contactDetails": err = unpopulate(val, "ContactDetails", &a.ContactDetails) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) case "shippingAddress": err = unpopulate(val, "ShippingAddress", &a.ShippingAddress) delete(rawMsg, key) @@ -260,53 +299,6 @@ func (a *AvailabilityInformation) UnmarshalJSON(data []byte) error { 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, "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 "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) @@ -314,6 +306,7 @@ func (b BillingMeterDetails) MarshalJSON() ([]byte, error) { populate(objectMap, "meterDetails", b.MeterDetails) populate(objectMap, "meteringType", b.MeteringType) populate(objectMap, "name", b.Name) + populate(objectMap, "termTypeDetails", b.TermTypeDetails) return json.Marshal(objectMap) } @@ -338,6 +331,9 @@ func (b *BillingMeterDetails) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &b.Name) delete(rawMsg, key) + case "termTypeDetails": + err = unpopulate(val, "TermTypeDetails", &b.TermTypeDetails) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", b, err) @@ -373,21 +369,129 @@ func (c *CancellationReason) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CommonProperties. -func (c CommonProperties) MarshalJSON() ([]byte, error) { +// 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, "provisioningSupport", c.ProvisioningSupport) + populate(objectMap, "specifications", c.Specifications) + populate(objectMap, "supportedTermCommitmentDurations", c.SupportedTermCommitmentDurations) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CommonProperties. -func (c *CommonProperties) UnmarshalJSON(data []byte) error { +// 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) @@ -398,24 +502,57 @@ func (c *CommonProperties) UnmarshalJSON(data []byte) error { 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 "provisioningSupport": + err = unpopulate(val, "ProvisioningSupport", &c.ProvisioningSupport) + delete(rawMsg, key) + case "specifications": + err = unpopulate(val, "Specifications", &c.Specifications) + delete(rawMsg, key) + case "supportedTermCommitmentDurations": + err = unpopulate(val, "SupportedTermCommitmentDurations", &c.SupportedTermCommitmentDurations) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -451,16 +588,64 @@ func (c *Configuration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ConfigurationFilters. -func (c ConfigurationFilters) MarshalJSON() ([]byte, error) { +// 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) + populate(objectMap, "termCommitmentInformation", c.TermCommitmentInformation) + 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) + case "termCommitmentInformation": + err = unpopulate(val, "TermCommitmentInformation", &c.TermCommitmentInformation) + 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 ConfigurationFilters. -func (c *ConfigurationFilters) UnmarshalJSON(data []byte) error { +// 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) @@ -468,6 +653,9 @@ func (c *ConfigurationFilters) UnmarshalJSON(data []byte) error { 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) @@ -486,14 +674,19 @@ func (c *ConfigurationFilters) UnmarshalJSON(data []byte) error { 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, "provisioningSupport", c.ProvisioningSupport) populate(objectMap, "specifications", c.Specifications) + populate(objectMap, "supportedTermCommitmentDurations", c.SupportedTermCommitmentDurations) return json.Marshal(objectMap) } @@ -509,6 +702,9 @@ func (c *ConfigurationProperties) UnmarshalJSON(data []byte) error { 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) @@ -524,15 +720,27 @@ func (c *ConfigurationProperties) UnmarshalJSON(data []byte) error { 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 "provisioningSupport": + err = unpopulate(val, "ProvisioningSupport", &c.ProvisioningSupport) + delete(rawMsg, key) case "specifications": err = unpopulate(val, "Specifications", &c.Specifications) delete(rawMsg, key) + case "supportedTermCommitmentDurations": + err = unpopulate(val, "SupportedTermCommitmentDurations", &c.SupportedTermCommitmentDurations) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -575,7 +783,7 @@ func (c *Configurations) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ConfigurationsRequest. func (c ConfigurationsRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "configurationFilters", c.ConfigurationFilters) + populate(objectMap, "configurationFilter", c.ConfigurationFilter) populate(objectMap, "customerSubscriptionDetails", c.CustomerSubscriptionDetails) return json.Marshal(objectMap) } @@ -589,8 +797,8 @@ func (c *ConfigurationsRequest) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "configurationFilters": - err = unpopulate(val, "ConfigurationFilters", &c.ConfigurationFilters) + case "configurationFilter": + err = unpopulate(val, "ConfigurationFilter", &c.ConfigurationFilter) delete(rawMsg, key) case "customerSubscriptionDetails": err = unpopulate(val, "CustomerSubscriptionDetails", &c.CustomerSubscriptionDetails) @@ -793,8 +1001,11 @@ func (d *Description) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DeviceDetails. func (d DeviceDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "displaySerialNumber", d.DisplaySerialNumber) populate(objectMap, "managementResourceId", d.ManagementResourceID) populate(objectMap, "managementResourceTenantId", d.ManagementResourceTenantID) + populate(objectMap, "provisioningDetails", d.ProvisioningDetails) + populate(objectMap, "provisioningSupport", d.ProvisioningSupport) populate(objectMap, "serialNumber", d.SerialNumber) return json.Marshal(objectMap) } @@ -808,12 +1019,21 @@ func (d *DeviceDetails) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "displaySerialNumber": + err = unpopulate(val, "DisplaySerialNumber", &d.DisplaySerialNumber) + delete(rawMsg, key) case "managementResourceId": err = unpopulate(val, "ManagementResourceID", &d.ManagementResourceID) delete(rawMsg, key) case "managementResourceTenantId": err = unpopulate(val, "ManagementResourceTenantID", &d.ManagementResourceTenantID) delete(rawMsg, key) + case "provisioningDetails": + err = unpopulate(val, "ProvisioningDetails", &d.ProvisioningDetails) + delete(rawMsg, key) + case "provisioningSupport": + err = unpopulate(val, "ProvisioningSupport", &d.ProvisioningSupport) + delete(rawMsg, key) case "serialNumber": err = unpopulate(val, "SerialNumber", &d.SerialNumber) delete(rawMsg, key) @@ -825,6 +1045,37 @@ func (d *DeviceDetails) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DevicePresenceVerificationDetails. +func (d DevicePresenceVerificationDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", d.Message) + populate(objectMap, "status", d.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DevicePresenceVerificationDetails. +func (d *DevicePresenceVerificationDetails) UnmarshalJSON(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 "message": + err = unpopulate(val, "Message", &d.Message) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + 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) @@ -937,7 +1188,7 @@ func (e *EncryptionPreferences) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) + populate(objectMap, "info", e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -1008,33 +1259,6 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { 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) @@ -1105,9 +1329,41 @@ func (f *ForwardShippingDetails) UnmarshalJSON(data []byte) error { 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, "configurationIdDisplayName", h.ConfigurationIDDisplayName) populate(objectMap, "configurationName", h.ConfigurationName) populate(objectMap, "productFamilyName", h.ProductFamilyName) populate(objectMap, "productLineName", h.ProductLineName) @@ -1124,6 +1380,9 @@ func (h *HierarchyInformation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "configurationIdDisplayName": + err = unpopulate(val, "ConfigurationIDDisplayName", &h.ConfigurationIDDisplayName) + delete(rawMsg, key) case "configurationName": err = unpopulate(val, "ConfigurationName", &h.ConfigurationName) delete(rawMsg, key) @@ -1236,7 +1495,7 @@ func (m *ManagementResourcePreferences) UnmarshalJSON(data []byte) error { // 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, "billingType", m.BillingType) populate(objectMap, "chargingType", m.ChargingType) populate(objectMap, "multiplier", m.Multiplier) return json.Marshal(objectMap) @@ -1421,9 +1680,9 @@ func (o OrderItemDetails) MarshalJSON() ([]byte, error) { 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, "orderItemMode", o.OrderItemMode) populate(objectMap, "orderItemStageHistory", o.OrderItemStageHistory) populate(objectMap, "orderItemType", o.OrderItemType) populate(objectMap, "preferences", o.Preferences) @@ -1431,6 +1690,7 @@ func (o OrderItemDetails) MarshalJSON() ([]byte, error) { populate(objectMap, "returnReason", o.ReturnReason) populate(objectMap, "returnStatus", o.ReturnStatus) populate(objectMap, "reverseShippingDetails", o.ReverseShippingDetails) + populate(objectMap, "siteDetails", o.SiteDetails) return json.Marshal(objectMap) } @@ -1461,15 +1721,15 @@ func (o *OrderItemDetails) UnmarshalJSON(data []byte) error { case "forwardShippingDetails": err = unpopulate(val, "ForwardShippingDetails", &o.ForwardShippingDetails) delete(rawMsg, key) - case "managementRpDetails": - err = unpopulate(val, "ManagementRpDetails", &o.ManagementRpDetails) - 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) @@ -1491,6 +1751,40 @@ func (o *OrderItemDetails) UnmarshalJSON(data []byte) error { case "reverseShippingDetails": err = unpopulate(val, "ReverseShippingDetails", &o.ReverseShippingDetails) delete(rawMsg, key) + case "siteDetails": + err = unpopulate(val, "SiteDetails", &o.SiteDetails) + 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 OrderItemDetailsUpdateParameter. +func (o OrderItemDetailsUpdateParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "productDetails", o.ProductDetails) + populate(objectMap, "siteDetails", o.SiteDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrderItemDetailsUpdateParameter. +func (o *OrderItemDetailsUpdateParameter) UnmarshalJSON(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 "productDetails": + err = unpopulate(val, "ProductDetails", &o.ProductDetails) + delete(rawMsg, key) + case "siteDetails": + err = unpopulate(val, "SiteDetails", &o.SiteDetails) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -1505,6 +1799,7 @@ func (o OrderItemProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "addressDetails", o.AddressDetails) populate(objectMap, "orderId", o.OrderID) populate(objectMap, "orderItemDetails", o.OrderItemDetails) + populate(objectMap, "provisioningState", o.ProvisioningState) populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) return json.Marshal(objectMap) } @@ -1527,6 +1822,9 @@ func (o *OrderItemProperties) UnmarshalJSON(data []byte) error { case "orderItemDetails": err = unpopulate(val, "OrderItemDetails", &o.OrderItemDetails) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + delete(rawMsg, key) case "startTime": err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) delete(rawMsg, key) @@ -1542,6 +1840,7 @@ func (o *OrderItemProperties) UnmarshalJSON(data []byte) error { func (o OrderItemResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", o.ID) + populate(objectMap, "identity", o.Identity) populate(objectMap, "location", o.Location) populate(objectMap, "name", o.Name) populate(objectMap, "properties", o.Properties) @@ -1563,6 +1862,9 @@ func (o *OrderItemResource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &o.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &o.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &o.Location) delete(rawMsg, key) @@ -1623,6 +1925,7 @@ func (o *OrderItemResourceList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OrderItemUpdateParameter. func (o OrderItemUpdateParameter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "identity", o.Identity) populate(objectMap, "properties", o.Properties) populate(objectMap, "tags", o.Tags) return json.Marshal(objectMap) @@ -1637,6 +1940,9 @@ func (o *OrderItemUpdateParameter) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "identity": + err = unpopulate(val, "Identity", &o.Identity) + delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &o.Properties) delete(rawMsg, key) @@ -1656,6 +1962,7 @@ func (o OrderItemUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "forwardAddress", o.ForwardAddress) populate(objectMap, "notificationEmailList", o.NotificationEmailList) + populate(objectMap, "orderItemDetails", o.OrderItemDetails) populate(objectMap, "preferences", o.Preferences) return json.Marshal(objectMap) } @@ -1675,6 +1982,9 @@ func (o *OrderItemUpdateProperties) UnmarshalJSON(data []byte) error { case "notificationEmailList": err = unpopulate(val, "NotificationEmailList", &o.NotificationEmailList) delete(rawMsg, key) + case "orderItemDetails": + err = unpopulate(val, "OrderItemDetails", &o.OrderItemDetails) + delete(rawMsg, key) case "preferences": err = unpopulate(val, "Preferences", &o.Preferences) delete(rawMsg, key) @@ -1691,6 +2001,7 @@ 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) } @@ -1710,6 +2021,9 @@ func (o *OrderProperties) UnmarshalJSON(data []byte) error { 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) @@ -1840,6 +2154,7 @@ func (p Preferences) MarshalJSON() ([]byte, error) { populate(objectMap, "encryptionPreferences", p.EncryptionPreferences) populate(objectMap, "managementResourcePreferences", p.ManagementResourcePreferences) populate(objectMap, "notificationPreferences", p.NotificationPreferences) + populate(objectMap, "termCommitmentPreferences", p.TermCommitmentPreferences) populate(objectMap, "transportPreferences", p.TransportPreferences) return json.Marshal(objectMap) } @@ -1862,6 +2177,9 @@ func (p *Preferences) UnmarshalJSON(data []byte) error { case "notificationPreferences": err = unpopulate(val, "NotificationPreferences", &p.NotificationPreferences) delete(rawMsg, key) + case "termCommitmentPreferences": + err = unpopulate(val, "TermCommitmentPreferences", &p.TermCommitmentPreferences) + delete(rawMsg, key) case "transportPreferences": err = unpopulate(val, "TransportPreferences", &p.TransportPreferences) delete(rawMsg, key) @@ -1903,11 +2221,15 @@ func (p *Product) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProductDetails. func (p ProductDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", p.Count) - populate(objectMap, "deviceDetails", p.DeviceDetails) + 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, "parentProvisioningDetails", p.ParentProvisioningDetails) populate(objectMap, "productDoubleEncryptionStatus", p.ProductDoubleEncryptionStatus) + populate(objectMap, "termCommitmentInformation", p.TermCommitmentInformation) return json.Marshal(objectMap) } @@ -1920,11 +2242,8 @@ func (p *ProductDetails) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &p.Count) - delete(rawMsg, key) - case "deviceDetails": - err = unpopulate(val, "DeviceDetails", &p.DeviceDetails) + case "childConfigurationDeviceDetails": + err = unpopulate(val, "ChildConfigurationDeviceDetails", &p.ChildConfigurationDeviceDetails) delete(rawMsg, key) case "displayInfo": err = unpopulate(val, "DisplayInfo", &p.DisplayInfo) @@ -1932,9 +2251,51 @@ func (p *ProductDetails) UnmarshalJSON(data []byte) error { 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 "parentProvisioningDetails": + err = unpopulate(val, "ParentProvisioningDetails", &p.ParentProvisioningDetails) + delete(rawMsg, key) case "productDoubleEncryptionStatus": err = unpopulate(val, "ProductDoubleEncryptionStatus", &p.ProductDoubleEncryptionStatus) delete(rawMsg, key) + case "termCommitmentInformation": + err = unpopulate(val, "TermCommitmentInformation", &p.TermCommitmentInformation) + 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 ProductDetailsUpdateParameter. +func (p ProductDetailsUpdateParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "parentProvisioningDetails", p.ParentProvisioningDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductDetailsUpdateParameter. +func (p *ProductDetailsUpdateParameter) UnmarshalJSON(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 "parentProvisioningDetails": + err = unpopulate(val, "ParentProvisioningDetails", &p.ParentProvisioningDetails) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -2098,6 +2459,7 @@ func (p ProductFamilyProperties) MarshalJSON() ([]byte, error) { 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) @@ -2129,6 +2491,9 @@ func (p *ProductFamilyProperties) UnmarshalJSON(data []byte) error { 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) @@ -2184,6 +2549,7 @@ func (p ProductLineProperties) MarshalJSON() ([]byte, error) { 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) @@ -2214,6 +2580,9 @@ func (p *ProductLineProperties) UnmarshalJSON(data []byte) error { 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) @@ -2240,6 +2609,7 @@ func (p ProductProperties) MarshalJSON() ([]byte, error) { 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) @@ -2272,6 +2642,9 @@ func (p *ProductProperties) UnmarshalJSON(data []byte) error { 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) @@ -2286,17 +2659,24 @@ func (p *ProductProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProvisioningDetails. +func (p ProvisioningDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) + populate(objectMap, "autoProvisioningStatus", p.AutoProvisioningStatus) + populate(objectMap, "devicePresenceVerification", p.DevicePresenceVerification) + populate(objectMap, "managementResourceArmId", p.ManagementResourceArmID) + populate(objectMap, "provisioningArmId", p.ProvisioningArmID) + populate(objectMap, "provisioningEndPoint", p.ProvisioningEndPoint) + populate(objectMap, "quantity", p.Quantity) + populate(objectMap, "readyToConnectArmId", p.ReadyToConnectArmID) + populate(objectMap, "serialNumber", p.SerialNumber) + populate(objectMap, "uniqueDeviceIdentifier", p.UniqueDeviceIdentifier) + populate(objectMap, "vendorName", p.VendorName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisioningDetails. +func (p *ProvisioningDetails) UnmarshalJSON(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) @@ -2304,14 +2684,35 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "autoProvisioningStatus": + err = unpopulate(val, "AutoProvisioningStatus", &p.AutoProvisioningStatus) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "devicePresenceVerification": + err = unpopulate(val, "DevicePresenceVerification", &p.DevicePresenceVerification) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "managementResourceArmId": + err = unpopulate(val, "ManagementResourceArmID", &p.ManagementResourceArmID) + delete(rawMsg, key) + case "provisioningArmId": + err = unpopulate(val, "ProvisioningArmID", &p.ProvisioningArmID) + delete(rawMsg, key) + case "provisioningEndPoint": + err = unpopulate(val, "ProvisioningEndPoint", &p.ProvisioningEndPoint) + delete(rawMsg, key) + case "quantity": + err = unpopulate(val, "Quantity", &p.Quantity) + delete(rawMsg, key) + case "readyToConnectArmId": + err = unpopulate(val, "ReadyToConnectArmID", &p.ReadyToConnectArmID) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &p.SerialNumber) + delete(rawMsg, key) + case "uniqueDeviceIdentifier": + err = unpopulate(val, "UniqueDeviceIdentifier", &p.UniqueDeviceIdentifier) + delete(rawMsg, key) + case "vendorName": + err = unpopulate(val, "VendorName", &p.VendorName) delete(rawMsg, key) } if err != nil { @@ -2368,47 +2769,13 @@ func (p *PurchaseMeterDetails) UnmarshalJSON(data []byte) error { 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 ResourceIdentity. func (r ResourceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "principalId", r.PrincipalID) populate(objectMap, "tenantId", r.TenantID) populate(objectMap, "type", r.Type) + populate(objectMap, "userAssignedIdentities", r.UserAssignedIdentities) return json.Marshal(objectMap) } @@ -2430,6 +2797,9 @@ func (r *ResourceIdentity) UnmarshalJSON(data []byte) error { case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &r.UserAssignedIdentities) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -2610,18 +2980,15 @@ func (s *ShippingAddress) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ShippingDetails. -func (s ShippingDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SiteDetails. +func (s SiteDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "carrierDisplayName", s.CarrierDisplayName) - populate(objectMap, "carrierName", s.CarrierName) - populate(objectMap, "trackingId", s.TrackingID) - populate(objectMap, "trackingUrl", s.TrackingURL) + populate(objectMap, "siteId", s.SiteID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ShippingDetails. -func (s *ShippingDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SiteDetails. +func (s *SiteDetails) UnmarshalJSON(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) @@ -2629,17 +2996,8 @@ func (s *ShippingDetails) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "carrierDisplayName": - err = unpopulate(val, "CarrierDisplayName", &s.CarrierDisplayName) - delete(rawMsg, key) - case "carrierName": - err = unpopulate(val, "CarrierName", &s.CarrierName) - delete(rawMsg, key) - case "trackingId": - err = unpopulate(val, "TrackingID", &s.TrackingID) - delete(rawMsg, key) - case "trackingUrl": - err = unpopulate(val, "TrackingURL", &s.TrackingURL) + case "siteId": + err = unpopulate(val, "SiteID", &s.SiteID) delete(rawMsg, key) } if err != nil { @@ -2766,19 +3124,17 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TermCommitmentInformation. +func (t TermCommitmentInformation) 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) + populate(objectMap, "pendingDaysForTerm", t.PendingDaysForTerm) + populate(objectMap, "termCommitmentType", t.TermCommitmentType) + populate(objectMap, "termCommitmentTypeDuration", t.TermCommitmentTypeDuration) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. -func (t *TrackedResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TermCommitmentInformation. +func (t *TermCommitmentInformation) UnmarshalJSON(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) @@ -2786,20 +3142,76 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) + case "pendingDaysForTerm": + err = unpopulate(val, "PendingDaysForTerm", &t.PendingDaysForTerm) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) + case "termCommitmentType": + err = unpopulate(val, "TermCommitmentType", &t.TermCommitmentType) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) + case "termCommitmentTypeDuration": + err = unpopulate(val, "TermCommitmentTypeDuration", &t.TermCommitmentTypeDuration) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TermCommitmentPreferences. +func (t TermCommitmentPreferences) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "preferredTermCommitmentDuration", t.PreferredTermCommitmentDuration) + populate(objectMap, "preferredTermCommitmentType", t.PreferredTermCommitmentType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TermCommitmentPreferences. +func (t *TermCommitmentPreferences) UnmarshalJSON(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 "preferredTermCommitmentDuration": + err = unpopulate(val, "PreferredTermCommitmentDuration", &t.PreferredTermCommitmentDuration) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "preferredTermCommitmentType": + err = unpopulate(val, "PreferredTermCommitmentType", &t.PreferredTermCommitmentType) + 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 TermTypeDetails. +func (t TermTypeDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "termType", t.TermType) + populate(objectMap, "termTypeDuration", t.TermTypeDuration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TermTypeDetails. +func (t *TermTypeDetails) UnmarshalJSON(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 "termType": + err = unpopulate(val, "TermType", &t.TermType) + delete(rawMsg, key) + case "termTypeDuration": + err = unpopulate(val, "TermTypeDuration", &t.TermTypeDuration) delete(rawMsg, key) } if err != nil { @@ -2836,28 +3248,49 @@ func (t *TransportPreferences) UnmarshalJSON(data []byte) error { 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 +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil } -func populateAny(m map[string]any, k string, v any) { +func populate(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { m[k] = nil - } else { + } else if !reflect.ValueOf(v).IsNil() { m[k] = v } } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != 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..3dcd3724c8d5 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/operations_client.go @@ -0,0 +1,84 @@ +// 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) Go Code Generator. 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" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2024-02-01 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.EdgeOrder/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01") + 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/operations_client_example_test.go b/sdk/resourcemanager/edgeorder/armedgeorder/operations_client_example_test.go new file mode 100644 index 000000000000..56845b9218dc --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/operations_client_example_test.go @@ -0,0 +1,208 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armedgeorder_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder/v2" + "log" +) + +// Generated from example definition: 2024-02-01/ListOperations.json +func ExampleOperationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armedgeorder.OperationsClientListResponse{ + // OperationListResult: armedgeorder.OperationListResult{ + // Value: []*armedgeorder.Operation{ + // { + // Name: to.Ptr("Microsoft.EdgeOrder/addresses/read"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("List or get the Addresses"), + // Operation: to.Ptr("List or Get Addresses"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("Addresses"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/addresses/delete"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("Delete the Addresses"), + // Operation: to.Ptr("Delete Addresses"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("Addresses"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/addresses/write"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("Create or update the Addresses"), + // Operation: to.Ptr("Create or Update Addresses"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("Addresses"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/locations/operationResults/read"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("List or get the Operation Results"), + // Operation: to.Ptr("List or Get Operation Results"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("Operation Results"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/operations/read"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("List or get the Operations"), + // Operation: to.Ptr("List or Get Operations"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("Operations"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/locations/orders/read"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("List or get the Order"), + // Operation: to.Ptr("List or Get Order"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("Order"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/orders/read"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("List or get the Order"), + // Operation: to.Ptr("List or Get Order"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("Order"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/orderItems/cancel/action"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("Cancels an OrderItem in progress."), + // Operation: to.Ptr("Cancel OrderItem"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("OrderItem"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/orderItems/return/action"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("Return an OrderItem."), + // Operation: to.Ptr("Return OrderItem"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("OrderItem"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/orderItems/read"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("List or get the OrderItem"), + // Operation: to.Ptr("List or Get OrderItem"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("OrderItem"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/orderItems/delete"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("Delete the OrderItem"), + // Operation: to.Ptr("Delete OrderItem"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("OrderItem"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/orderItems/write"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("Create or update the OrderItem"), + // Operation: to.Ptr("Create or Update OrderItem"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("OrderItem"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/productFamiliesMetadata/action"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("This method lists or gets the product families metadata."), + // Operation: to.Ptr("List or Get product families metadata"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("ArmApiRes_Microsoft.EdgeOrder"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/listProductFamilies/read"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("This method returns list of product families."), + // Operation: to.Ptr("List Product Families"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("ArmApiRes_Microsoft.EdgeOrder"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // { + // Name: to.Ptr("Microsoft.EdgeOrder/listConfigurations/action"), + // Display: &armedgeorder.OperationDisplay{ + // Description: to.Ptr("This method returns list of product configurations."), + // Operation: to.Ptr("List Product Configurations"), + // Provider: to.Ptr("Edge Ordering"), + // Resource: to.Ptr("ArmApiRes_Microsoft.EdgeOrder"), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armedgeorder.OriginUser), + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/options.go b/sdk/resourcemanager/edgeorder/armedgeorder/options.go index dc9031094a6b..6f8dd49a3c7b 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/options.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/options.go @@ -1,183 +1,198 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armedgeorder -// ManagementClientBeginCreateAddressOptions contains the optional parameters for the ManagementClient.BeginCreateAddress -// method. -type ManagementClientBeginCreateAddressOptions struct { - // Resumes the LRO from the provided token. +// AddressResourcesClientBeginCreateOptions contains the optional parameters for the AddressResourcesClient.BeginCreate method. +type AddressResourcesClientBeginCreateOptions struct { + // Resumes the long-running operation 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. +// AddressResourcesClientBeginDeleteOptions contains the optional parameters for the AddressResourcesClient.BeginDelete method. +type AddressResourcesClientBeginDeleteOptions struct { + // Resumes the long-running operation 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. +// AddressResourcesClientBeginUpdateOptions contains the optional parameters for the AddressResourcesClient.BeginUpdate method. +type AddressResourcesClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string + + // 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 } -// ManagementClientBeginDeleteOrderItemByNameOptions contains the optional parameters for the ManagementClient.BeginDeleteOrderItemByName -// method. -type ManagementClientBeginDeleteOrderItemByNameOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// AddressResourcesClientGetOptions contains the optional parameters for the AddressResourcesClient.Get method. +type AddressResourcesClientGetOptions struct { + // placeholder for future optional parameters } -// ManagementClientBeginReturnOrderItemOptions contains the optional parameters for the ManagementClient.BeginReturnOrderItem +// AddressResourcesClientListByResourceGroupOptions contains the optional parameters for the AddressResourcesClient.NewListByResourceGroupPager // method. -type ManagementClientBeginReturnOrderItemOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +type AddressResourcesClientListByResourceGroupOptions 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 } -// ManagementClientBeginUpdateAddressOptions contains the optional parameters for the ManagementClient.BeginUpdateAddress +// AddressResourcesClientListBySubscriptionOptions contains the optional parameters for the AddressResourcesClient.NewListBySubscriptionPager // 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 +type AddressResourcesClientListBySubscriptionOptions struct { + // $filter is supported to filter based on shipping address properties. Filter supports only equals operation. + Filter *string - // Resumes the LRO from the provided token. - ResumeToken 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 +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters } -// ManagementClientBeginUpdateOrderItemOptions contains the optional parameters for the ManagementClient.BeginUpdateOrderItem +// OrderItemResourcesClientBeginCreateOptions contains the optional parameters for the OrderItemResourcesClient.BeginCreate // 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 +type OrderItemResourcesClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} - // Resumes the LRO from the provided token. +// OrderItemResourcesClientBeginDeleteOptions contains the optional parameters for the OrderItemResourcesClient.BeginDelete +// method. +type OrderItemResourcesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } -// ManagementClientCancelOrderItemOptions contains the optional parameters for the ManagementClient.CancelOrderItem method. -type ManagementClientCancelOrderItemOptions struct { - // placeholder for future optional parameters +// OrderItemResourcesClientBeginReturnOrderItemOptions contains the optional parameters for the OrderItemResourcesClient.BeginReturnOrderItem +// method. +type OrderItemResourcesClientBeginReturnOrderItemOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string } -// ManagementClientGetAddressByNameOptions contains the optional parameters for the ManagementClient.GetAddressByName method. -type ManagementClientGetAddressByNameOptions struct { - // placeholder for future optional parameters +// OrderItemResourcesClientBeginUpdateOptions contains the optional parameters for the OrderItemResourcesClient.BeginUpdate +// method. +type OrderItemResourcesClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + + // 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 } -// ManagementClientGetOrderByNameOptions contains the optional parameters for the ManagementClient.GetOrderByName method. -type ManagementClientGetOrderByNameOptions struct { +// OrderItemResourcesClientCancelOptions contains the optional parameters for the OrderItemResourcesClient.Cancel method. +type OrderItemResourcesClientCancelOptions 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. +// OrderItemResourcesClientGetOptions contains the optional parameters for the OrderItemResourcesClient.Get method. +type OrderItemResourcesClientGetOptions 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 } -// ManagementClientListAddressesAtResourceGroupLevelOptions contains the optional parameters for the ManagementClient.NewListAddressesAtResourceGroupLevelPager +// OrderItemResourcesClientListByResourceGroupOptions contains the optional parameters for the OrderItemResourcesClient.NewListByResourceGroupPager // method. -type ManagementClientListAddressesAtResourceGroupLevelOptions struct { - // $filter is supported to filter based on shipping address properties. Filter supports only equals operation. +type OrderItemResourcesClientListByResourceGroupOptions 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 and order Item Type. 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 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 } -// ManagementClientListAddressesAtSubscriptionLevelOptions contains the optional parameters for the ManagementClient.NewListAddressesAtSubscriptionLevelPager +// OrderItemResourcesClientListBySubscriptionOptions contains the optional parameters for the OrderItemResourcesClient.NewListBySubscriptionPager // method. -type ManagementClientListAddressesAtSubscriptionLevelOptions struct { - // $filter is supported to filter based on shipping address properties. Filter supports only equals operation. +type OrderItemResourcesClientListBySubscriptionOptions 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 and order Item Type. 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 is supported on Get list of order items, which provides the next page in the list of order items. SkipToken *string -} -// ManagementClientListConfigurationsOptions contains the optional parameters for the ManagementClient.NewListConfigurationsPager -// method. -type ManagementClientListConfigurationsOptions struct { - // $skipToken is supported on list of configurations, which provides the next page in the list of configurations. - 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 } -// ManagementClientListOperationsOptions contains the optional parameters for the ManagementClient.NewListOperationsPager -// method. -type ManagementClientListOperationsOptions struct { +// OrderResourcesClientGetOptions contains the optional parameters for the OrderResourcesClient.Get method. +type OrderResourcesClientGetOptions struct { // placeholder for future optional parameters } -// ManagementClientListOrderAtResourceGroupLevelOptions contains the optional parameters for the ManagementClient.NewListOrderAtResourceGroupLevelPager +// OrdersOperationGroupClientListByResourceGroupOptions contains the optional parameters for the OrdersOperationGroupClient.NewListByResourceGroupPager // method. -type ManagementClientListOrderAtResourceGroupLevelOptions struct { - // $skipToken is supported on Get list of order, which provides the next page in the list of order. +type OrdersOperationGroupClientListByResourceGroupOptions struct { + // $skipToken is supported on Get list of orders, which provides the next page in the list of orders. SkipToken *string -} -// ManagementClientListOrderAtSubscriptionLevelOptions contains the optional parameters for the ManagementClient.NewListOrderAtSubscriptionLevelPager -// method. -type ManagementClientListOrderAtSubscriptionLevelOptions struct { - // $skipToken is supported on Get list of order, which provides the next page in the list of order. - 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 } -// ManagementClientListOrderItemsAtResourceGroupLevelOptions contains the optional parameters for the ManagementClient.NewListOrderItemsAtResourceGroupLevelPager +// OrdersOperationGroupClientListBySubscriptionOptions contains the optional parameters for the OrdersOperationGroupClient.NewListBySubscriptionPager // 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. +type OrdersOperationGroupClientListBySubscriptionOptions 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 } -// ManagementClientListOrderItemsAtSubscriptionLevelOptions contains the optional parameters for the ManagementClient.NewListOrderItemsAtSubscriptionLevelPager +// ProductsAndConfigurationsOperationGroupClientListConfigurationsOptions contains the optional parameters for the ProductsAndConfigurationsOperationGroupClient.NewListConfigurationsPager // 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. +type ProductsAndConfigurationsOperationGroupClientListConfigurationsOptions struct { + // $skipToken is supported on list of configurations, which provides the next page in the list of configurations. SkipToken *string } -// ManagementClientListProductFamiliesMetadataOptions contains the optional parameters for the ManagementClient.NewListProductFamiliesMetadataPager -// method. -type ManagementClientListProductFamiliesMetadataOptions struct { +// ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataOptions contains the optional parameters for the +// ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesMetadataPager method. +type ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataOptions 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.NewListProductFamiliesPager +// ProductsAndConfigurationsOperationGroupClientListProductFamiliesOptions contains the optional parameters for the ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesPager // method. -type ManagementClientListProductFamiliesOptions struct { +type ProductsAndConfigurationsOperationGroupClientListProductFamiliesOptions struct { // $expand is supported on configurations parameter for product, which provides details on the configurations for the product. Expand *string diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/orderitemresources_client.go b/sdk/resourcemanager/edgeorder/armedgeorder/orderitemresources_client.go new file mode 100644 index 000000000000..17f036907a7a --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/orderitemresources_client.go @@ -0,0 +1,633 @@ +// 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) Go Code Generator. 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" + "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" +) + +// OrderItemResourcesClient contains the methods for the OrderItemResources group. +// Don't use this type directly, use NewOrderItemResourcesClient() instead. +type OrderItemResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewOrderItemResourcesClient creates a new instance of OrderItemResourcesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOrderItemResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OrderItemResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OrderItemResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Cancel - Cancel order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - orderItemName - The name of the order item. +// - cancellationReason - Reason for cancellation. +// - options - OrderItemResourcesClientCancelOptions contains the optional parameters for the OrderItemResourcesClient.Cancel +// method. +func (client *OrderItemResourcesClient) Cancel(ctx context.Context, resourceGroupName string, orderItemName string, cancellationReason CancellationReason, options *OrderItemResourcesClientCancelOptions) (OrderItemResourcesClientCancelResponse, error) { + var err error + const operationName = "OrderItemResourcesClient.Cancel" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.cancelCreateRequest(ctx, resourceGroupName, orderItemName, cancellationReason, options) + if err != nil { + return OrderItemResourcesClientCancelResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OrderItemResourcesClientCancelResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return OrderItemResourcesClientCancelResponse{}, err + } + return OrderItemResourcesClientCancelResponse{}, nil +} + +// cancelCreateRequest creates the Cancel request. +func (client *OrderItemResourcesClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, orderItemName string, cancellationReason CancellationReason, _ *OrderItemResourcesClientCancelOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, cancellationReason); err != nil { + return nil, err + } + return req, nil +} + +// 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 2024-02-01 +// - 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 - OrderItemResourcesClientBeginCreateOptions contains the optional parameters for the OrderItemResourcesClient.BeginCreate +// method. +func (client *OrderItemResourcesClient) BeginCreate(ctx context.Context, resourceGroupName string, orderItemName string, orderItemResource OrderItemResource, options *OrderItemResourcesClientBeginCreateOptions) (*runtime.Poller[OrderItemResourcesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, orderItemName, orderItemResource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OrderItemResourcesClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OrderItemResourcesClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2024-02-01 +func (client *OrderItemResourcesClient) create(ctx context.Context, resourceGroupName string, orderItemName string, orderItemResource OrderItemResource, options *OrderItemResourcesClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "OrderItemResourcesClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, orderItemName, orderItemResource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *OrderItemResourcesClient) createCreateRequest(ctx context.Context, resourceGroupName string, orderItemName string, orderItemResource OrderItemResource, _ *OrderItemResourcesClientBeginCreateOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, orderItemResource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete an order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - orderItemName - The name of the order item. +// - options - OrderItemResourcesClientBeginDeleteOptions contains the optional parameters for the OrderItemResourcesClient.BeginDelete +// method. +func (client *OrderItemResourcesClient) BeginDelete(ctx context.Context, resourceGroupName string, orderItemName string, options *OrderItemResourcesClientBeginDeleteOptions) (*runtime.Poller[OrderItemResourcesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, orderItemName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OrderItemResourcesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OrderItemResourcesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete an order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01 +func (client *OrderItemResourcesClient) deleteOperation(ctx context.Context, resourceGroupName string, orderItemName string, options *OrderItemResourcesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "OrderItemResourcesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, orderItemName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *OrderItemResourcesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, orderItemName string, _ *OrderItemResourcesClientBeginDeleteOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01") + 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 2024-02-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - orderItemName - The name of the order item. +// - options - OrderItemResourcesClientGetOptions contains the optional parameters for the OrderItemResourcesClient.Get method. +func (client *OrderItemResourcesClient) Get(ctx context.Context, resourceGroupName string, orderItemName string, options *OrderItemResourcesClientGetOptions) (OrderItemResourcesClientGetResponse, error) { + var err error + const operationName = "OrderItemResourcesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, orderItemName, options) + if err != nil { + return OrderItemResourcesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OrderItemResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OrderItemResourcesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *OrderItemResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, orderItemName string, options *OrderItemResourcesClientGetOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OrderItemResourcesClient) getHandleResponse(resp *http.Response) (OrderItemResourcesClientGetResponse, error) { + result := OrderItemResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrderItemResource); err != nil { + return OrderItemResourcesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List order items at resource group level. +// +// Generated from API version 2024-02-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - OrderItemResourcesClientListByResourceGroupOptions contains the optional parameters for the OrderItemResourcesClient.NewListByResourceGroupPager +// method. +func (client *OrderItemResourcesClient) NewListByResourceGroupPager(resourceGroupName string, options *OrderItemResourcesClientListByResourceGroupOptions) *runtime.Pager[OrderItemResourcesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[OrderItemResourcesClientListByResourceGroupResponse]{ + More: func(page OrderItemResourcesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OrderItemResourcesClientListByResourceGroupResponse) (OrderItemResourcesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OrderItemResourcesClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return OrderItemResourcesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *OrderItemResourcesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *OrderItemResourcesClientListByResourceGroupOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + 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)) + } + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *OrderItemResourcesClient) listByResourceGroupHandleResponse(resp *http.Response) (OrderItemResourcesClientListByResourceGroupResponse, error) { + result := OrderItemResourcesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrderItemResourceList); err != nil { + return OrderItemResourcesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List order items at subscription level. +// +// Generated from API version 2024-02-01 +// - options - OrderItemResourcesClientListBySubscriptionOptions contains the optional parameters for the OrderItemResourcesClient.NewListBySubscriptionPager +// method. +func (client *OrderItemResourcesClient) NewListBySubscriptionPager(options *OrderItemResourcesClientListBySubscriptionOptions) *runtime.Pager[OrderItemResourcesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[OrderItemResourcesClientListBySubscriptionResponse]{ + More: func(page OrderItemResourcesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OrderItemResourcesClientListBySubscriptionResponse) (OrderItemResourcesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OrderItemResourcesClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return OrderItemResourcesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *OrderItemResourcesClient) listBySubscriptionCreateRequest(ctx context.Context, options *OrderItemResourcesClientListBySubscriptionOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + 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)) + } + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *OrderItemResourcesClient) listBySubscriptionHandleResponse(resp *http.Response) (OrderItemResourcesClientListBySubscriptionResponse, error) { + result := OrderItemResourcesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrderItemResourceList); err != nil { + return OrderItemResourcesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginReturnOrderItem - Return order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01 +// - 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 - OrderItemResourcesClientBeginReturnOrderItemOptions contains the optional parameters for the OrderItemResourcesClient.BeginReturnOrderItem +// method. +func (client *OrderItemResourcesClient) BeginReturnOrderItem(ctx context.Context, resourceGroupName string, orderItemName string, returnOrderItemDetails ReturnOrderItemDetails, options *OrderItemResourcesClientBeginReturnOrderItemOptions) (*runtime.Poller[OrderItemResourcesClientReturnOrderItemResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.returnOrderItem(ctx, resourceGroupName, orderItemName, returnOrderItemDetails, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OrderItemResourcesClientReturnOrderItemResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OrderItemResourcesClientReturnOrderItemResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ReturnOrderItem - Return order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01 +func (client *OrderItemResourcesClient) returnOrderItem(ctx context.Context, resourceGroupName string, orderItemName string, returnOrderItemDetails ReturnOrderItemDetails, options *OrderItemResourcesClientBeginReturnOrderItemOptions) (*http.Response, error) { + var err error + const operationName = "OrderItemResourcesClient.BeginReturnOrderItem" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.returnOrderItemCreateRequest(ctx, resourceGroupName, orderItemName, returnOrderItemDetails, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// returnOrderItemCreateRequest creates the ReturnOrderItem request. +func (client *OrderItemResourcesClient) returnOrderItemCreateRequest(ctx context.Context, resourceGroupName string, orderItemName string, returnOrderItemDetails ReturnOrderItemDetails, _ *OrderItemResourcesClientBeginReturnOrderItemOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, returnOrderItemDetails); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdate - Update the properties of an existing order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01 +// - 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 - OrderItemResourcesClientBeginUpdateOptions contains the optional parameters for the OrderItemResourcesClient.BeginUpdate +// method. +func (client *OrderItemResourcesClient) BeginUpdate(ctx context.Context, resourceGroupName string, orderItemName string, orderItemUpdateParameter OrderItemUpdateParameter, options *OrderItemResourcesClientBeginUpdateOptions) (*runtime.Poller[OrderItemResourcesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, orderItemName, orderItemUpdateParameter, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OrderItemResourcesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OrderItemResourcesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update the properties of an existing order item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01 +func (client *OrderItemResourcesClient) update(ctx context.Context, resourceGroupName string, orderItemName string, orderItemUpdateParameter OrderItemUpdateParameter, options *OrderItemResourcesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "OrderItemResourcesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, orderItemName, orderItemUpdateParameter, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *OrderItemResourcesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, orderItemName string, orderItemUpdateParameter OrderItemUpdateParameter, options *OrderItemResourcesClientBeginUpdateOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, orderItemUpdateParameter); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/orderitemresources_client_example_test.go b/sdk/resourcemanager/edgeorder/armedgeorder/orderitemresources_client_example_test.go new file mode 100644 index 000000000000..c004fe395f3b --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/orderitemresources_client_example_test.go @@ -0,0 +1,834 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armedgeorder_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder/v2" + "log" +) + +// Generated from example definition: 2024-02-01/CancelOrderItem.json +func ExampleOrderItemResourcesClient_Cancel() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewOrderItemResourcesClient().Cancel(ctx, "YourResourceGroupName", "TestOrderItemName3", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armedgeorder.OrderItemResourcesClientCancelResponse{ + // } +} + +// Generated from example definition: 2024-02-01/CreateOrderItem.json +func ExampleOrderItemResourcesClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewOrderItemResourcesClient().BeginCreate(ctx, "YourResourceGroupName", "TestOrderItemName2", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armedgeorder.OrderItemResourcesClientCreateResponse{ + // } +} + +// Generated from example definition: 2024-02-01/DeleteOrderItemByName.json +func ExampleOrderItemResourcesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewOrderItemResourcesClient().BeginDelete(ctx, "YourResourceGroupName", "TestOrderItemName3", 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: 2024-02-01/GetOrderItemByName.json +func ExampleOrderItemResourcesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewOrderItemResourcesClient().Get(ctx, "YourResourceGroupName", "TestOrderItemName1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armedgeorder.OrderItemResourcesClientGetResponse{ + // OrderItemResource: &armedgeorder.OrderItemResource{ + // Name: to.Ptr("TestOrderItemName1"), + // Type: to.Ptr("Microsoft.EdgeOrder/orderItems"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName1"), + // Location: to.Ptr("eastus"), + // Properties: &armedgeorder.OrderItemProperties{ + // AddressDetails: &armedgeorder.AddressDetails{ + // ForwardAddress: &armedgeorder.AddressProperties{ + // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), + // 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/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName1"), + // OrderItemDetails: &armedgeorder.OrderItemDetails{ + // CancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumNotCancellable), + // CurrentStage: &armedgeorder.StageDetails{ + // StageName: to.Ptr(armedgeorder.StageNameConfirmed), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:05:00.3575338+05:30"); return t}()), + // }, + // DeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed), + // ManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{ + // { + // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), + // }, + // }, + // NotificationEmailList: []*string{ + // }, + // OrderItemStageHistory: []*armedgeorder.StageDetails{ + // { + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:55:54.3427968+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameConfirmed), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:05:00.3575338+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameReadyToShip), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameShipped), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameDelivered), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameInUse), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // }, + // OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), + // Preferences: &armedgeorder.Preferences{ + // TransportPreferences: &armedgeorder.TransportPreferences{ + // PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged), + // }, + // }, + // ProductDetails: &armedgeorder.ProductDetails{ + // DisplayInfo: &armedgeorder.DisplayInfo{ + // ConfigurationDisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), + // ProductFamilyDisplayName: to.Ptr("Azure Stack Edge"), + // }, + // HierarchyInformation: &armedgeorder.HierarchyInformation{ + // ConfigurationName: to.Ptr("edgep_base"), + // ProductFamilyName: to.Ptr("azurestackedge"), + // ProductLineName: to.Ptr("azurestackedge"), + // ProductName: to.Ptr("azurestackedgegpu"), + // }, + // ProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled), + // }, + // ReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable), + // }, + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:55:10.2820482+05:30"); return t}()), + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-02-01/ListOrderItemsAtResourceGroupLevel.json +func ExampleOrderItemResourcesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOrderItemResourcesClient().NewListByResourceGroupPager("YourResourceGroupName", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armedgeorder.OrderItemResourcesClientListByResourceGroupResponse{ + // OrderItemResourceList: armedgeorder.OrderItemResourceList{ + // Value: []*armedgeorder.OrderItemResource{ + // { + // Name: to.Ptr("TestOrderItemName1"), + // Type: to.Ptr("Microsoft.EdgeOrder/orderItems"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName1"), + // Location: to.Ptr("eastus"), + // Properties: &armedgeorder.OrderItemProperties{ + // AddressDetails: &armedgeorder.AddressDetails{ + // ForwardAddress: &armedgeorder.AddressProperties{ + // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), + // 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/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName1"), + // OrderItemDetails: &armedgeorder.OrderItemDetails{ + // CancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumNotCancellable), + // CurrentStage: &armedgeorder.StageDetails{ + // StageName: to.Ptr(armedgeorder.StageNameConfirmed), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:05:00.3575338+05:30"); return t}()), + // }, + // DeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed), + // ManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{ + // { + // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), + // }, + // }, + // NotificationEmailList: []*string{ + // }, + // OrderItemStageHistory: []*armedgeorder.StageDetails{ + // { + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:55:54.3427968+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameConfirmed), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:05:00.3575338+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameReadyToShip), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameShipped), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameDelivered), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameInUse), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // }, + // OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), + // Preferences: &armedgeorder.Preferences{ + // TransportPreferences: &armedgeorder.TransportPreferences{ + // PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged), + // }, + // }, + // ProductDetails: &armedgeorder.ProductDetails{ + // DisplayInfo: &armedgeorder.DisplayInfo{ + // ConfigurationDisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), + // ProductFamilyDisplayName: to.Ptr("Azure Stack Edge"), + // }, + // HierarchyInformation: &armedgeorder.HierarchyInformation{ + // ConfigurationName: to.Ptr("edgep_base"), + // ProductFamilyName: to.Ptr("azurestackedge"), + // ProductLineName: to.Ptr("azurestackedge"), + // ProductName: to.Ptr("azurestackedgegpu"), + // }, + // ProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled), + // }, + // ReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable), + // }, + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:55:10.2820482+05:30"); return t}()), + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // Tags: map[string]*string{ + // }, + // }, + // { + // Name: to.Ptr("TestOrderItemName2"), + // Type: to.Ptr("Microsoft.EdgeOrder/orderItems"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName2"), + // Location: to.Ptr("eastus"), + // Properties: &armedgeorder.OrderItemProperties{ + // AddressDetails: &armedgeorder.AddressDetails{ + // ForwardAddress: &armedgeorder.AddressProperties{ + // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), + // 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/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName2"), + // OrderItemDetails: &armedgeorder.OrderItemDetails{ + // CancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumNotCancellable), + // CurrentStage: &armedgeorder.StageDetails{ + // StageName: to.Ptr(armedgeorder.StageNameConfirmed), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:07:29.9896685+05:30"); return t}()), + // }, + // DeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed), + // ManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{ + // { + // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), + // }, + // }, + // NotificationEmailList: []*string{ + // }, + // OrderItemStageHistory: []*armedgeorder.StageDetails{ + // { + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:59:04.9701334+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameConfirmed), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:07:29.9896685+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameReadyToShip), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameShipped), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameDelivered), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameInUse), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // }, + // OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), + // Preferences: &armedgeorder.Preferences{ + // TransportPreferences: &armedgeorder.TransportPreferences{ + // PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged), + // }, + // }, + // ProductDetails: &armedgeorder.ProductDetails{ + // DisplayInfo: &armedgeorder.DisplayInfo{ + // ConfigurationDisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), + // ProductFamilyDisplayName: to.Ptr("Azure Stack Edge"), + // }, + // HierarchyInformation: &armedgeorder.HierarchyInformation{ + // ConfigurationName: to.Ptr("edgep_base"), + // ProductFamilyName: to.Ptr("azurestackedge"), + // ProductLineName: to.Ptr("azurestackedge"), + // ProductName: to.Ptr("azurestackedgegpu"), + // }, + // ProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled), + // }, + // ReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable), + // }, + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:58:27.5824859+05:30"); return t}()), + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-02-01/ListOrderItemsAtSubscriptionLevel.json +func ExampleOrderItemResourcesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOrderItemResourcesClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armedgeorder.OrderItemResourcesClientListBySubscriptionResponse{ + // OrderItemResourceList: armedgeorder.OrderItemResourceList{ + // Value: []*armedgeorder.OrderItemResource{ + // { + // Name: to.Ptr("TestOrderItemName1"), + // Type: to.Ptr("Microsoft.EdgeOrder/orderItems"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName1"), + // Location: to.Ptr("eastus"), + // Properties: &armedgeorder.OrderItemProperties{ + // AddressDetails: &armedgeorder.AddressDetails{ + // ForwardAddress: &armedgeorder.AddressProperties{ + // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), + // 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/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName1"), + // OrderItemDetails: &armedgeorder.OrderItemDetails{ + // CancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumNotCancellable), + // CurrentStage: &armedgeorder.StageDetails{ + // StageName: to.Ptr(armedgeorder.StageNameConfirmed), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:05:00.3575338+05:30"); return t}()), + // }, + // DeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed), + // ManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{ + // { + // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), + // }, + // }, + // NotificationEmailList: []*string{ + // }, + // OrderItemStageHistory: []*armedgeorder.StageDetails{ + // { + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:55:54.3427968+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameConfirmed), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:05:00.3575338+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameReadyToShip), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameShipped), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameDelivered), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameInUse), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // }, + // OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), + // Preferences: &armedgeorder.Preferences{ + // TransportPreferences: &armedgeorder.TransportPreferences{ + // PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged), + // }, + // }, + // ProductDetails: &armedgeorder.ProductDetails{ + // DisplayInfo: &armedgeorder.DisplayInfo{ + // ConfigurationDisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), + // ProductFamilyDisplayName: to.Ptr("Azure Stack Edge"), + // }, + // HierarchyInformation: &armedgeorder.HierarchyInformation{ + // ConfigurationName: to.Ptr("edgep_base"), + // ProductFamilyName: to.Ptr("azurestackedge"), + // ProductLineName: to.Ptr("azurestackedge"), + // ProductName: to.Ptr("azurestackedgegpu"), + // }, + // ProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled), + // }, + // ReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable), + // }, + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:55:10.2820482+05:30"); return t}()), + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // Tags: map[string]*string{ + // }, + // }, + // { + // Name: to.Ptr("TestOrderItemName2"), + // Type: to.Ptr("Microsoft.EdgeOrder/orderItems"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName2"), + // Location: to.Ptr("eastus"), + // Properties: &armedgeorder.OrderItemProperties{ + // AddressDetails: &armedgeorder.AddressDetails{ + // ForwardAddress: &armedgeorder.AddressProperties{ + // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), + // 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/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName2"), + // OrderItemDetails: &armedgeorder.OrderItemDetails{ + // CancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumNotCancellable), + // CurrentStage: &armedgeorder.StageDetails{ + // StageName: to.Ptr(armedgeorder.StageNameConfirmed), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:07:29.9896685+05:30"); return t}()), + // }, + // DeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed), + // ManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{ + // { + // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), + // }, + // }, + // NotificationEmailList: []*string{ + // }, + // OrderItemStageHistory: []*armedgeorder.StageDetails{ + // { + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:59:04.9701334+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameConfirmed), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:07:29.9896685+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameReadyToShip), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameShipped), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameDelivered), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameInUse), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // }, + // OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), + // Preferences: &armedgeorder.Preferences{ + // TransportPreferences: &armedgeorder.TransportPreferences{ + // PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged), + // }, + // }, + // ProductDetails: &armedgeorder.ProductDetails{ + // DisplayInfo: &armedgeorder.DisplayInfo{ + // ConfigurationDisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), + // ProductFamilyDisplayName: to.Ptr("Azure Stack Edge"), + // }, + // HierarchyInformation: &armedgeorder.HierarchyInformation{ + // ConfigurationName: to.Ptr("edgep_base"), + // ProductFamilyName: to.Ptr("azurestackedge"), + // ProductLineName: to.Ptr("azurestackedge"), + // ProductName: to.Ptr("azurestackedgegpu"), + // }, + // ProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled), + // }, + // ReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable), + // }, + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:58:27.5824859+05:30"); return t}()), + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-02-01/ReturnOrderItem.json +func ExampleOrderItemResourcesClient_BeginReturnOrderItem() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewOrderItemResourcesClient().BeginReturnOrderItem(ctx, "YourResourceGroupName", "TestOrderName4", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armedgeorder.OrderItemResourcesClientReturnOrderItemResponse{ + // } +} + +// Generated from example definition: 2024-02-01/UpdateOrderItem.json +func ExampleOrderItemResourcesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewOrderItemResourcesClient().BeginUpdate(ctx, "YourResourceGroupName", "TestOrderItemName3", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armedgeorder.OrderItemResourcesClientUpdateResponse{ + // OrderItemResource: &armedgeorder.OrderItemResource{ + // Name: to.Ptr("TestOrderItemName3"), + // Type: to.Ptr("Microsoft.EdgeOrder/orderItems"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName3"), + // Location: to.Ptr("eastus"), + // Properties: &armedgeorder.OrderItemProperties{ + // AddressDetails: &armedgeorder.AddressDetails{ + // ForwardAddress: &armedgeorder.AddressProperties{ + // AddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid), + // 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/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName3"), + // OrderItemDetails: &armedgeorder.OrderItemDetails{ + // CancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumCancellable), + // CurrentStage: &armedgeorder.StageDetails{ + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:30:31.5838042+05:30"); return t}()), + // }, + // DeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed), + // ManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{ + // { + // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), + // }, + // }, + // NotificationEmailList: []*string{ + // }, + // OrderItemStageHistory: []*armedgeorder.StageDetails{ + // { + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:30:31.5838042+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameConfirmed), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameReadyToShip), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameShipped), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameDelivered), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameInUse), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // }, + // OrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase), + // Preferences: &armedgeorder.Preferences{ + // TransportPreferences: &armedgeorder.TransportPreferences{ + // PreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesCustomerManaged), + // }, + // }, + // ProductDetails: &armedgeorder.ProductDetails{ + // DisplayInfo: &armedgeorder.DisplayInfo{ + // ConfigurationDisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), + // ProductFamilyDisplayName: to.Ptr("Azure Stack Edge"), + // }, + // HierarchyInformation: &armedgeorder.HierarchyInformation{ + // ConfigurationName: to.Ptr("edgep_base"), + // ProductFamilyName: to.Ptr("azurestackedge"), + // ProductLineName: to.Ptr("azurestackedge"), + // ProductName: to.Ptr("azurestackedgegpu"), + // }, + // ProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled), + // }, + // ReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable), + // }, + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:29:47.3483197+05:30"); return t}()), + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/orderresources_client.go b/sdk/resourcemanager/edgeorder/armedgeorder/orderresources_client.go new file mode 100644 index 000000000000..045996455e32 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/orderresources_client.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. 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" + "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" +) + +// OrderResourcesClient contains the methods for the OrderResources group. +// Don't use this type directly, use NewOrderResourcesClient() instead. +type OrderResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewOrderResourcesClient creates a new instance of OrderResourcesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOrderResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OrderResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OrderResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get an order. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - location - The name of the Azure region. +// - orderName - The name of the order. +// - options - OrderResourcesClientGetOptions contains the optional parameters for the OrderResourcesClient.Get method. +func (client *OrderResourcesClient) Get(ctx context.Context, resourceGroupName string, location string, orderName string, options *OrderResourcesClientGetOptions) (OrderResourcesClientGetResponse, error) { + var err error + const operationName = "OrderResourcesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, location, orderName, options) + if err != nil { + return OrderResourcesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OrderResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OrderResourcesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *OrderResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, location string, orderName string, _ *OrderResourcesClientGetOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OrderResourcesClient) getHandleResponse(resp *http.Response) (OrderResourcesClientGetResponse, error) { + result := OrderResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrderResource); err != nil { + return OrderResourcesClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/orderresources_client_example_test.go b/sdk/resourcemanager/edgeorder/armedgeorder/orderresources_client_example_test.go new file mode 100644 index 000000000000..703c7fbfc839 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/orderresources_client_example_test.go @@ -0,0 +1,65 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armedgeorder_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder/v2" + "log" +) + +// Generated from example definition: 2024-02-01/GetOrderByName.json +func ExampleOrderResourcesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewOrderResourcesClient().Get(ctx, "YourResourceGroupName", "eastus", "TestOrderName3", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armedgeorder.OrderResourcesClientGetResponse{ + // OrderResource: &armedgeorder.OrderResource{ + // Name: to.Ptr("TestOrderName3"), + // Type: to.Ptr("Microsoft.EdgeOrder/orders"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName3"), + // Properties: &armedgeorder.OrderProperties{ + // CurrentStage: &armedgeorder.StageDetails{ + // StageName: to.Ptr(armedgeorder.StageNameInReview), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:35:20.8521455+05:30"); return t}()), + // }, + // OrderItemIDs: []*string{ + // to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName3"), + // }, + // OrderStageHistory: []*armedgeorder.StageDetails{ + // { + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:30:30.2717243+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameInReview), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T11:35:20.8521455+05:30"); return t}()), + // }, + // }, + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/ordersoperationgroup_client.go b/sdk/resourcemanager/edgeorder/armedgeorder/ordersoperationgroup_client.go new file mode 100644 index 000000000000..01e770d8d710 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/ordersoperationgroup_client.go @@ -0,0 +1,168 @@ +// 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) Go Code Generator. 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" + "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" +) + +// OrdersOperationGroupClient contains the methods for the OrdersOperationGroup group. +// Don't use this type directly, use NewOrdersOperationGroupClient() instead. +type OrdersOperationGroupClient struct { + internal *arm.Client + subscriptionID string +} + +// NewOrdersOperationGroupClient creates a new instance of OrdersOperationGroupClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOrdersOperationGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OrdersOperationGroupClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OrdersOperationGroupClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByResourceGroupPager - List orders at resource group level. +// +// Generated from API version 2024-02-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - OrdersOperationGroupClientListByResourceGroupOptions contains the optional parameters for the OrdersOperationGroupClient.NewListByResourceGroupPager +// method. +func (client *OrdersOperationGroupClient) NewListByResourceGroupPager(resourceGroupName string, options *OrdersOperationGroupClientListByResourceGroupOptions) *runtime.Pager[OrdersOperationGroupClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[OrdersOperationGroupClientListByResourceGroupResponse]{ + More: func(page OrdersOperationGroupClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OrdersOperationGroupClientListByResourceGroupResponse) (OrdersOperationGroupClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OrdersOperationGroupClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return OrdersOperationGroupClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *OrdersOperationGroupClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *OrdersOperationGroupClientListByResourceGroupOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + 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)) + } + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *OrdersOperationGroupClient) listByResourceGroupHandleResponse(resp *http.Response) (OrdersOperationGroupClientListByResourceGroupResponse, error) { + result := OrdersOperationGroupClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrderResourceList); err != nil { + return OrdersOperationGroupClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List orders at subscription level. +// +// Generated from API version 2024-02-01 +// - options - OrdersOperationGroupClientListBySubscriptionOptions contains the optional parameters for the OrdersOperationGroupClient.NewListBySubscriptionPager +// method. +func (client *OrdersOperationGroupClient) NewListBySubscriptionPager(options *OrdersOperationGroupClientListBySubscriptionOptions) *runtime.Pager[OrdersOperationGroupClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[OrdersOperationGroupClientListBySubscriptionResponse]{ + More: func(page OrdersOperationGroupClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OrdersOperationGroupClientListBySubscriptionResponse) (OrdersOperationGroupClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OrdersOperationGroupClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return OrdersOperationGroupClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *OrdersOperationGroupClient) listBySubscriptionCreateRequest(ctx context.Context, options *OrdersOperationGroupClientListBySubscriptionOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + 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)) + } + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *OrdersOperationGroupClient) listBySubscriptionHandleResponse(resp *http.Response) (OrdersOperationGroupClientListBySubscriptionResponse, error) { + result := OrdersOperationGroupClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrderResourceList); err != nil { + return OrdersOperationGroupClientListBySubscriptionResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/ordersoperationgroup_client_example_test.go b/sdk/resourcemanager/edgeorder/armedgeorder/ordersoperationgroup_client_example_test.go new file mode 100644 index 000000000000..00c3579c45c8 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/ordersoperationgroup_client_example_test.go @@ -0,0 +1,192 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armedgeorder_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgeorder/armedgeorder/v2" + "log" +) + +// Generated from example definition: 2024-02-01/ListOrderAtResourceGroupLevel.json +func ExampleOrdersOperationGroupClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOrdersOperationGroupClient().NewListByResourceGroupPager("YourResourceGroupName", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armedgeorder.OrdersOperationGroupClientListByResourceGroupResponse{ + // OrderResourceList: armedgeorder.OrderResourceList{ + // Value: []*armedgeorder.OrderResource{ + // { + // Name: to.Ptr("TestOrderItemName1"), + // Type: to.Ptr("Microsoft.EdgeOrder/orders"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName1"), + // Properties: &armedgeorder.OrderProperties{ + // CurrentStage: &armedgeorder.StageDetails{ + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:55:46.9437439+05:30"); return t}()), + // }, + // OrderItemIDs: []*string{ + // to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName1"), + // }, + // OrderStageHistory: []*armedgeorder.StageDetails{ + // { + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:55:46.9437439+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameInReview), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // }, + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // }, + // { + // Name: to.Ptr("TestOrderItemName2"), + // Type: to.Ptr("Microsoft.EdgeOrder/orders"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName2"), + // Properties: &armedgeorder.OrderProperties{ + // CurrentStage: &armedgeorder.StageDetails{ + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusInProgress), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:58:46.5241979+05:30"); return t}()), + // }, + // OrderItemIDs: []*string{ + // to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName2"), + // }, + // OrderStageHistory: []*armedgeorder.StageDetails{ + // { + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameInReview), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // }, + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-02-01/ListOrderAtSubscriptionLevel.json +func ExampleOrdersOperationGroupClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOrdersOperationGroupClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armedgeorder.OrdersOperationGroupClientListBySubscriptionResponse{ + // OrderResourceList: armedgeorder.OrderResourceList{ + // Value: []*armedgeorder.OrderResource{ + // { + // Name: to.Ptr("TestOrderItemName1"), + // Type: to.Ptr("Microsoft.EdgeOrder/orders"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName1"), + // Properties: &armedgeorder.OrderProperties{ + // CurrentStage: &armedgeorder.StageDetails{ + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:55:46.9437439+05:30"); return t}()), + // }, + // OrderItemIDs: []*string{ + // to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName1"), + // }, + // OrderStageHistory: []*armedgeorder.StageDetails{ + // { + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusSucceeded), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:55:46.9437439+05:30"); return t}()), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameInReview), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // }, + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // }, + // { + // Name: to.Ptr("TestOrderItemName2"), + // Type: to.Ptr("Microsoft.EdgeOrder/orders"), + // ID: to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName2"), + // Properties: &armedgeorder.OrderProperties{ + // CurrentStage: &armedgeorder.StageDetails{ + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusInProgress), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T10:58:46.5241979+05:30"); return t}()), + // }, + // OrderItemIDs: []*string{ + // to.Ptr("/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName2"), + // }, + // OrderStageHistory: []*armedgeorder.StageDetails{ + // { + // StageName: to.Ptr(armedgeorder.StageNamePlaced), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // { + // StageName: to.Ptr(armedgeorder.StageNameInReview), + // StageStatus: to.Ptr(armedgeorder.StageStatusNone), + // }, + // }, + // }, + // SystemData: &armedgeorder.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()), + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/polymorphic_helpers.go b/sdk/resourcemanager/edgeorder/armedgeorder/polymorphic_helpers.go index 9361ced2d2a5..ecd4e33fd062 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/polymorphic_helpers.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/polymorphic_helpers.go @@ -1,17 +1,13 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armedgeorder import "encoding/json" func unmarshalMeterDetailsClassification(rawMsg json.RawMessage) (MeterDetailsClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/productsandconfigurationsoperationgroup_client.go b/sdk/resourcemanager/edgeorder/armedgeorder/productsandconfigurationsoperationgroup_client.go new file mode 100644 index 000000000000..d9927c668163 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/productsandconfigurationsoperationgroup_client.go @@ -0,0 +1,227 @@ +// 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) Go Code Generator. 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" + "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" +) + +// ProductsAndConfigurationsOperationGroupClient contains the methods for the ProductsAndConfigurationsOperationGroup group. +// Don't use this type directly, use NewProductsAndConfigurationsOperationGroupClient() instead. +type ProductsAndConfigurationsOperationGroupClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProductsAndConfigurationsOperationGroupClient creates a new instance of ProductsAndConfigurationsOperationGroupClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProductsAndConfigurationsOperationGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductsAndConfigurationsOperationGroupClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProductsAndConfigurationsOperationGroupClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListConfigurationsPager - List configurations for the given product family, product line and product for the given subscription. +// +// Generated from API version 2024-02-01 +// - configurationsRequest - Filters for showing the configurations. +// - options - ProductsAndConfigurationsOperationGroupClientListConfigurationsOptions contains the optional parameters for the +// ProductsAndConfigurationsOperationGroupClient.NewListConfigurationsPager method. +func (client *ProductsAndConfigurationsOperationGroupClient) NewListConfigurationsPager(configurationsRequest ConfigurationsRequest, options *ProductsAndConfigurationsOperationGroupClientListConfigurationsOptions) *runtime.Pager[ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse] { + return runtime.NewPager(runtime.PagingHandler[ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse]{ + More: func(page ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse) (ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProductsAndConfigurationsOperationGroupClient.NewListConfigurationsPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listConfigurationsCreateRequest(ctx, configurationsRequest, options) + }, nil) + if err != nil { + return ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse{}, err + } + return client.listConfigurationsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listConfigurationsCreateRequest creates the ListConfigurations request. +func (client *ProductsAndConfigurationsOperationGroupClient) listConfigurationsCreateRequest(ctx context.Context, configurationsRequest ConfigurationsRequest, options *ProductsAndConfigurationsOperationGroupClientListConfigurationsOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, configurationsRequest); err != nil { + return nil, err + } + return req, nil +} + +// listConfigurationsHandleResponse handles the ListConfigurations response. +func (client *ProductsAndConfigurationsOperationGroupClient) listConfigurationsHandleResponse(resp *http.Response) (ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse, error) { + result := ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Configurations); err != nil { + return ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse{}, err + } + return result, nil +} + +// NewListProductFamiliesPager - List product families for the given subscription. +// +// Generated from API version 2024-02-01 +// - productFamiliesRequest - Filters for showing the product families. +// - options - ProductsAndConfigurationsOperationGroupClientListProductFamiliesOptions contains the optional parameters for +// the ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesPager method. +func (client *ProductsAndConfigurationsOperationGroupClient) NewListProductFamiliesPager(productFamiliesRequest ProductFamiliesRequest, options *ProductsAndConfigurationsOperationGroupClientListProductFamiliesOptions) *runtime.Pager[ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse] { + return runtime.NewPager(runtime.PagingHandler[ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse]{ + More: func(page ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse) (ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listProductFamiliesCreateRequest(ctx, productFamiliesRequest, options) + }, nil) + if err != nil { + return ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse{}, err + } + return client.listProductFamiliesHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listProductFamiliesCreateRequest creates the ListProductFamilies request. +func (client *ProductsAndConfigurationsOperationGroupClient) listProductFamiliesCreateRequest(ctx context.Context, productFamiliesRequest ProductFamiliesRequest, options *ProductsAndConfigurationsOperationGroupClientListProductFamiliesOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, productFamiliesRequest); err != nil { + return nil, err + } + return req, nil +} + +// listProductFamiliesHandleResponse handles the ListProductFamilies response. +func (client *ProductsAndConfigurationsOperationGroupClient) listProductFamiliesHandleResponse(resp *http.Response) (ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse, error) { + result := ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductFamilies); err != nil { + return ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse{}, err + } + return result, nil +} + +// NewListProductFamiliesMetadataPager - List product families metadata for the given subscription. +// +// Generated from API version 2024-02-01 +// - options - ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataOptions contains the optional parameters +// for the ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesMetadataPager method. +func (client *ProductsAndConfigurationsOperationGroupClient) NewListProductFamiliesMetadataPager(options *ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataOptions) *runtime.Pager[ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse] { + return runtime.NewPager(runtime.PagingHandler[ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse]{ + More: func(page ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse) (ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesMetadataPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listProductFamiliesMetadataCreateRequest(ctx, options) + }, nil) + if err != nil { + return ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse{}, err + } + return client.listProductFamiliesMetadataHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listProductFamiliesMetadataCreateRequest creates the ListProductFamiliesMetadata request. +func (client *ProductsAndConfigurationsOperationGroupClient) listProductFamiliesMetadataCreateRequest(ctx context.Context, options *ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataOptions) (*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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + reqQP.Set("api-version", "2024-02-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listProductFamiliesMetadataHandleResponse handles the ListProductFamiliesMetadata response. +func (client *ProductsAndConfigurationsOperationGroupClient) listProductFamiliesMetadataHandleResponse(resp *http.Response) (ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse, error) { + result := ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductFamiliesMetadata); err != nil { + return ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/productsandconfigurationsoperationgroup_client_example_test.go b/sdk/resourcemanager/edgeorder/armedgeorder/productsandconfigurationsoperationgroup_client_example_test.go new file mode 100644 index 000000000000..7227500303a4 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/productsandconfigurationsoperationgroup_client_example_test.go @@ -0,0 +1,431 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armedgeorder_test + +import ( + "context" + "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/v2" + "log" +) + +// Generated from example definition: 2024-02-01/ListConfigurations.json +func ExampleProductsAndConfigurationsOperationGroupClient_NewListConfigurationsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewProductsAndConfigurationsOperationGroupClient().NewListConfigurationsPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armedgeorder.ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse{ + // Configurations: armedgeorder.Configurations{ + // Value: []*armedgeorder.Configuration{ + // { + // Properties: &armedgeorder.ConfigurationProperties{ + // Description: &armedgeorder.Description{ + // Attributes: []*string{ + // }, + // DescriptionType: to.Ptr(armedgeorder.DescriptionTypeBase), + // Keywords: []*string{ + // to.Ptr("GPU"), + // }, + // Links: []*armedgeorder.Link{ + // }, + // LongDescription: to.Ptr(""), + // ShortDescription: to.Ptr(""), + // }, + // AvailabilityInformation: &armedgeorder.AvailabilityInformation{ + // AvailabilityStage: to.Ptr(armedgeorder.AvailabilityStageAvailable), + // DisabledReason: to.Ptr(armedgeorder.DisabledReasonNone), + // }, + // CostInformation: &armedgeorder.CostInformation{ + // BillingMeterDetails: []*armedgeorder.BillingMeterDetails{ + // }, + // }, + // Dimensions: &armedgeorder.Dimensions{ + // Depth: to.Ptr[float64](2), + // Height: to.Ptr[float64](15), + // Length: to.Ptr[float64](50), + // LengthHeightUnit: to.Ptr(armedgeorder.LengthHeightUnitIN), + // Weight: to.Ptr[float64](50), + // WeightUnit: to.Ptr(armedgeorder.WeightMeasurementUnitLBS), + // Width: to.Ptr[float64](5), + // }, + // DisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), + // FilterableProperties: []*armedgeorder.FilterableProperty{ + // { + // Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), + // SupportedValues: []*string{ + // to.Ptr("US"), + // }, + // }, + // }, + // HierarchyInformation: &armedgeorder.HierarchyInformation{ + // ConfigurationName: to.Ptr("edgep_base"), + // ProductFamilyName: to.Ptr("azurestackedge"), + // ProductLineName: to.Ptr("azurestackedge"), + // ProductName: to.Ptr("azurestackedgegpu"), + // }, + // ImageInformation: []*armedgeorder.ImageInformation{ + // }, + // Specifications: []*armedgeorder.Specification{ + // { + // Name: to.Ptr("Usable compute"), + // Value: to.Ptr("40 vCPU"), + // }, + // { + // Name: to.Ptr("Usable memory"), + // Value: to.Ptr("102 GB"), + // }, + // { + // Name: to.Ptr("Usable storage"), + // Value: to.Ptr("4.2 TB"), + // }, + // }, + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-02-01/ListProductFamilies.json +func ExampleProductsAndConfigurationsOperationGroupClient_NewListProductFamiliesPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewProductsAndConfigurationsOperationGroupClient().NewListProductFamiliesPager(&ProductsAndConfigurationsOperationGroupClientListProductFamiliesOptions{ + Expand: to.Ptr("configurations")}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse{ + // ProductFamilies: armedgeorder.ProductFamilies{ + // Value: []*armedgeorder.ProductFamily{ + // { + // Properties: &armedgeorder.ProductFamilyProperties{ + // Description: &armedgeorder.Description{ + // Attributes: []*string{ + // }, + // DescriptionType: to.Ptr(armedgeorder.DescriptionTypeBase), + // Keywords: []*string{ + // }, + // Links: []*armedgeorder.Link{ + // }, + // ShortDescription: to.Ptr("Azure managed physical edge compute device"), + // }, + // AvailabilityInformation: &armedgeorder.AvailabilityInformation{ + // AvailabilityStage: to.Ptr(armedgeorder.AvailabilityStageAvailable), + // DisabledReason: to.Ptr(armedgeorder.DisabledReasonNone), + // }, + // DisplayName: to.Ptr("Azure Stack Edge"), + // FilterableProperties: []*armedgeorder.FilterableProperty{ + // { + // Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), + // SupportedValues: []*string{ + // to.Ptr("US"), + // }, + // }, + // { + // Type: to.Ptr(armedgeorder.SupportedFilterTypesDoubleEncryptionStatus), + // SupportedValues: []*string{ + // to.Ptr("Enabled"), + // }, + // }, + // }, + // HierarchyInformation: &armedgeorder.HierarchyInformation{ + // ConfigurationName: to.Ptr(""), + // ProductFamilyName: to.Ptr("azurestackedge"), + // ProductLineName: to.Ptr(""), + // ProductName: to.Ptr(""), + // }, + // ImageInformation: []*armedgeorder.ImageInformation{ + // }, + // ProductLines: []*armedgeorder.ProductLine{ + // { + // Properties: &armedgeorder.ProductLineProperties{ + // Description: &armedgeorder.Description{ + // Attributes: []*string{ + // }, + // DescriptionType: to.Ptr(armedgeorder.DescriptionTypeBase), + // Keywords: []*string{ + // }, + // Links: []*armedgeorder.Link{ + // }, + // }, + // AvailabilityInformation: &armedgeorder.AvailabilityInformation{ + // AvailabilityStage: to.Ptr(armedgeorder.AvailabilityStageAvailable), + // DisabledReason: to.Ptr(armedgeorder.DisabledReasonNone), + // }, + // DisplayName: to.Ptr("Azure Stack Edge"), + // FilterableProperties: []*armedgeorder.FilterableProperty{ + // { + // Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), + // SupportedValues: []*string{ + // to.Ptr("US"), + // }, + // }, + // { + // Type: to.Ptr(armedgeorder.SupportedFilterTypesDoubleEncryptionStatus), + // SupportedValues: []*string{ + // to.Ptr("Enabled"), + // }, + // }, + // }, + // HierarchyInformation: &armedgeorder.HierarchyInformation{ + // ConfigurationName: to.Ptr(""), + // ProductFamilyName: to.Ptr("azurestackedge"), + // ProductLineName: to.Ptr("azurestackedge"), + // ProductName: to.Ptr(""), + // }, + // ImageInformation: []*armedgeorder.ImageInformation{ + // }, + // Products: []*armedgeorder.Product{ + // { + // Properties: &armedgeorder.ProductProperties{ + // Description: &armedgeorder.Description{ + // Attributes: []*string{ + // to.Ptr("1U rack mount device with network data transfer capabilities"), + // to.Ptr("Hardware accelerated ML using Nvidia T4 GPU"), + // to.Ptr("Azure Private Edge Zones enabled"), + // }, + // DescriptionType: to.Ptr(armedgeorder.DescriptionTypeBase), + // Keywords: []*string{ + // to.Ptr("GPU"), + // }, + // Links: []*armedgeorder.Link{ + // { + // LinkType: to.Ptr(armedgeorder.LinkTypeSpecification), + // LinkURL: to.Ptr("https://aka.ms/edgeHWcenter-asepro-devicespec"), + // }, + // { + // LinkType: to.Ptr(armedgeorder.LinkTypeGeneric), + // LinkURL: to.Ptr("https://aka.ms/ase-gpu-billing"), + // }, + // { + // LinkType: to.Ptr(armedgeorder.LinkTypeTermsAndConditions), + // LinkURL: to.Ptr("https://aka.ms/ase-gpu-product-terms"), + // }, + // { + // LinkType: to.Ptr(armedgeorder.LinkTypeKnowMore), + // LinkURL: to.Ptr("https://aka.ms/edgeHWcenter-asepro-documentation"), + // }, + // }, + // LongDescription: to.Ptr("Azure Stack Edge Pro is an AI-enabled edge computing device with network data transfer capabilities. The device is powered with NVIDIA T4 GPUs to provide accelerated AI inferencing at the edge. You can choose from the following configurations based upon your business need"), + // ShortDescription: to.Ptr("Azure managed physical edge compute device"), + // }, + // AvailabilityInformation: &armedgeorder.AvailabilityInformation{ + // AvailabilityStage: to.Ptr(armedgeorder.AvailabilityStageAvailable), + // DisabledReason: to.Ptr(armedgeorder.DisabledReasonNone), + // }, + // Configurations: []*armedgeorder.Configuration{ + // { + // Properties: &armedgeorder.ConfigurationProperties{ + // Description: &armedgeorder.Description{ + // Attributes: []*string{ + // }, + // DescriptionType: to.Ptr(armedgeorder.DescriptionTypeBase), + // Keywords: []*string{ + // to.Ptr("GPU"), + // }, + // Links: []*armedgeorder.Link{ + // }, + // LongDescription: to.Ptr(""), + // ShortDescription: to.Ptr(""), + // }, + // AvailabilityInformation: &armedgeorder.AvailabilityInformation{ + // AvailabilityStage: to.Ptr(armedgeorder.AvailabilityStageAvailable), + // DisabledReason: to.Ptr(armedgeorder.DisabledReasonNone), + // }, + // CostInformation: &armedgeorder.CostInformation{ + // BillingMeterDetails: []*armedgeorder.BillingMeterDetails{ + // }, + // }, + // Dimensions: &armedgeorder.Dimensions{ + // Depth: to.Ptr[float64](2), + // Height: to.Ptr[float64](15), + // Length: to.Ptr[float64](50), + // LengthHeightUnit: to.Ptr(armedgeorder.LengthHeightUnitIN), + // Weight: to.Ptr[float64](50), + // WeightUnit: to.Ptr(armedgeorder.WeightMeasurementUnitLBS), + // Width: to.Ptr[float64](5), + // }, + // DisplayName: to.Ptr("Azure Stack Edge Pro - 1 GPU"), + // FilterableProperties: []*armedgeorder.FilterableProperty{ + // { + // Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), + // SupportedValues: []*string{ + // to.Ptr("US"), + // }, + // }, + // }, + // HierarchyInformation: &armedgeorder.HierarchyInformation{ + // ConfigurationName: to.Ptr("edgep_base"), + // ProductFamilyName: to.Ptr("azurestackedge"), + // ProductLineName: to.Ptr("azurestackedge"), + // ProductName: to.Ptr("azurestackedgegpu"), + // }, + // ImageInformation: []*armedgeorder.ImageInformation{ + // }, + // Specifications: []*armedgeorder.Specification{ + // { + // Name: to.Ptr("Usable compute"), + // Value: to.Ptr("40 vCPU"), + // }, + // { + // Name: to.Ptr("Usable memory"), + // Value: to.Ptr("102 GB"), + // }, + // { + // Name: to.Ptr("Usable storage"), + // Value: to.Ptr("4.2 TB"), + // }, + // }, + // }, + // }, + // }, + // DisplayName: to.Ptr("Azure Stack Edge Pro - GPU"), + // FilterableProperties: []*armedgeorder.FilterableProperty{ + // { + // Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), + // SupportedValues: []*string{ + // to.Ptr("US"), + // }, + // }, + // }, + // HierarchyInformation: &armedgeorder.HierarchyInformation{ + // ConfigurationName: to.Ptr(""), + // ProductFamilyName: to.Ptr("azurestackedge"), + // ProductLineName: to.Ptr("azurestackedge"), + // ProductName: to.Ptr("azurestackedgegpu"), + // }, + // ImageInformation: []*armedgeorder.ImageInformation{ + // }, + // }, + // }, + // }, + // }, + // }, + // }, + // ResourceProviderDetails: []*armedgeorder.ResourceProviderDetails{ + // { + // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), + // }, + // }, + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-02-01/ListProductFamiliesMetadata.json +func ExampleProductsAndConfigurationsOperationGroupClient_NewListProductFamiliesMetadataPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgeorder.NewClientFactory("eb5dc900-6186-49d8-b7d7-febd866fdc1d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewProductsAndConfigurationsOperationGroupClient().NewListProductFamiliesMetadataPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armedgeorder.ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse{ + // ProductFamiliesMetadata: armedgeorder.ProductFamiliesMetadata{ + // Value: []*armedgeorder.ProductFamiliesMetadataDetails{ + // { + // Properties: &armedgeorder.ProductFamilyProperties{ + // Description: &armedgeorder.Description{ + // Attributes: []*string{ + // }, + // DescriptionType: to.Ptr(armedgeorder.DescriptionTypeBase), + // Keywords: []*string{ + // }, + // Links: []*armedgeorder.Link{ + // }, + // ShortDescription: to.Ptr("Azure managed physical edge compute device"), + // }, + // AvailabilityInformation: &armedgeorder.AvailabilityInformation{ + // AvailabilityStage: to.Ptr(armedgeorder.AvailabilityStageAvailable), + // DisabledReason: to.Ptr(armedgeorder.DisabledReasonNone), + // }, + // DisplayName: to.Ptr("Azure Stack Edge"), + // FilterableProperties: []*armedgeorder.FilterableProperty{ + // { + // Type: to.Ptr(armedgeorder.SupportedFilterTypesShipToCountries), + // SupportedValues: []*string{ + // to.Ptr("US"), + // }, + // }, + // { + // Type: to.Ptr(armedgeorder.SupportedFilterTypesDoubleEncryptionStatus), + // SupportedValues: []*string{ + // to.Ptr("Enabled"), + // }, + // }, + // }, + // HierarchyInformation: &armedgeorder.HierarchyInformation{ + // ConfigurationName: to.Ptr(""), + // ProductFamilyName: to.Ptr("azurestackedge"), + // ProductLineName: to.Ptr(""), + // ProductName: to.Ptr(""), + // }, + // ImageInformation: []*armedgeorder.ImageInformation{ + // }, + // ProductLines: []*armedgeorder.ProductLine{ + // }, + // ResourceProviderDetails: []*armedgeorder.ResourceProviderDetails{ + // { + // ResourceProviderNamespace: to.Ptr("Microsoft.DataBoxEdge"), + // }, + // }, + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/response_types.go b/sdk/resourcemanager/edgeorder/armedgeorder/response_types.go deleted file mode 100644 index 4546798df58f..000000000000 --- a/sdk/resourcemanager/edgeorder/armedgeorder/response_types.go +++ /dev/null @@ -1,131 +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. DO NOT EDIT. -// 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.BeginCreateAddress. -type ManagementClientCreateAddressResponse struct { - // Address Resource. - AddressResource -} - -// ManagementClientCreateOrderItemResponse contains the response from method ManagementClient.BeginCreateOrderItem. -type ManagementClientCreateOrderItemResponse struct { - // Represents order item contract - OrderItemResource -} - -// ManagementClientDeleteAddressByNameResponse contains the response from method ManagementClient.BeginDeleteAddressByName. -type ManagementClientDeleteAddressByNameResponse struct { - // placeholder for future response values -} - -// ManagementClientDeleteOrderItemByNameResponse contains the response from method ManagementClient.BeginDeleteOrderItemByName. -type ManagementClientDeleteOrderItemByNameResponse struct { - // placeholder for future response values -} - -// ManagementClientGetAddressByNameResponse contains the response from method ManagementClient.GetAddressByName. -type ManagementClientGetAddressByNameResponse struct { - // Address Resource. - AddressResource -} - -// ManagementClientGetOrderByNameResponse contains the response from method ManagementClient.GetOrderByName. -type ManagementClientGetOrderByNameResponse struct { - // Specifies the properties or parameters for an order. Order is a grouping of one or more order items. - OrderResource -} - -// ManagementClientGetOrderItemByNameResponse contains the response from method ManagementClient.GetOrderItemByName. -type ManagementClientGetOrderItemByNameResponse struct { - // Represents order item contract - OrderItemResource -} - -// ManagementClientListAddressesAtResourceGroupLevelResponse contains the response from method ManagementClient.NewListAddressesAtResourceGroupLevelPager. -type ManagementClientListAddressesAtResourceGroupLevelResponse struct { - // Address Resource Collection - AddressResourceList -} - -// ManagementClientListAddressesAtSubscriptionLevelResponse contains the response from method ManagementClient.NewListAddressesAtSubscriptionLevelPager. -type ManagementClientListAddressesAtSubscriptionLevelResponse struct { - // Address Resource Collection - AddressResourceList -} - -// ManagementClientListConfigurationsResponse contains the response from method ManagementClient.NewListConfigurationsPager. -type ManagementClientListConfigurationsResponse struct { - // The list of configurations. - Configurations -} - -// ManagementClientListOperationsResponse contains the response from method ManagementClient.NewListOperationsPager. -type ManagementClientListOperationsResponse struct { - // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - OperationListResult -} - -// ManagementClientListOrderAtResourceGroupLevelResponse contains the response from method ManagementClient.NewListOrderAtResourceGroupLevelPager. -type ManagementClientListOrderAtResourceGroupLevelResponse struct { - // List of orders. - OrderResourceList -} - -// ManagementClientListOrderAtSubscriptionLevelResponse contains the response from method ManagementClient.NewListOrderAtSubscriptionLevelPager. -type ManagementClientListOrderAtSubscriptionLevelResponse struct { - // List of orders. - OrderResourceList -} - -// ManagementClientListOrderItemsAtResourceGroupLevelResponse contains the response from method ManagementClient.NewListOrderItemsAtResourceGroupLevelPager. -type ManagementClientListOrderItemsAtResourceGroupLevelResponse struct { - // List of orderItems. - OrderItemResourceList -} - -// ManagementClientListOrderItemsAtSubscriptionLevelResponse contains the response from method ManagementClient.NewListOrderItemsAtSubscriptionLevelPager. -type ManagementClientListOrderItemsAtSubscriptionLevelResponse struct { - // List of orderItems. - OrderItemResourceList -} - -// ManagementClientListProductFamiliesMetadataResponse contains the response from method ManagementClient.NewListProductFamiliesMetadataPager. -type ManagementClientListProductFamiliesMetadataResponse struct { - // Holds details about product family metadata - ProductFamiliesMetadata -} - -// ManagementClientListProductFamiliesResponse contains the response from method ManagementClient.NewListProductFamiliesPager. -type ManagementClientListProductFamiliesResponse struct { - // The list of product families. - ProductFamilies -} - -// ManagementClientReturnOrderItemResponse contains the response from method ManagementClient.BeginReturnOrderItem. -type ManagementClientReturnOrderItemResponse struct { - // placeholder for future response values -} - -// ManagementClientUpdateAddressResponse contains the response from method ManagementClient.BeginUpdateAddress. -type ManagementClientUpdateAddressResponse struct { - // Address Resource. - AddressResource -} - -// ManagementClientUpdateOrderItemResponse contains the response from method ManagementClient.BeginUpdateOrderItem. -type ManagementClientUpdateOrderItemResponse struct { - // Represents order item contract - OrderItemResource -} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/responses.go b/sdk/resourcemanager/edgeorder/armedgeorder/responses.go new file mode 100644 index 000000000000..3833aec9254f --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/responses.go @@ -0,0 +1,126 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armedgeorder + +// AddressResourcesClientCreateResponse contains the response from method AddressResourcesClient.BeginCreate. +type AddressResourcesClientCreateResponse struct { + // placeholder for future response values +} + +// AddressResourcesClientDeleteResponse contains the response from method AddressResourcesClient.BeginDelete. +type AddressResourcesClientDeleteResponse struct { + // placeholder for future response values +} + +// AddressResourcesClientGetResponse contains the response from method AddressResourcesClient.Get. +type AddressResourcesClientGetResponse struct { + // Address Resource. + AddressResource +} + +// AddressResourcesClientListByResourceGroupResponse contains the response from method AddressResourcesClient.NewListByResourceGroupPager. +type AddressResourcesClientListByResourceGroupResponse struct { + // Address Resource Collection. + AddressResourceList +} + +// AddressResourcesClientListBySubscriptionResponse contains the response from method AddressResourcesClient.NewListBySubscriptionPager. +type AddressResourcesClientListBySubscriptionResponse struct { + // Address Resource Collection. + AddressResourceList +} + +// AddressResourcesClientUpdateResponse contains the response from method AddressResourcesClient.BeginUpdate. +type AddressResourcesClientUpdateResponse struct { + // Address Resource. + AddressResource +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} + +// OrderItemResourcesClientCancelResponse contains the response from method OrderItemResourcesClient.Cancel. +type OrderItemResourcesClientCancelResponse struct { + // placeholder for future response values +} + +// OrderItemResourcesClientCreateResponse contains the response from method OrderItemResourcesClient.BeginCreate. +type OrderItemResourcesClientCreateResponse struct { + // placeholder for future response values +} + +// OrderItemResourcesClientDeleteResponse contains the response from method OrderItemResourcesClient.BeginDelete. +type OrderItemResourcesClientDeleteResponse struct { + // placeholder for future response values +} + +// OrderItemResourcesClientGetResponse contains the response from method OrderItemResourcesClient.Get. +type OrderItemResourcesClientGetResponse struct { + // Represents order item resource. + OrderItemResource +} + +// OrderItemResourcesClientListByResourceGroupResponse contains the response from method OrderItemResourcesClient.NewListByResourceGroupPager. +type OrderItemResourcesClientListByResourceGroupResponse struct { + // List of order items. + OrderItemResourceList +} + +// OrderItemResourcesClientListBySubscriptionResponse contains the response from method OrderItemResourcesClient.NewListBySubscriptionPager. +type OrderItemResourcesClientListBySubscriptionResponse struct { + // List of order items. + OrderItemResourceList +} + +// OrderItemResourcesClientReturnOrderItemResponse contains the response from method OrderItemResourcesClient.BeginReturnOrderItem. +type OrderItemResourcesClientReturnOrderItemResponse struct { + // The request has succeeded. + OkResponse +} + +// OrderItemResourcesClientUpdateResponse contains the response from method OrderItemResourcesClient.BeginUpdate. +type OrderItemResourcesClientUpdateResponse struct { + // Represents order item resource. + OrderItemResource +} + +// OrderResourcesClientGetResponse contains the response from method OrderResourcesClient.Get. +type OrderResourcesClientGetResponse struct { + // Specifies the properties or parameters for an order. Order is a grouping of one or more order items. + OrderResource +} + +// OrdersOperationGroupClientListByResourceGroupResponse contains the response from method OrdersOperationGroupClient.NewListByResourceGroupPager. +type OrdersOperationGroupClientListByResourceGroupResponse struct { + // List of orders. + OrderResourceList +} + +// OrdersOperationGroupClientListBySubscriptionResponse contains the response from method OrdersOperationGroupClient.NewListBySubscriptionPager. +type OrdersOperationGroupClientListBySubscriptionResponse struct { + // List of orders. + OrderResourceList +} + +// ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse contains the response from method ProductsAndConfigurationsOperationGroupClient.NewListConfigurationsPager. +type ProductsAndConfigurationsOperationGroupClientListConfigurationsResponse struct { + // The list of configurations. + Configurations +} + +// ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse contains the response from method ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesMetadataPager. +type ProductsAndConfigurationsOperationGroupClientListProductFamiliesMetadataResponse struct { + // Holds details about product family metadata. + ProductFamiliesMetadata +} + +// ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse contains the response from method ProductsAndConfigurationsOperationGroupClient.NewListProductFamiliesPager. +type ProductsAndConfigurationsOperationGroupClientListProductFamiliesResponse struct { + // The list of product families. + ProductFamilies +} diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/time_rfc3339.go b/sdk/resourcemanager/edgeorder/armedgeorder/time_rfc3339.go index dabb368c1c5d..36252e15988f 100644 --- a/sdk/resourcemanager/edgeorder/armedgeorder/time_rfc3339.go +++ b/sdk/resourcemanager/edgeorder/armedgeorder/time_rfc3339.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armedgeorder @@ -19,12 +15,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +40,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +80,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +97,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/edgeorder/armedgeorder/tsp-location.yaml b/sdk/resourcemanager/edgeorder/armedgeorder/tsp-location.yaml new file mode 100644 index 000000000000..a986b7ea2d37 --- /dev/null +++ b/sdk/resourcemanager/edgeorder/armedgeorder/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/edgeorder/EdgeOrder.Management +commit: 1114538fd24217b94902430aa2f9b227f5c55727 +repo: Azure/azure-rest-api-specs +additionalDirectories: