From b7902c75f3ddf88134622699ac0027f94b4d7d9b Mon Sep 17 00:00:00 2001 From: ReleaseHelper Date: Fri, 6 Jan 2023 01:07:15 +0000 Subject: [PATCH] [Release] sdk/resourcemanager/mobilenetwork/armmobilenetwork/2.0.0 generation from spec commit: 340d577969b7bff5ad0488d79543314bc17daa50 --- .../armmobilenetwork/CHANGELOG.md | 36 +++ ...ttacheddatanetworks_client_example_test.go | 2 +- .../armmobilenetwork/autorest.md | 6 +- .../armmobilenetwork/constants.go | 2 +- .../datanetworks_client_example_test.go | 2 +- .../mobilenetwork/armmobilenetwork/go.mod | 2 +- .../mobilenetworks_client_example_test.go | 2 +- .../mobilenetwork/armmobilenetwork/models.go | 79 +++--- .../operations_client_example_test.go | 2 +- .../packetcorecontrolplane_client.go | 258 ------------------ ...ketcorecontrolplane_client_example_test.go | 89 ------ .../packetcorecontrolplanes_client.go | 202 ++++++++++++++ ...etcorecontrolplanes_client_example_test.go | 73 ++++- ...ontrolplaneversions_client_example_test.go | 2 +- ...acketcoredataplanes_client_example_test.go | 2 +- .../armmobilenetwork/response_types.go | 60 ++-- .../services_client_example_test.go | 2 +- .../armmobilenetwork/sim_client.go | 252 ----------------- .../sim_client_example_test.go | 198 -------------- .../simgroups_client_example_test.go | 2 +- .../simpolicies_client_example_test.go | 2 +- .../armmobilenetwork/sims_client.go | 196 +++++++++++++ .../sims_client_example_test.go | 182 +++++++++++- .../sites_client_example_test.go | 2 +- .../slices_client_example_test.go | 2 +- 25 files changed, 773 insertions(+), 884 deletions(-) delete mode 100644 sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplane_client.go delete mode 100644 sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplane_client_example_test.go delete mode 100644 sdk/resourcemanager/mobilenetwork/armmobilenetwork/sim_client.go delete mode 100644 sdk/resourcemanager/mobilenetwork/armmobilenetwork/sim_client_example_test.go diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/CHANGELOG.md b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/CHANGELOG.md index 3542b4849278..5d81606a40de 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/CHANGELOG.md +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/CHANGELOG.md @@ -1,5 +1,41 @@ # Release History +## 2.0.0 (2023-01-27) +### Breaking Changes + +- Function `NewPacketCoreControlPlaneClient` has been removed +- Function `*PacketCoreControlPlaneClient.BeginCollectDiagnosticsPackage` has been removed +- Function `*PacketCoreControlPlaneClient.BeginReinstall` has been removed +- Function `*PacketCoreControlPlaneClient.BeginRollback` has been removed +- Function `NewSimClient` has been removed +- Function `*SimClient.BeginBulkDelete` has been removed +- Function `*SimClient.BeginBulkUpload` has been removed +- Function `*SimClient.BeginBulkUploadEncrypted` has been removed +- Struct `PacketCoreControlPlaneClient` has been removed +- Struct `PacketCoreControlPlaneClientCollectDiagnosticsPackageResponse` has been removed +- Struct `PacketCoreControlPlaneClientReinstallResponse` has been removed +- Struct `PacketCoreControlPlaneClientRollbackResponse` has been removed +- Struct `SimClient` has been removed +- Struct `SimClientBulkDeleteResponse` has been removed +- Struct `SimClientBulkUploadEncryptedResponse` has been removed +- Struct `SimClientBulkUploadResponse` has been removed + +### Features Added + +- New function `*PacketCoreControlPlanesClient.BeginCollectDiagnosticsPackage(context.Context, string, string, PacketCoreControlPlaneCollectDiagnosticsPackage, *PacketCoreControlPlanesClientBeginCollectDiagnosticsPackageOptions) (*runtime.Poller[PacketCoreControlPlanesClientCollectDiagnosticsPackageResponse], error)` +- New function `*PacketCoreControlPlanesClient.BeginReinstall(context.Context, string, string, *PacketCoreControlPlanesClientBeginReinstallOptions) (*runtime.Poller[PacketCoreControlPlanesClientReinstallResponse], error)` +- New function `*PacketCoreControlPlanesClient.BeginRollback(context.Context, string, string, *PacketCoreControlPlanesClientBeginRollbackOptions) (*runtime.Poller[PacketCoreControlPlanesClientRollbackResponse], error)` +- New function `*SimsClient.BeginBulkDelete(context.Context, string, string, SimDeleteList, *SimsClientBeginBulkDeleteOptions) (*runtime.Poller[SimsClientBulkDeleteResponse], error)` +- New function `*SimsClient.BeginBulkUpload(context.Context, string, string, SimUploadList, *SimsClientBeginBulkUploadOptions) (*runtime.Poller[SimsClientBulkUploadResponse], error)` +- New function `*SimsClient.BeginBulkUploadEncrypted(context.Context, string, string, EncryptedSimUploadList, *SimsClientBeginBulkUploadEncryptedOptions) (*runtime.Poller[SimsClientBulkUploadEncryptedResponse], error)` +- New struct `PacketCoreControlPlanesClientCollectDiagnosticsPackageResponse` +- New struct `PacketCoreControlPlanesClientReinstallResponse` +- New struct `PacketCoreControlPlanesClientRollbackResponse` +- New struct `SimsClientBulkDeleteResponse` +- New struct `SimsClientBulkUploadEncryptedResponse` +- New struct `SimsClientBulkUploadResponse` + + ## 1.0.0 (2022-12-23) ### Breaking Changes diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/attacheddatanetworks_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/attacheddatanetworks_client_example_test.go index f189e72a5e42..231a3cb4e498 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/attacheddatanetworks_client_example_test.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/attacheddatanetworks_client_example_test.go @@ -14,7 +14,7 @@ import ( "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/mobilenetwork/armmobilenetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/AttachedDataNetworkDelete.json diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/autorest.md b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/autorest.md index 9fea2d042067..5e3eb9e1bc5c 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/autorest.md +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8739a0a2ac54b0d8f8c98da22ee6b446c53b09a7/specification/mobilenetwork/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8739a0a2ac54b0d8f8c98da22ee6b446c53b09a7/specification/mobilenetwork/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/340d577969b7bff5ad0488d79543314bc17daa50/specification/mobilenetwork/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/340d577969b7bff5ad0488d79543314bc17daa50/specification/mobilenetwork/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/constants.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/constants.go index 598a710c6961..c589556179a7 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/constants.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/constants.go @@ -11,7 +11,7 @@ package armmobilenetwork const ( moduleName = "armmobilenetwork" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) // AuthenticationType - How to authenticate users who access local diagnostics APIs. diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/datanetworks_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/datanetworks_client_example_test.go index 145495f09f5c..0b9121c2a0fe 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/datanetworks_client_example_test.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/datanetworks_client_example_test.go @@ -14,7 +14,7 @@ import ( "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/mobilenetwork/armmobilenetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/DataNetworkDelete.json diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/go.mod b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/go.mod index 0857b81c1ba2..e94133eb9543 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/go.mod +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2 go 1.18 diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/mobilenetworks_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/mobilenetworks_client_example_test.go index a3fc0a1804db..f7ee26c00e24 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/mobilenetworks_client_example_test.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/mobilenetworks_client_example_test.go @@ -14,7 +14,7 @@ import ( "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/mobilenetwork/armmobilenetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/MobileNetworkDelete.json diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/models.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/models.go index 3ac1ae50d9f5..c75db830698e 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/models.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/models.go @@ -688,27 +688,6 @@ type PacketCoreControlPlane struct { Type *string `json:"type,omitempty" azure:"ro"` } -// PacketCoreControlPlaneClientBeginCollectDiagnosticsPackageOptions contains the optional parameters for the PacketCoreControlPlaneClient.BeginCollectDiagnosticsPackage -// method. -type PacketCoreControlPlaneClientBeginCollectDiagnosticsPackageOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PacketCoreControlPlaneClientBeginReinstallOptions contains the optional parameters for the PacketCoreControlPlaneClient.BeginReinstall -// method. -type PacketCoreControlPlaneClientBeginReinstallOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PacketCoreControlPlaneClientBeginRollbackOptions contains the optional parameters for the PacketCoreControlPlaneClient.BeginRollback -// method. -type PacketCoreControlPlaneClientBeginRollbackOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - // PacketCoreControlPlaneCollectDiagnosticsPackage - Packet core control plane collect diagnostics package options type PacketCoreControlPlaneCollectDiagnosticsPackage struct { // REQUIRED; The Storage Account Blob URL to upload the diagnostics package to. @@ -815,6 +794,13 @@ type PacketCoreControlPlaneVersionsClientListOptions struct { // placeholder for future optional parameters } +// PacketCoreControlPlanesClientBeginCollectDiagnosticsPackageOptions contains the optional parameters for the PacketCoreControlPlanesClient.BeginCollectDiagnosticsPackage +// method. +type PacketCoreControlPlanesClientBeginCollectDiagnosticsPackageOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // PacketCoreControlPlanesClientBeginCreateOrUpdateOptions contains the optional parameters for the PacketCoreControlPlanesClient.BeginCreateOrUpdate // method. type PacketCoreControlPlanesClientBeginCreateOrUpdateOptions struct { @@ -829,6 +815,20 @@ type PacketCoreControlPlanesClientBeginDeleteOptions struct { ResumeToken string } +// PacketCoreControlPlanesClientBeginReinstallOptions contains the optional parameters for the PacketCoreControlPlanesClient.BeginReinstall +// method. +type PacketCoreControlPlanesClientBeginReinstallOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PacketCoreControlPlanesClientBeginRollbackOptions contains the optional parameters for the PacketCoreControlPlanesClient.BeginRollback +// method. +type PacketCoreControlPlanesClientBeginRollbackOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // PacketCoreControlPlanesClientGetOptions contains the optional parameters for the PacketCoreControlPlanesClient.Get method. type PacketCoreControlPlanesClientGetOptions struct { // placeholder for future optional parameters @@ -1283,24 +1283,6 @@ type Sim struct { Type *string `json:"type,omitempty" azure:"ro"` } -// SimClientBeginBulkDeleteOptions contains the optional parameters for the SimClient.BeginBulkDelete method. -type SimClientBeginBulkDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SimClientBeginBulkUploadEncryptedOptions contains the optional parameters for the SimClient.BeginBulkUploadEncrypted method. -type SimClientBeginBulkUploadEncryptedOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SimClientBeginBulkUploadOptions contains the optional parameters for the SimClient.BeginBulkUpload method. -type SimClientBeginBulkUploadOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - // SimDeleteList - The SIMs to delete. type SimDeleteList struct { // REQUIRED; A list of SIM resource names to delete. @@ -1588,6 +1570,25 @@ type SimUploadList struct { Sims []*SimNameAndProperties `json:"sims,omitempty"` } +// SimsClientBeginBulkDeleteOptions contains the optional parameters for the SimsClient.BeginBulkDelete method. +type SimsClientBeginBulkDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SimsClientBeginBulkUploadEncryptedOptions contains the optional parameters for the SimsClient.BeginBulkUploadEncrypted +// method. +type SimsClientBeginBulkUploadEncryptedOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SimsClientBeginBulkUploadOptions contains the optional parameters for the SimsClient.BeginBulkUpload method. +type SimsClientBeginBulkUploadOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // SimsClientBeginCreateOrUpdateOptions contains the optional parameters for the SimsClient.BeginCreateOrUpdate method. type SimsClientBeginCreateOrUpdateOptions struct { // Resumes the LRO from the provided token. diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/operations_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/operations_client_example_test.go index a9437d938c11..3607db7dd4a6 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/operations_client_example_test.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/operations_client_example_test.go @@ -13,7 +13,7 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/OperationList.json diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplane_client.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplane_client.go deleted file mode 100644 index e0fe8b756cea..000000000000 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplane_client.go +++ /dev/null @@ -1,258 +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 armmobilenetwork - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PacketCoreControlPlaneClient contains the methods for the PacketCoreControlPlane group. -// Don't use this type directly, use NewPacketCoreControlPlaneClient() instead. -type PacketCoreControlPlaneClient struct { - host string - subscriptionID string - pl runtime.Pipeline -} - -// NewPacketCoreControlPlaneClient creates a new instance of PacketCoreControlPlaneClient 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 NewPacketCoreControlPlaneClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PacketCoreControlPlaneClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &PacketCoreControlPlaneClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// BeginCollectDiagnosticsPackage - Collect a diagnostics package for the specified packet core control plane. This action -// will upload the diagnostics to a storage account. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// packetCoreControlPlaneName - The name of the packet core control plane. -// parameters - Parameters supplied to the packet core control plane collect diagnostics package operation. -// options - PacketCoreControlPlaneClientBeginCollectDiagnosticsPackageOptions contains the optional parameters for the PacketCoreControlPlaneClient.BeginCollectDiagnosticsPackage -// method. -func (client *PacketCoreControlPlaneClient) BeginCollectDiagnosticsPackage(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, parameters PacketCoreControlPlaneCollectDiagnosticsPackage, options *PacketCoreControlPlaneClientBeginCollectDiagnosticsPackageOptions) (*runtime.Poller[PacketCoreControlPlaneClientCollectDiagnosticsPackageResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.collectDiagnosticsPackage(ctx, resourceGroupName, packetCoreControlPlaneName, parameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PacketCoreControlPlaneClientCollectDiagnosticsPackageResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[PacketCoreControlPlaneClientCollectDiagnosticsPackageResponse](options.ResumeToken, client.pl, nil) - } -} - -// CollectDiagnosticsPackage - Collect a diagnostics package for the specified packet core control plane. This action will -// upload the diagnostics to a storage account. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01 -func (client *PacketCoreControlPlaneClient) collectDiagnosticsPackage(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, parameters PacketCoreControlPlaneCollectDiagnosticsPackage, options *PacketCoreControlPlaneClientBeginCollectDiagnosticsPackageOptions) (*http.Response, error) { - req, err := client.collectDiagnosticsPackageCreateRequest(ctx, resourceGroupName, packetCoreControlPlaneName, parameters, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// collectDiagnosticsPackageCreateRequest creates the CollectDiagnosticsPackage request. -func (client *PacketCoreControlPlaneClient) collectDiagnosticsPackageCreateRequest(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, parameters PacketCoreControlPlaneCollectDiagnosticsPackage, options *PacketCoreControlPlaneClientBeginCollectDiagnosticsPackageOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if packetCoreControlPlaneName == "" { - return nil, errors.New("parameter packetCoreControlPlaneName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{packetCoreControlPlaneName}", url.PathEscape(packetCoreControlPlaneName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// BeginReinstall - Reinstall the specified packet core control plane. This action will remove any transaction state from -// the packet core to return it to a known state. This action will cause a service outage. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// packetCoreControlPlaneName - The name of the packet core control plane. -// options - PacketCoreControlPlaneClientBeginReinstallOptions contains the optional parameters for the PacketCoreControlPlaneClient.BeginReinstall -// method. -func (client *PacketCoreControlPlaneClient) BeginReinstall(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, options *PacketCoreControlPlaneClientBeginReinstallOptions) (*runtime.Poller[PacketCoreControlPlaneClientReinstallResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.reinstall(ctx, resourceGroupName, packetCoreControlPlaneName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PacketCoreControlPlaneClientReinstallResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[PacketCoreControlPlaneClientReinstallResponse](options.ResumeToken, client.pl, nil) - } -} - -// Reinstall - Reinstall the specified packet core control plane. This action will remove any transaction state from the packet -// core to return it to a known state. This action will cause a service outage. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01 -func (client *PacketCoreControlPlaneClient) reinstall(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, options *PacketCoreControlPlaneClientBeginReinstallOptions) (*http.Response, error) { - req, err := client.reinstallCreateRequest(ctx, resourceGroupName, packetCoreControlPlaneName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// reinstallCreateRequest creates the Reinstall request. -func (client *PacketCoreControlPlaneClient) reinstallCreateRequest(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, options *PacketCoreControlPlaneClientBeginReinstallOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if packetCoreControlPlaneName == "" { - return nil, errors.New("parameter packetCoreControlPlaneName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{packetCoreControlPlaneName}", url.PathEscape(packetCoreControlPlaneName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// BeginRollback - Roll back the specified packet core control plane to the previous version, "rollbackVersion". Multiple -// consecutive rollbacks are not possible. This action may cause a service outage. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// packetCoreControlPlaneName - The name of the packet core control plane. -// options - PacketCoreControlPlaneClientBeginRollbackOptions contains the optional parameters for the PacketCoreControlPlaneClient.BeginRollback -// method. -func (client *PacketCoreControlPlaneClient) BeginRollback(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, options *PacketCoreControlPlaneClientBeginRollbackOptions) (*runtime.Poller[PacketCoreControlPlaneClientRollbackResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.rollback(ctx, resourceGroupName, packetCoreControlPlaneName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PacketCoreControlPlaneClientRollbackResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[PacketCoreControlPlaneClientRollbackResponse](options.ResumeToken, client.pl, nil) - } -} - -// Rollback - Roll back the specified packet core control plane to the previous version, "rollbackVersion". Multiple consecutive -// rollbacks are not possible. This action may cause a service outage. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01 -func (client *PacketCoreControlPlaneClient) rollback(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, options *PacketCoreControlPlaneClientBeginRollbackOptions) (*http.Response, error) { - req, err := client.rollbackCreateRequest(ctx, resourceGroupName, packetCoreControlPlaneName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// rollbackCreateRequest creates the Rollback request. -func (client *PacketCoreControlPlaneClient) rollbackCreateRequest(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, options *PacketCoreControlPlaneClientBeginRollbackOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if packetCoreControlPlaneName == "" { - return nil, errors.New("parameter packetCoreControlPlaneName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{packetCoreControlPlaneName}", url.PathEscape(packetCoreControlPlaneName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplane_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplane_client_example_test.go deleted file mode 100644 index 0b08d9662543..000000000000 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplane_client_example_test.go +++ /dev/null @@ -1,89 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmobilenetwork_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/mobilenetwork/armmobilenetwork" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneRollback.json -func ExamplePacketCoreControlPlaneClient_BeginRollback() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmobilenetwork.NewPacketCoreControlPlaneClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRollback(ctx, "rg1", "TestPacketCoreCP", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneReinstall.json -func ExamplePacketCoreControlPlaneClient_BeginReinstall() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmobilenetwork.NewPacketCoreControlPlaneClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReinstall(ctx, "rg1", "TestPacketCoreCP", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneCollectDiagnosticsPackage.json -func ExamplePacketCoreControlPlaneClient_BeginCollectDiagnosticsPackage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmobilenetwork.NewPacketCoreControlPlaneClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCollectDiagnosticsPackage(ctx, "rg1", "TestPacketCoreCP", armmobilenetwork.PacketCoreControlPlaneCollectDiagnosticsPackage{ - StorageAccountBlobURL: to.Ptr("https://contosoaccount.blob.core.windows.net/container/diagnosticsPackage.zip"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplanes_client.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplanes_client.go index 71ab818e76d6..381111801170 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplanes_client.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplanes_client.go @@ -55,6 +55,74 @@ func NewPacketCoreControlPlanesClient(subscriptionID string, credential azcore.T return client, nil } +// BeginCollectDiagnosticsPackage - Collect a diagnostics package for the specified packet core control plane. This action +// will upload the diagnostics to a storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// packetCoreControlPlaneName - The name of the packet core control plane. +// parameters - Parameters supplied to the packet core control plane collect diagnostics package operation. +// options - PacketCoreControlPlanesClientBeginCollectDiagnosticsPackageOptions contains the optional parameters for the PacketCoreControlPlanesClient.BeginCollectDiagnosticsPackage +// method. +func (client *PacketCoreControlPlanesClient) BeginCollectDiagnosticsPackage(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, parameters PacketCoreControlPlaneCollectDiagnosticsPackage, options *PacketCoreControlPlanesClientBeginCollectDiagnosticsPackageOptions) (*runtime.Poller[PacketCoreControlPlanesClientCollectDiagnosticsPackageResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.collectDiagnosticsPackage(ctx, resourceGroupName, packetCoreControlPlaneName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PacketCoreControlPlanesClientCollectDiagnosticsPackageResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PacketCoreControlPlanesClientCollectDiagnosticsPackageResponse](options.ResumeToken, client.pl, nil) + } +} + +// CollectDiagnosticsPackage - Collect a diagnostics package for the specified packet core control plane. This action will +// upload the diagnostics to a storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01 +func (client *PacketCoreControlPlanesClient) collectDiagnosticsPackage(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, parameters PacketCoreControlPlaneCollectDiagnosticsPackage, options *PacketCoreControlPlanesClientBeginCollectDiagnosticsPackageOptions) (*http.Response, error) { + req, err := client.collectDiagnosticsPackageCreateRequest(ctx, resourceGroupName, packetCoreControlPlaneName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// collectDiagnosticsPackageCreateRequest creates the CollectDiagnosticsPackage request. +func (client *PacketCoreControlPlanesClient) collectDiagnosticsPackageCreateRequest(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, parameters PacketCoreControlPlaneCollectDiagnosticsPackage, options *PacketCoreControlPlanesClientBeginCollectDiagnosticsPackageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if packetCoreControlPlaneName == "" { + return nil, errors.New("parameter packetCoreControlPlaneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packetCoreControlPlaneName}", url.PathEscape(packetCoreControlPlaneName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + // BeginCreateOrUpdate - Creates or updates a packet core control plane. // If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-11-01 @@ -366,6 +434,140 @@ func (client *PacketCoreControlPlanesClient) listBySubscriptionHandleResponse(re return result, nil } +// BeginReinstall - Reinstall the specified packet core control plane. This action will remove any transaction state from +// the packet core to return it to a known state. This action will cause a service outage. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// packetCoreControlPlaneName - The name of the packet core control plane. +// options - PacketCoreControlPlanesClientBeginReinstallOptions contains the optional parameters for the PacketCoreControlPlanesClient.BeginReinstall +// method. +func (client *PacketCoreControlPlanesClient) BeginReinstall(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, options *PacketCoreControlPlanesClientBeginReinstallOptions) (*runtime.Poller[PacketCoreControlPlanesClientReinstallResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reinstall(ctx, resourceGroupName, packetCoreControlPlaneName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PacketCoreControlPlanesClientReinstallResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PacketCoreControlPlanesClientReinstallResponse](options.ResumeToken, client.pl, nil) + } +} + +// Reinstall - Reinstall the specified packet core control plane. This action will remove any transaction state from the packet +// core to return it to a known state. This action will cause a service outage. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01 +func (client *PacketCoreControlPlanesClient) reinstall(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, options *PacketCoreControlPlanesClientBeginReinstallOptions) (*http.Response, error) { + req, err := client.reinstallCreateRequest(ctx, resourceGroupName, packetCoreControlPlaneName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// reinstallCreateRequest creates the Reinstall request. +func (client *PacketCoreControlPlanesClient) reinstallCreateRequest(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, options *PacketCoreControlPlanesClientBeginReinstallOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if packetCoreControlPlaneName == "" { + return nil, errors.New("parameter packetCoreControlPlaneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packetCoreControlPlaneName}", url.PathEscape(packetCoreControlPlaneName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginRollback - Roll back the specified packet core control plane to the previous version, "rollbackVersion". Multiple +// consecutive rollbacks are not possible. This action may cause a service outage. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// packetCoreControlPlaneName - The name of the packet core control plane. +// options - PacketCoreControlPlanesClientBeginRollbackOptions contains the optional parameters for the PacketCoreControlPlanesClient.BeginRollback +// method. +func (client *PacketCoreControlPlanesClient) BeginRollback(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, options *PacketCoreControlPlanesClientBeginRollbackOptions) (*runtime.Poller[PacketCoreControlPlanesClientRollbackResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.rollback(ctx, resourceGroupName, packetCoreControlPlaneName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PacketCoreControlPlanesClientRollbackResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PacketCoreControlPlanesClientRollbackResponse](options.ResumeToken, client.pl, nil) + } +} + +// Rollback - Roll back the specified packet core control plane to the previous version, "rollbackVersion". Multiple consecutive +// rollbacks are not possible. This action may cause a service outage. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01 +func (client *PacketCoreControlPlanesClient) rollback(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, options *PacketCoreControlPlanesClientBeginRollbackOptions) (*http.Response, error) { + req, err := client.rollbackCreateRequest(ctx, resourceGroupName, packetCoreControlPlaneName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// rollbackCreateRequest creates the Rollback request. +func (client *PacketCoreControlPlanesClient) rollbackCreateRequest(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, options *PacketCoreControlPlanesClientBeginRollbackOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if packetCoreControlPlaneName == "" { + return nil, errors.New("parameter packetCoreControlPlaneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packetCoreControlPlaneName}", url.PathEscape(packetCoreControlPlaneName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // UpdateTags - Updates packet core control planes tags. // If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-11-01 diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplanes_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplanes_client_example_test.go index fb2e9b618241..1570ac0faadf 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplanes_client_example_test.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplanes_client_example_test.go @@ -14,7 +14,7 @@ import ( "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/mobilenetwork/armmobilenetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneDelete.json @@ -184,3 +184,74 @@ func ExamplePacketCoreControlPlanesClient_NewListByResourceGroupPager() { } } } + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneRollback.json +func ExamplePacketCoreControlPlanesClient_BeginRollback() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmobilenetwork.NewPacketCoreControlPlanesClient("subid", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginRollback(ctx, "rg1", "TestPacketCoreCP", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneReinstall.json +func ExamplePacketCoreControlPlanesClient_BeginReinstall() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmobilenetwork.NewPacketCoreControlPlanesClient("subid", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginReinstall(ctx, "rg1", "TestPacketCoreCP", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneCollectDiagnosticsPackage.json +func ExamplePacketCoreControlPlanesClient_BeginCollectDiagnosticsPackage() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmobilenetwork.NewPacketCoreControlPlanesClient("subid", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCollectDiagnosticsPackage(ctx, "rg1", "TestPacketCoreCP", armmobilenetwork.PacketCoreControlPlaneCollectDiagnosticsPackage{ + StorageAccountBlobURL: to.Ptr("https://contosoaccount.blob.core.windows.net/container/diagnosticsPackage.zip"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplaneversions_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplaneversions_client_example_test.go index e465772ad2eb..4e74f653f9c5 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplaneversions_client_example_test.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcorecontrolplaneversions_client_example_test.go @@ -13,7 +13,7 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneVersionGet.json diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcoredataplanes_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcoredataplanes_client_example_test.go index cf2e9367202b..ae484af2204b 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcoredataplanes_client_example_test.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/packetcoredataplanes_client_example_test.go @@ -14,7 +14,7 @@ import ( "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/mobilenetwork/armmobilenetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreDataPlaneDelete.json diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/response_types.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/response_types.go index f8a993a3070e..f80771060115 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/response_types.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/response_types.go @@ -94,21 +94,6 @@ type OperationsClientListResponse struct { OperationList } -// PacketCoreControlPlaneClientCollectDiagnosticsPackageResponse contains the response from method PacketCoreControlPlaneClient.CollectDiagnosticsPackage. -type PacketCoreControlPlaneClientCollectDiagnosticsPackageResponse struct { - AsyncOperationStatus -} - -// PacketCoreControlPlaneClientReinstallResponse contains the response from method PacketCoreControlPlaneClient.Reinstall. -type PacketCoreControlPlaneClientReinstallResponse struct { - AsyncOperationStatus -} - -// PacketCoreControlPlaneClientRollbackResponse contains the response from method PacketCoreControlPlaneClient.Rollback. -type PacketCoreControlPlaneClientRollbackResponse struct { - AsyncOperationStatus -} - // PacketCoreControlPlaneVersionsClientGetResponse contains the response from method PacketCoreControlPlaneVersionsClient.Get. type PacketCoreControlPlaneVersionsClientGetResponse struct { PacketCoreControlPlaneVersion @@ -119,6 +104,11 @@ type PacketCoreControlPlaneVersionsClientListResponse struct { PacketCoreControlPlaneVersionListResult } +// PacketCoreControlPlanesClientCollectDiagnosticsPackageResponse contains the response from method PacketCoreControlPlanesClient.CollectDiagnosticsPackage. +type PacketCoreControlPlanesClientCollectDiagnosticsPackageResponse struct { + AsyncOperationStatus +} + // PacketCoreControlPlanesClientCreateOrUpdateResponse contains the response from method PacketCoreControlPlanesClient.CreateOrUpdate. type PacketCoreControlPlanesClientCreateOrUpdateResponse struct { PacketCoreControlPlane @@ -144,6 +134,16 @@ type PacketCoreControlPlanesClientListBySubscriptionResponse struct { PacketCoreControlPlaneListResult } +// PacketCoreControlPlanesClientReinstallResponse contains the response from method PacketCoreControlPlanesClient.Reinstall. +type PacketCoreControlPlanesClientReinstallResponse struct { + AsyncOperationStatus +} + +// PacketCoreControlPlanesClientRollbackResponse contains the response from method PacketCoreControlPlanesClient.Rollback. +type PacketCoreControlPlanesClientRollbackResponse struct { + AsyncOperationStatus +} + // PacketCoreControlPlanesClientUpdateTagsResponse contains the response from method PacketCoreControlPlanesClient.UpdateTags. type PacketCoreControlPlanesClientUpdateTagsResponse struct { PacketCoreControlPlane @@ -199,21 +199,6 @@ type ServicesClientUpdateTagsResponse struct { Service } -// SimClientBulkDeleteResponse contains the response from method SimClient.BulkDelete. -type SimClientBulkDeleteResponse struct { - AsyncOperationStatus -} - -// SimClientBulkUploadEncryptedResponse contains the response from method SimClient.BulkUploadEncrypted. -type SimClientBulkUploadEncryptedResponse struct { - AsyncOperationStatus -} - -// SimClientBulkUploadResponse contains the response from method SimClient.BulkUpload. -type SimClientBulkUploadResponse struct { - AsyncOperationStatus -} - // SimGroupsClientCreateOrUpdateResponse contains the response from method SimGroupsClient.CreateOrUpdate. type SimGroupsClientCreateOrUpdateResponse struct { SimGroup @@ -269,6 +254,21 @@ type SimPoliciesClientUpdateTagsResponse struct { SimPolicy } +// SimsClientBulkDeleteResponse contains the response from method SimsClient.BulkDelete. +type SimsClientBulkDeleteResponse struct { + AsyncOperationStatus +} + +// SimsClientBulkUploadEncryptedResponse contains the response from method SimsClient.BulkUploadEncrypted. +type SimsClientBulkUploadEncryptedResponse struct { + AsyncOperationStatus +} + +// SimsClientBulkUploadResponse contains the response from method SimsClient.BulkUpload. +type SimsClientBulkUploadResponse struct { + AsyncOperationStatus +} + // SimsClientCreateOrUpdateResponse contains the response from method SimsClient.CreateOrUpdate. type SimsClientCreateOrUpdateResponse struct { Sim diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/services_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/services_client_example_test.go index 7af5671c5904..46fa0dc0d027 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/services_client_example_test.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/services_client_example_test.go @@ -14,7 +14,7 @@ import ( "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/mobilenetwork/armmobilenetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/ServiceDelete.json diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sim_client.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sim_client.go deleted file mode 100644 index d630d53d5da0..000000000000 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sim_client.go +++ /dev/null @@ -1,252 +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 armmobilenetwork - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// SimClient contains the methods for the Sim group. -// Don't use this type directly, use NewSimClient() instead. -type SimClient struct { - host string - subscriptionID string - pl runtime.Pipeline -} - -// NewSimClient creates a new instance of SimClient 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 NewSimClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SimClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &SimClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// BeginBulkDelete - Bulk delete SIMs from a SIM group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// simGroupName - The name of the SIM Group. -// parameters - Parameters supplied to the bulk SIM delete operation. -// options - SimClientBeginBulkDeleteOptions contains the optional parameters for the SimClient.BeginBulkDelete method. -func (client *SimClient) BeginBulkDelete(ctx context.Context, resourceGroupName string, simGroupName string, parameters SimDeleteList, options *SimClientBeginBulkDeleteOptions) (*runtime.Poller[SimClientBulkDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.bulkDelete(ctx, resourceGroupName, simGroupName, parameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SimClientBulkDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[SimClientBulkDeleteResponse](options.ResumeToken, client.pl, nil) - } -} - -// BulkDelete - Bulk delete SIMs from a SIM group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01 -func (client *SimClient) bulkDelete(ctx context.Context, resourceGroupName string, simGroupName string, parameters SimDeleteList, options *SimClientBeginBulkDeleteOptions) (*http.Response, error) { - req, err := client.bulkDeleteCreateRequest(ctx, resourceGroupName, simGroupName, parameters, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// bulkDeleteCreateRequest creates the BulkDelete request. -func (client *SimClient) bulkDeleteCreateRequest(ctx context.Context, resourceGroupName string, simGroupName string, parameters SimDeleteList, options *SimClientBeginBulkDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if simGroupName == "" { - return nil, errors.New("parameter simGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{simGroupName}", url.PathEscape(simGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// BeginBulkUpload - Bulk upload SIMs to a SIM group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// simGroupName - The name of the SIM Group. -// parameters - Parameters supplied to the bulk SIM upload operation. -// options - SimClientBeginBulkUploadOptions contains the optional parameters for the SimClient.BeginBulkUpload method. -func (client *SimClient) BeginBulkUpload(ctx context.Context, resourceGroupName string, simGroupName string, parameters SimUploadList, options *SimClientBeginBulkUploadOptions) (*runtime.Poller[SimClientBulkUploadResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.bulkUpload(ctx, resourceGroupName, simGroupName, parameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SimClientBulkUploadResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[SimClientBulkUploadResponse](options.ResumeToken, client.pl, nil) - } -} - -// BulkUpload - Bulk upload SIMs to a SIM group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01 -func (client *SimClient) bulkUpload(ctx context.Context, resourceGroupName string, simGroupName string, parameters SimUploadList, options *SimClientBeginBulkUploadOptions) (*http.Response, error) { - req, err := client.bulkUploadCreateRequest(ctx, resourceGroupName, simGroupName, parameters, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// bulkUploadCreateRequest creates the BulkUpload request. -func (client *SimClient) bulkUploadCreateRequest(ctx context.Context, resourceGroupName string, simGroupName string, parameters SimUploadList, options *SimClientBeginBulkUploadOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if simGroupName == "" { - return nil, errors.New("parameter simGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{simGroupName}", url.PathEscape(simGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// BeginBulkUploadEncrypted - Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// simGroupName - The name of the SIM Group. -// parameters - Parameters supplied to the encrypted SIMs upload operation. -// options - SimClientBeginBulkUploadEncryptedOptions contains the optional parameters for the SimClient.BeginBulkUploadEncrypted -// method. -func (client *SimClient) BeginBulkUploadEncrypted(ctx context.Context, resourceGroupName string, simGroupName string, parameters EncryptedSimUploadList, options *SimClientBeginBulkUploadEncryptedOptions) (*runtime.Poller[SimClientBulkUploadEncryptedResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.bulkUploadEncrypted(ctx, resourceGroupName, simGroupName, parameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SimClientBulkUploadEncryptedResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[SimClientBulkUploadEncryptedResponse](options.ResumeToken, client.pl, nil) - } -} - -// BulkUploadEncrypted - Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01 -func (client *SimClient) bulkUploadEncrypted(ctx context.Context, resourceGroupName string, simGroupName string, parameters EncryptedSimUploadList, options *SimClientBeginBulkUploadEncryptedOptions) (*http.Response, error) { - req, err := client.bulkUploadEncryptedCreateRequest(ctx, resourceGroupName, simGroupName, parameters, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// bulkUploadEncryptedCreateRequest creates the BulkUploadEncrypted request. -func (client *SimClient) bulkUploadEncryptedCreateRequest(ctx context.Context, resourceGroupName string, simGroupName string, parameters EncryptedSimUploadList, options *SimClientBeginBulkUploadEncryptedOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if simGroupName == "" { - return nil, errors.New("parameter simGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{simGroupName}", url.PathEscape(simGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sim_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sim_client_example_test.go deleted file mode 100644 index 21e87c176df8..000000000000 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sim_client_example_test.go +++ /dev/null @@ -1,198 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmobilenetwork_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/mobilenetwork/armmobilenetwork" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimBulkUpload.json -func ExampleSimClient_BeginBulkUpload() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmobilenetwork.NewSimClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginBulkUpload(ctx, "rg1", "testSimGroup", armmobilenetwork.SimUploadList{ - Sims: []*armmobilenetwork.SimNameAndProperties{ - { - Name: to.Ptr("testSim"), - Properties: &armmobilenetwork.SimPropertiesFormat{ - DeviceType: to.Ptr("Video camera"), - IntegratedCircuitCardIdentifier: to.Ptr("8900000000000000000"), - InternationalMobileSubscriberIdentity: to.Ptr("00000"), - SimPolicy: &armmobilenetwork.SimPolicyResourceID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy"), - }, - StaticIPConfiguration: []*armmobilenetwork.SimStaticIPProperties{ - { - AttachedDataNetwork: &armmobilenetwork.AttachedDataNetworkResourceID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork"), - }, - Slice: &armmobilenetwork.SliceResourceID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice"), - }, - StaticIP: &armmobilenetwork.SimStaticIPPropertiesStaticIP{ - IPv4Address: to.Ptr("2.4.0.1"), - }, - }}, - AuthenticationKey: to.Ptr("00000000000000000000000000000000"), - OperatorKeyCode: to.Ptr("00000000000000000000000000000000"), - }, - }, - { - Name: to.Ptr("testSim2"), - Properties: &armmobilenetwork.SimPropertiesFormat{ - DeviceType: to.Ptr("Video camera"), - IntegratedCircuitCardIdentifier: to.Ptr("8900000000000000001"), - InternationalMobileSubscriberIdentity: to.Ptr("00000"), - SimPolicy: &armmobilenetwork.SimPolicyResourceID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy"), - }, - StaticIPConfiguration: []*armmobilenetwork.SimStaticIPProperties{ - { - AttachedDataNetwork: &armmobilenetwork.AttachedDataNetworkResourceID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork"), - }, - Slice: &armmobilenetwork.SliceResourceID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice"), - }, - StaticIP: &armmobilenetwork.SimStaticIPPropertiesStaticIP{ - IPv4Address: to.Ptr("2.4.0.2"), - }, - }}, - AuthenticationKey: to.Ptr("00000000000000000000000000000000"), - OperatorKeyCode: to.Ptr("00000000000000000000000000000000"), - }, - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimBulkDelete.json -func ExampleSimClient_BeginBulkDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmobilenetwork.NewSimClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginBulkDelete(ctx, "testResourceGroupName", "testSimGroup", armmobilenetwork.SimDeleteList{ - Sims: []*string{ - to.Ptr("testSim"), - to.Ptr("testSim2")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimBulkUploadEncrypted.json -func ExampleSimClient_BeginBulkUploadEncrypted() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmobilenetwork.NewSimClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginBulkUploadEncrypted(ctx, "rg1", "testSimGroup", armmobilenetwork.EncryptedSimUploadList{ - AzureKeyIdentifier: to.Ptr[int32](1), - EncryptedTransportKey: to.Ptr("ABC123"), - SignedTransportKey: to.Ptr("ABC123"), - Sims: []*armmobilenetwork.SimNameAndEncryptedProperties{ - { - Name: to.Ptr("testSim"), - Properties: &armmobilenetwork.EncryptedSimPropertiesFormat{ - DeviceType: to.Ptr("Video camera"), - IntegratedCircuitCardIdentifier: to.Ptr("8900000000000000000"), - InternationalMobileSubscriberIdentity: to.Ptr("00000"), - SimPolicy: &armmobilenetwork.SimPolicyResourceID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy"), - }, - StaticIPConfiguration: []*armmobilenetwork.SimStaticIPProperties{ - { - AttachedDataNetwork: &armmobilenetwork.AttachedDataNetworkResourceID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork"), - }, - Slice: &armmobilenetwork.SliceResourceID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice"), - }, - StaticIP: &armmobilenetwork.SimStaticIPPropertiesStaticIP{ - IPv4Address: to.Ptr("2.4.0.1"), - }, - }}, - EncryptedCredentials: to.Ptr("ABC123"), - }, - }, - { - Name: to.Ptr("testSim2"), - Properties: &armmobilenetwork.EncryptedSimPropertiesFormat{ - DeviceType: to.Ptr("Video camera"), - IntegratedCircuitCardIdentifier: to.Ptr("8900000000000000001"), - InternationalMobileSubscriberIdentity: to.Ptr("00000"), - SimPolicy: &armmobilenetwork.SimPolicyResourceID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy"), - }, - StaticIPConfiguration: []*armmobilenetwork.SimStaticIPProperties{ - { - AttachedDataNetwork: &armmobilenetwork.AttachedDataNetworkResourceID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork"), - }, - Slice: &armmobilenetwork.SliceResourceID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice"), - }, - StaticIP: &armmobilenetwork.SimStaticIPPropertiesStaticIP{ - IPv4Address: to.Ptr("2.4.0.2"), - }, - }}, - EncryptedCredentials: to.Ptr("ABC123"), - }, - }}, - VendorKeyFingerprint: to.Ptr("ABC123"), - Version: to.Ptr[int32](1), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/simgroups_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/simgroups_client_example_test.go index c8597ebc3f83..4ab8b09a060c 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/simgroups_client_example_test.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/simgroups_client_example_test.go @@ -14,7 +14,7 @@ import ( "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/mobilenetwork/armmobilenetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimGroupDelete.json diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/simpolicies_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/simpolicies_client_example_test.go index 60fba8160667..9ee4775a54ca 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/simpolicies_client_example_test.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/simpolicies_client_example_test.go @@ -14,7 +14,7 @@ import ( "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/mobilenetwork/armmobilenetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimPolicyDelete.json diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sims_client.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sims_client.go index c399de53b36b..e4f594053418 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sims_client.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sims_client.go @@ -55,6 +55,202 @@ func NewSimsClient(subscriptionID string, credential azcore.TokenCredential, opt return client, nil } +// BeginBulkDelete - Bulk delete SIMs from a SIM group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// simGroupName - The name of the SIM Group. +// parameters - Parameters supplied to the bulk SIM delete operation. +// options - SimsClientBeginBulkDeleteOptions contains the optional parameters for the SimsClient.BeginBulkDelete method. +func (client *SimsClient) BeginBulkDelete(ctx context.Context, resourceGroupName string, simGroupName string, parameters SimDeleteList, options *SimsClientBeginBulkDeleteOptions) (*runtime.Poller[SimsClientBulkDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.bulkDelete(ctx, resourceGroupName, simGroupName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SimsClientBulkDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SimsClientBulkDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// BulkDelete - Bulk delete SIMs from a SIM group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01 +func (client *SimsClient) bulkDelete(ctx context.Context, resourceGroupName string, simGroupName string, parameters SimDeleteList, options *SimsClientBeginBulkDeleteOptions) (*http.Response, error) { + req, err := client.bulkDeleteCreateRequest(ctx, resourceGroupName, simGroupName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// bulkDeleteCreateRequest creates the BulkDelete request. +func (client *SimsClient) bulkDeleteCreateRequest(ctx context.Context, resourceGroupName string, simGroupName string, parameters SimDeleteList, options *SimsClientBeginBulkDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if simGroupName == "" { + return nil, errors.New("parameter simGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{simGroupName}", url.PathEscape(simGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginBulkUpload - Bulk upload SIMs to a SIM group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// simGroupName - The name of the SIM Group. +// parameters - Parameters supplied to the bulk SIM upload operation. +// options - SimsClientBeginBulkUploadOptions contains the optional parameters for the SimsClient.BeginBulkUpload method. +func (client *SimsClient) BeginBulkUpload(ctx context.Context, resourceGroupName string, simGroupName string, parameters SimUploadList, options *SimsClientBeginBulkUploadOptions) (*runtime.Poller[SimsClientBulkUploadResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.bulkUpload(ctx, resourceGroupName, simGroupName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SimsClientBulkUploadResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SimsClientBulkUploadResponse](options.ResumeToken, client.pl, nil) + } +} + +// BulkUpload - Bulk upload SIMs to a SIM group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01 +func (client *SimsClient) bulkUpload(ctx context.Context, resourceGroupName string, simGroupName string, parameters SimUploadList, options *SimsClientBeginBulkUploadOptions) (*http.Response, error) { + req, err := client.bulkUploadCreateRequest(ctx, resourceGroupName, simGroupName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// bulkUploadCreateRequest creates the BulkUpload request. +func (client *SimsClient) bulkUploadCreateRequest(ctx context.Context, resourceGroupName string, simGroupName string, parameters SimUploadList, options *SimsClientBeginBulkUploadOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if simGroupName == "" { + return nil, errors.New("parameter simGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{simGroupName}", url.PathEscape(simGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginBulkUploadEncrypted - Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// simGroupName - The name of the SIM Group. +// parameters - Parameters supplied to the encrypted SIMs upload operation. +// options - SimsClientBeginBulkUploadEncryptedOptions contains the optional parameters for the SimsClient.BeginBulkUploadEncrypted +// method. +func (client *SimsClient) BeginBulkUploadEncrypted(ctx context.Context, resourceGroupName string, simGroupName string, parameters EncryptedSimUploadList, options *SimsClientBeginBulkUploadEncryptedOptions) (*runtime.Poller[SimsClientBulkUploadEncryptedResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.bulkUploadEncrypted(ctx, resourceGroupName, simGroupName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SimsClientBulkUploadEncryptedResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SimsClientBulkUploadEncryptedResponse](options.ResumeToken, client.pl, nil) + } +} + +// BulkUploadEncrypted - Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-01 +func (client *SimsClient) bulkUploadEncrypted(ctx context.Context, resourceGroupName string, simGroupName string, parameters EncryptedSimUploadList, options *SimsClientBeginBulkUploadEncryptedOptions) (*http.Response, error) { + req, err := client.bulkUploadEncryptedCreateRequest(ctx, resourceGroupName, simGroupName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// bulkUploadEncryptedCreateRequest creates the BulkUploadEncrypted request. +func (client *SimsClient) bulkUploadEncryptedCreateRequest(ctx context.Context, resourceGroupName string, simGroupName string, parameters EncryptedSimUploadList, options *SimsClientBeginBulkUploadEncryptedOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if simGroupName == "" { + return nil, errors.New("parameter simGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{simGroupName}", url.PathEscape(simGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + // BeginCreateOrUpdate - Creates or updates a SIM. // If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-11-01 diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sims_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sims_client_example_test.go index 60cac00efdac..c867b165d333 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sims_client_example_test.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sims_client_example_test.go @@ -14,7 +14,7 @@ import ( "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/mobilenetwork/armmobilenetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimDelete.json @@ -126,3 +126,183 @@ func ExampleSimsClient_NewListByGroupPager() { } } } + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimBulkUpload.json +func ExampleSimsClient_BeginBulkUpload() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmobilenetwork.NewSimsClient("subid", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginBulkUpload(ctx, "rg1", "testSimGroup", armmobilenetwork.SimUploadList{ + Sims: []*armmobilenetwork.SimNameAndProperties{ + { + Name: to.Ptr("testSim"), + Properties: &armmobilenetwork.SimPropertiesFormat{ + DeviceType: to.Ptr("Video camera"), + IntegratedCircuitCardIdentifier: to.Ptr("8900000000000000000"), + InternationalMobileSubscriberIdentity: to.Ptr("00000"), + SimPolicy: &armmobilenetwork.SimPolicyResourceID{ + ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy"), + }, + StaticIPConfiguration: []*armmobilenetwork.SimStaticIPProperties{ + { + AttachedDataNetwork: &armmobilenetwork.AttachedDataNetworkResourceID{ + ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork"), + }, + Slice: &armmobilenetwork.SliceResourceID{ + ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice"), + }, + StaticIP: &armmobilenetwork.SimStaticIPPropertiesStaticIP{ + IPv4Address: to.Ptr("2.4.0.1"), + }, + }}, + AuthenticationKey: to.Ptr("00000000000000000000000000000000"), + OperatorKeyCode: to.Ptr("00000000000000000000000000000000"), + }, + }, + { + Name: to.Ptr("testSim2"), + Properties: &armmobilenetwork.SimPropertiesFormat{ + DeviceType: to.Ptr("Video camera"), + IntegratedCircuitCardIdentifier: to.Ptr("8900000000000000001"), + InternationalMobileSubscriberIdentity: to.Ptr("00000"), + SimPolicy: &armmobilenetwork.SimPolicyResourceID{ + ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy"), + }, + StaticIPConfiguration: []*armmobilenetwork.SimStaticIPProperties{ + { + AttachedDataNetwork: &armmobilenetwork.AttachedDataNetworkResourceID{ + ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork"), + }, + Slice: &armmobilenetwork.SliceResourceID{ + ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice"), + }, + StaticIP: &armmobilenetwork.SimStaticIPPropertiesStaticIP{ + IPv4Address: to.Ptr("2.4.0.2"), + }, + }}, + AuthenticationKey: to.Ptr("00000000000000000000000000000000"), + OperatorKeyCode: to.Ptr("00000000000000000000000000000000"), + }, + }}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimBulkDelete.json +func ExampleSimsClient_BeginBulkDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmobilenetwork.NewSimsClient("subid", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginBulkDelete(ctx, "testResourceGroupName", "testSimGroup", armmobilenetwork.SimDeleteList{ + Sims: []*string{ + to.Ptr("testSim"), + to.Ptr("testSim2")}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimBulkUploadEncrypted.json +func ExampleSimsClient_BeginBulkUploadEncrypted() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmobilenetwork.NewSimsClient("subid", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginBulkUploadEncrypted(ctx, "rg1", "testSimGroup", armmobilenetwork.EncryptedSimUploadList{ + AzureKeyIdentifier: to.Ptr[int32](1), + EncryptedTransportKey: to.Ptr("ABC123"), + SignedTransportKey: to.Ptr("ABC123"), + Sims: []*armmobilenetwork.SimNameAndEncryptedProperties{ + { + Name: to.Ptr("testSim"), + Properties: &armmobilenetwork.EncryptedSimPropertiesFormat{ + DeviceType: to.Ptr("Video camera"), + IntegratedCircuitCardIdentifier: to.Ptr("8900000000000000000"), + InternationalMobileSubscriberIdentity: to.Ptr("00000"), + SimPolicy: &armmobilenetwork.SimPolicyResourceID{ + ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy"), + }, + StaticIPConfiguration: []*armmobilenetwork.SimStaticIPProperties{ + { + AttachedDataNetwork: &armmobilenetwork.AttachedDataNetworkResourceID{ + ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork"), + }, + Slice: &armmobilenetwork.SliceResourceID{ + ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice"), + }, + StaticIP: &armmobilenetwork.SimStaticIPPropertiesStaticIP{ + IPv4Address: to.Ptr("2.4.0.1"), + }, + }}, + EncryptedCredentials: to.Ptr("ABC123"), + }, + }, + { + Name: to.Ptr("testSim2"), + Properties: &armmobilenetwork.EncryptedSimPropertiesFormat{ + DeviceType: to.Ptr("Video camera"), + IntegratedCircuitCardIdentifier: to.Ptr("8900000000000000001"), + InternationalMobileSubscriberIdentity: to.Ptr("00000"), + SimPolicy: &armmobilenetwork.SimPolicyResourceID{ + ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy"), + }, + StaticIPConfiguration: []*armmobilenetwork.SimStaticIPProperties{ + { + AttachedDataNetwork: &armmobilenetwork.AttachedDataNetworkResourceID{ + ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork"), + }, + Slice: &armmobilenetwork.SliceResourceID{ + ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice"), + }, + StaticIP: &armmobilenetwork.SimStaticIPPropertiesStaticIP{ + IPv4Address: to.Ptr("2.4.0.2"), + }, + }}, + EncryptedCredentials: to.Ptr("ABC123"), + }, + }}, + VendorKeyFingerprint: to.Ptr("ABC123"), + Version: to.Ptr[int32](1), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sites_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sites_client_example_test.go index 1c42f95d6604..3c263aa162e4 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sites_client_example_test.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/sites_client_example_test.go @@ -14,7 +14,7 @@ import ( "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/mobilenetwork/armmobilenetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SiteDelete.json diff --git a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/slices_client_example_test.go b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/slices_client_example_test.go index 85f1e320e93b..de61f9c9ad94 100644 --- a/sdk/resourcemanager/mobilenetwork/armmobilenetwork/slices_client_example_test.go +++ b/sdk/resourcemanager/mobilenetwork/armmobilenetwork/slices_client_example_test.go @@ -14,7 +14,7 @@ import ( "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/mobilenetwork/armmobilenetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SliceDelete.json