From 885ab697208eca85ab05a80da74813a60a500813 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 8 Aug 2023 01:37:47 +0000 Subject: [PATCH] CodeGen from PR 24950 in Azure/azure-rest-api-specs New AO5GC 1.0 service - 2023-05-15-preview (#24950) * New AO5GC 1.0 service - 2023-05-15-preview * Addressed the Swagger LintDiff errors * Addressed the Swagger ModelValidation errors * Addressed long running operation LintDiff errors * Formatted the *.tsp files * Removed the common.json and added the parameters to the networkfunction.json * Updated the Type Script to address the Swagger API validations * Addressed the validation errors * Updated the examples and formatted the *.tsp files * Update specification/mpcnetworkfunction/resource-manager/readme.typescript.md Co-authored-by: Qiaoqiao Zhang <55688292+qiaozha@users.noreply.github.com> * Update specification/mpcnetworkfunction/mpcnetworkfunction.Management/tspconfig.yaml Co-authored-by: Mike Harder * Updated the common types version to v3 * Updated the networkfunction TypeSpec file to the latest version and generated the Swagger API --------- Co-authored-by: Qiaoqiao Zhang <55688292+qiaozha@users.noreply.github.com> Co-authored-by: Mike Harder --- .../armmobilepacketcore/CHANGELOG.md | 7 + .../armmobilepacketcore/LICENSE.txt | 21 + .../armmobilepacketcore/README.md | 85 ++++ .../armmobilepacketcore/autorest.md | 13 + .../armmobilepacketcore/build.go | 7 + .../armmobilepacketcore/ci.yml | 28 ++ .../armmobilepacketcore/client_factory.go | 48 ++ .../armmobilepacketcore/constants.go | 223 ++++++++++ .../armmobilepacketcore/go.mod | 13 + .../armmobilepacketcore/go.sum | 15 + .../armmobilepacketcore/models.go | 151 +++++++ .../armmobilepacketcore/models_serde.go | 364 +++++++++++++++ .../networkfunctions_client.go | 418 ++++++++++++++++++ .../armmobilepacketcore/operations_client.go | 93 ++++ .../armmobilepacketcore/options.go | 48 ++ .../armmobilepacketcore/response_types.go | 50 +++ .../armmobilepacketcore/time_rfc3339.go | 86 ++++ 17 files changed, 1670 insertions(+) create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/CHANGELOG.md create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/LICENSE.txt create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/README.md create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/autorest.md create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/build.go create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/ci.yml create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/client_factory.go create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/constants.go create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.mod create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.sum create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models.go create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models_serde.go create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/networkfunctions_client.go create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/operations_client.go create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/options.go create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/response_types.go create mode 100644 sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/time_rfc3339.go diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/CHANGELOG.md b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/CHANGELOG.md new file mode 100644 index 000000000000..7b3c1a90e464 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 0.1.0 (2023-08-08) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/LICENSE.txt b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/README.md b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/README.md new file mode 100644 index 000000000000..b2e88efa9708 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/README.md @@ -0,0 +1,85 @@ +# Azure Mobilepacketcore Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore) + +The `armmobilepacketcore` module provides operations for working with Azure Mobilepacketcore. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Mobilepacketcore module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Mobilepacketcore. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Mobilepacketcore module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armmobilepacketcore.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armmobilepacketcore.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewNetworkFunctionsClient() +``` + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Mobilepacketcore` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/autorest.md b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/autorest.md new file mode 100644 index 000000000000..884eaaba80bc --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/mpcnetworkfunction/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/mpcnetworkfunction/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/build.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/build.go new file mode 100644 index 000000000000..1d417de88e44 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/mobilepacketcore/armmobilepacketcore + +package armmobilepacketcore diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/ci.yml b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/ci.yml new file mode 100644 index 000000000000..6faa61726a95 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/mobilepacketcore/armmobilepacketcore' diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/client_factory.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/client_factory.go new file mode 100644 index 000000000000..c2e205739271 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/client_factory.go @@ -0,0 +1,48 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmobilepacketcore + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewNetworkFunctionsClient() *NetworkFunctionsClient { + subClient, _ := NewNetworkFunctionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/constants.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/constants.go new file mode 100644 index 000000000000..0c498e9c6ae8 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/constants.go @@ -0,0 +1,223 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmobilepacketcore + +const ( + moduleName = "armmobilepacketcore" + moduleVersion = "v0.1.0" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// NetworkFunctionAdministrativeState - Network Function Administrative State enumerations +type NetworkFunctionAdministrativeState string + +const ( + // NetworkFunctionAdministrativeStateCommissioned - Resource has been commissioned + NetworkFunctionAdministrativeStateCommissioned NetworkFunctionAdministrativeState = "Commissioned" + // NetworkFunctionAdministrativeStateDecommissioned - Resource has been decommissioned + NetworkFunctionAdministrativeStateDecommissioned NetworkFunctionAdministrativeState = "Decommissioned" +) + +// PossibleNetworkFunctionAdministrativeStateValues returns the possible values for the NetworkFunctionAdministrativeState const type. +func PossibleNetworkFunctionAdministrativeStateValues() []NetworkFunctionAdministrativeState { + return []NetworkFunctionAdministrativeState{ + NetworkFunctionAdministrativeStateCommissioned, + NetworkFunctionAdministrativeStateDecommissioned, + } +} + +// NetworkFunctionOperationalStatus - Network Function Operational Status enumerations +type NetworkFunctionOperationalStatus string + +const ( + // NetworkFunctionOperationalStatusActive - Resource is fully deployed and operational + NetworkFunctionOperationalStatusActive NetworkFunctionOperationalStatus = "Active" + // NetworkFunctionOperationalStatusInactive - Resource is inactive + NetworkFunctionOperationalStatusInactive NetworkFunctionOperationalStatus = "Inactive" + // NetworkFunctionOperationalStatusInstantiatedNotProvisioned - Resource has been deployed, awaiting provisioning + NetworkFunctionOperationalStatusInstantiatedNotProvisioned NetworkFunctionOperationalStatus = "InstantiatedNotProvisioned" + // NetworkFunctionOperationalStatusInstantiatedProvisioned - Resource has been deployed and provisioned, awaiting testing + NetworkFunctionOperationalStatusInstantiatedProvisioned NetworkFunctionOperationalStatus = "InstantiatedProvisioned" +) + +// PossibleNetworkFunctionOperationalStatusValues returns the possible values for the NetworkFunctionOperationalStatus const type. +func PossibleNetworkFunctionOperationalStatusValues() []NetworkFunctionOperationalStatus { + return []NetworkFunctionOperationalStatus{ + NetworkFunctionOperationalStatusActive, + NetworkFunctionOperationalStatusInactive, + NetworkFunctionOperationalStatusInstantiatedNotProvisioned, + NetworkFunctionOperationalStatusInstantiatedProvisioned, + } +} + +// NetworkFunctionType - Type of Network Function +type NetworkFunctionType string + +const ( + // NetworkFunctionTypeAMF - Access and Mobility Function + NetworkFunctionTypeAMF NetworkFunctionType = "AMF" + // NetworkFunctionTypeEMS - Element Management System + NetworkFunctionTypeEMS NetworkFunctionType = "EMS" + // NetworkFunctionTypeEPDG - Evolved Packet Data Gateway + NetworkFunctionTypeEPDG NetworkFunctionType = "ePDG" + // NetworkFunctionTypeMME - Mobility Management Entity + NetworkFunctionTypeMME NetworkFunctionType = "MME" + // NetworkFunctionTypeN3IWF - Non-3GPP Interworking Function + NetworkFunctionTypeN3IWF NetworkFunctionType = "N3IWF" + // NetworkFunctionTypeNRF - Network Repository Function + NetworkFunctionTypeNRF NetworkFunctionType = "NRF" + // NetworkFunctionTypeNSSF - Network Slice Selection Function + NetworkFunctionTypeNSSF NetworkFunctionType = "NSSF" + // NetworkFunctionTypeOperationsPolicyManager - Operations and Policy Manager + NetworkFunctionTypeOperationsPolicyManager NetworkFunctionType = "OperationsPolicyManager" + // NetworkFunctionTypeRemotePaaS - Remote Platform As A Service Components + NetworkFunctionTypeRemotePaaS NetworkFunctionType = "RemotePaaS" + // NetworkFunctionTypeSMF - Session Management Function + NetworkFunctionTypeSMF NetworkFunctionType = "SMF" + // NetworkFunctionTypeSaegw - System Architecture Evolution Gateway. This combines the Serving Gateway (SGW) and the Packet + // Data Network Gateway (PGW) functionality + NetworkFunctionTypeSaegw NetworkFunctionType = "Saegw" + // NetworkFunctionTypeSaegwControlPlane - System Architecture Evolution Gateway Control Plane, control and user plane separation + // (CUPS) architecture + NetworkFunctionTypeSaegwControlPlane NetworkFunctionType = "SaegwControlPlane" + // NetworkFunctionTypeSaegwUserPlane - System Architecture Evolution Gateway User Plane, control and user plane separation + // (CUPS) architecture + NetworkFunctionTypeSaegwUserPlane NetworkFunctionType = "SaegwUserPlane" + // NetworkFunctionTypeUPF - User Plane Function + NetworkFunctionTypeUPF NetworkFunctionType = "UPF" +) + +// PossibleNetworkFunctionTypeValues returns the possible values for the NetworkFunctionType const type. +func PossibleNetworkFunctionTypeValues() []NetworkFunctionType { + return []NetworkFunctionType{ + NetworkFunctionTypeAMF, + NetworkFunctionTypeEMS, + NetworkFunctionTypeEPDG, + NetworkFunctionTypeMME, + NetworkFunctionTypeN3IWF, + NetworkFunctionTypeNRF, + NetworkFunctionTypeNSSF, + NetworkFunctionTypeOperationsPolicyManager, + NetworkFunctionTypeRemotePaaS, + NetworkFunctionTypeSMF, + NetworkFunctionTypeSaegw, + NetworkFunctionTypeSaegwControlPlane, + NetworkFunctionTypeSaegwUserPlane, + NetworkFunctionTypeUPF, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProvisioningState - Provisioning state of the resource +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - Resource has been accepted + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - Resource is getting deleted + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - Resource is getting provisioned + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - Resource is updating + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// SKUDefinitions - SKU Definitions +type SKUDefinitions string + +const ( + // SKUDefinitionsAzureLab - Azure Lab SKU + SKUDefinitionsAzureLab SKUDefinitions = "AzureLab" + // SKUDefinitionsAzureProduction - Azure Production SKU + SKUDefinitionsAzureProduction SKUDefinitions = "AzureProduction" + // SKUDefinitionsNexusLab - Nexus Lab SKU + SKUDefinitionsNexusLab SKUDefinitions = "NexusLab" + // SKUDefinitionsNexusProduction - Nexus Production SKU + SKUDefinitionsNexusProduction SKUDefinitions = "NexusProduction" +) + +// PossibleSKUDefinitionsValues returns the possible values for the SKUDefinitions const type. +func PossibleSKUDefinitionsValues() []SKUDefinitions { + return []SKUDefinitions{ + SKUDefinitionsAzureLab, + SKUDefinitionsAzureProduction, + SKUDefinitionsNexusLab, + SKUDefinitionsNexusProduction, + } +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.mod b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.mod new file mode 100644 index 000000000000..9582a153d72c --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.mod @@ -0,0 +1,13 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect +) diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.sum b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.sum new file mode 100644 index 000000000000..5c6bee428364 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.sum @@ -0,0 +1,15 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models.go new file mode 100644 index 000000000000..fd4d132c2458 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models.go @@ -0,0 +1,151 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmobilepacketcore + +import "time" + +// NetworkFunctionResource - AO5GC Network Function Resource +type NetworkFunctionResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *NetworkFunctionResourceProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// NetworkFunctionResourceListResult - The response of a NetworkFunctionResource list operation. +type NetworkFunctionResourceListResult struct { + // REQUIRED; The NetworkFunctionResource items on this page + Value []*NetworkFunctionResource + + // The link to the next page of items + NextLink *string +} + +// NetworkFunctionResourceProperties - Network Function Properties. +type NetworkFunctionResourceProperties struct { + // REQUIRED; Administrative state of the network function + NetworkFunctionAdministrativeState *NetworkFunctionAdministrativeState + + // REQUIRED; Type of network function + NetworkFunctionType *NetworkFunctionType + + // REQUIRED; Provisioned SKU Value. + SKU *SKUDefinitions + + // Capacity of the network function in units of 10000. This represents the session count or the Simultaneously Attached Users + // (SAU) count as applicable + Capacity *int32 + + // User provided deployment notes. This is used to optionally provide details about the NF deployment + DeploymentNotes *string + + // User provided description + UserDescription *string + + // READ-ONLY; Count of infrastructure elements used by this network function (vCPUs, in units of 8) + InfrastructureElementCount *int32 + + // READ-ONLY; Operational state of the network function + NetworkFunctionOperationalStatus *NetworkFunctionOperationalStatus + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// NetworkFunctionResourceTagsUpdate - The type used for updating tags in NetworkFunctionResource resources. +type NetworkFunctionResourceTagsUpdate struct { + // Resource tags. + Tags map[string]*string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models_serde.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models_serde.go new file mode 100644 index 000000000000..6eacfa8c78bf --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models_serde.go @@ -0,0 +1,364 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmobilepacketcore + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionResource. +func (n NetworkFunctionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "tags", n.Tags) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkFunctionResource. +func (n *NetworkFunctionResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &n.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &n.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &n.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionResourceListResult. +func (n NetworkFunctionResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkFunctionResourceListResult. +func (n *NetworkFunctionResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionResourceProperties. +func (n NetworkFunctionResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", n.Capacity) + populate(objectMap, "deploymentNotes", n.DeploymentNotes) + populate(objectMap, "infrastructureElementCount", n.InfrastructureElementCount) + populate(objectMap, "networkFunctionAdministrativeState", n.NetworkFunctionAdministrativeState) + populate(objectMap, "networkFunctionOperationalStatus", n.NetworkFunctionOperationalStatus) + populate(objectMap, "networkFunctionType", n.NetworkFunctionType) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "sku", n.SKU) + populate(objectMap, "userDescription", n.UserDescription) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkFunctionResourceProperties. +func (n *NetworkFunctionResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &n.Capacity) + delete(rawMsg, key) + case "deploymentNotes": + err = unpopulate(val, "DeploymentNotes", &n.DeploymentNotes) + delete(rawMsg, key) + case "infrastructureElementCount": + err = unpopulate(val, "InfrastructureElementCount", &n.InfrastructureElementCount) + delete(rawMsg, key) + case "networkFunctionAdministrativeState": + err = unpopulate(val, "NetworkFunctionAdministrativeState", &n.NetworkFunctionAdministrativeState) + delete(rawMsg, key) + case "networkFunctionOperationalStatus": + err = unpopulate(val, "NetworkFunctionOperationalStatus", &n.NetworkFunctionOperationalStatus) + delete(rawMsg, key) + case "networkFunctionType": + err = unpopulate(val, "NetworkFunctionType", &n.NetworkFunctionType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &n.SKU) + delete(rawMsg, key) + case "userDescription": + err = unpopulate(val, "UserDescription", &n.UserDescription) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionResourceTagsUpdate. +func (n NetworkFunctionResourceTagsUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", n.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkFunctionResourceTagsUpdate. +func (n *NetworkFunctionResourceTagsUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &n.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/networkfunctions_client.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/networkfunctions_client.go new file mode 100644 index 000000000000..4e34340a9e5f --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/networkfunctions_client.go @@ -0,0 +1,418 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmobilepacketcore + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// NetworkFunctionsClient contains the methods for the NetworkFunctions group. +// Don't use this type directly, use NewNetworkFunctionsClient() instead. +type NetworkFunctionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewNetworkFunctionsClient creates a new instance of NetworkFunctionsClient 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 NewNetworkFunctionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NetworkFunctionsClient, error) { + cl, err := arm.NewClient(moduleName+".NetworkFunctionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &NetworkFunctionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a NetworkFunctionResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - networkFunctionName - The name of the network function +// - resource - Resource create parameters. +// - options - NetworkFunctionsClientBeginCreateOrUpdateOptions contains the optional parameters for the NetworkFunctionsClient.BeginCreateOrUpdate +// method. +func (client *NetworkFunctionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkFunctionName string, resource NetworkFunctionResource, options *NetworkFunctionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[NetworkFunctionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkFunctionName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NetworkFunctionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[NetworkFunctionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a NetworkFunctionResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-15-preview +func (client *NetworkFunctionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkFunctionName string, resource NetworkFunctionResource, options *NetworkFunctionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkFunctionName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *NetworkFunctionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkFunctionName string, resource NetworkFunctionResource, options *NetworkFunctionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions/{networkFunctionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkFunctionName == "" { + return nil, errors.New("parameter networkFunctionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkFunctionName}", url.PathEscape(networkFunctionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Delete a NetworkFunctionResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - networkFunctionName - The name of the network function +// - options - NetworkFunctionsClientDeleteOptions contains the optional parameters for the NetworkFunctionsClient.Delete method. +func (client *NetworkFunctionsClient) Delete(ctx context.Context, resourceGroupName string, networkFunctionName string, options *NetworkFunctionsClientDeleteOptions) (NetworkFunctionsClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkFunctionName, options) + if err != nil { + return NetworkFunctionsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkFunctionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return NetworkFunctionsClientDeleteResponse{}, err + } + return NetworkFunctionsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *NetworkFunctionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkFunctionName string, options *NetworkFunctionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions/{networkFunctionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkFunctionName == "" { + return nil, errors.New("parameter networkFunctionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkFunctionName}", url.PathEscape(networkFunctionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a NetworkFunctionResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - networkFunctionName - The name of the network function +// - options - NetworkFunctionsClientGetOptions contains the optional parameters for the NetworkFunctionsClient.Get method. +func (client *NetworkFunctionsClient) Get(ctx context.Context, resourceGroupName string, networkFunctionName string, options *NetworkFunctionsClientGetOptions) (NetworkFunctionsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkFunctionName, options) + if err != nil { + return NetworkFunctionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkFunctionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NetworkFunctionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *NetworkFunctionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkFunctionName string, options *NetworkFunctionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions/{networkFunctionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkFunctionName == "" { + return nil, errors.New("parameter networkFunctionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkFunctionName}", url.PathEscape(networkFunctionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NetworkFunctionsClient) getHandleResponse(resp *http.Response) (NetworkFunctionsClientGetResponse, error) { + result := NetworkFunctionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionResource); err != nil { + return NetworkFunctionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List NetworkFunctionResource resources by resource group +// +// Generated from API version 2023-05-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - NetworkFunctionsClientListByResourceGroupOptions contains the optional parameters for the NetworkFunctionsClient.NewListByResourceGroupPager +// method. +func (client *NetworkFunctionsClient) NewListByResourceGroupPager(resourceGroupName string, options *NetworkFunctionsClientListByResourceGroupOptions) *runtime.Pager[NetworkFunctionsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[NetworkFunctionsClientListByResourceGroupResponse]{ + More: func(page NetworkFunctionsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NetworkFunctionsClientListByResourceGroupResponse) (NetworkFunctionsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return NetworkFunctionsClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkFunctionsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetworkFunctionsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *NetworkFunctionsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *NetworkFunctionsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *NetworkFunctionsClient) listByResourceGroupHandleResponse(resp *http.Response) (NetworkFunctionsClientListByResourceGroupResponse, error) { + result := NetworkFunctionsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionResourceListResult); err != nil { + return NetworkFunctionsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List NetworkFunctionResource resources by subscription ID +// +// Generated from API version 2023-05-15-preview +// - options - NetworkFunctionsClientListBySubscriptionOptions contains the optional parameters for the NetworkFunctionsClient.NewListBySubscriptionPager +// method. +func (client *NetworkFunctionsClient) NewListBySubscriptionPager(options *NetworkFunctionsClientListBySubscriptionOptions) *runtime.Pager[NetworkFunctionsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[NetworkFunctionsClientListBySubscriptionResponse]{ + More: func(page NetworkFunctionsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NetworkFunctionsClientListBySubscriptionResponse) (NetworkFunctionsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return NetworkFunctionsClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkFunctionsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetworkFunctionsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *NetworkFunctionsClient) listBySubscriptionCreateRequest(ctx context.Context, options *NetworkFunctionsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.MobilePacketCore/networkFunctions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *NetworkFunctionsClient) listBySubscriptionHandleResponse(resp *http.Response) (NetworkFunctionsClientListBySubscriptionResponse, error) { + result := NetworkFunctionsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionResourceListResult); err != nil { + return NetworkFunctionsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// UpdateTags - Update a NetworkFunctionResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - networkFunctionName - The name of the network function +// - properties - The resource properties to be updated. +// - options - NetworkFunctionsClientUpdateTagsOptions contains the optional parameters for the NetworkFunctionsClient.UpdateTags +// method. +func (client *NetworkFunctionsClient) UpdateTags(ctx context.Context, resourceGroupName string, networkFunctionName string, properties NetworkFunctionResourceTagsUpdate, options *NetworkFunctionsClientUpdateTagsOptions) (NetworkFunctionsClientUpdateTagsResponse, error) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkFunctionName, properties, options) + if err != nil { + return NetworkFunctionsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkFunctionsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NetworkFunctionsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *NetworkFunctionsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, networkFunctionName string, properties NetworkFunctionResourceTagsUpdate, options *NetworkFunctionsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions/{networkFunctionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkFunctionName == "" { + return nil, errors.New("parameter networkFunctionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkFunctionName}", url.PathEscape(networkFunctionName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *NetworkFunctionsClient) updateTagsHandleResponse(resp *http.Response) (NetworkFunctionsClientUpdateTagsResponse, error) { + result := NetworkFunctionsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionResource); err != nil { + return NetworkFunctionsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/operations_client.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/operations_client.go new file mode 100644 index 000000000000..ee4c6d0e7e20 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/operations_client.go @@ -0,0 +1,93 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmobilepacketcore + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2023-05-15-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.MobilePacketCore/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/options.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/options.go new file mode 100644 index 000000000000..0853001a1b64 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/options.go @@ -0,0 +1,48 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmobilepacketcore + +// NetworkFunctionsClientBeginCreateOrUpdateOptions contains the optional parameters for the NetworkFunctionsClient.BeginCreateOrUpdate +// method. +type NetworkFunctionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NetworkFunctionsClientDeleteOptions contains the optional parameters for the NetworkFunctionsClient.Delete method. +type NetworkFunctionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsClientGetOptions contains the optional parameters for the NetworkFunctionsClient.Get method. +type NetworkFunctionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsClientListByResourceGroupOptions contains the optional parameters for the NetworkFunctionsClient.NewListByResourceGroupPager +// method. +type NetworkFunctionsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsClientListBySubscriptionOptions contains the optional parameters for the NetworkFunctionsClient.NewListBySubscriptionPager +// method. +type NetworkFunctionsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsClientUpdateTagsOptions contains the optional parameters for the NetworkFunctionsClient.UpdateTags method. +type NetworkFunctionsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/response_types.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/response_types.go new file mode 100644 index 000000000000..e6a83bcf1376 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/response_types.go @@ -0,0 +1,50 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmobilepacketcore + +// NetworkFunctionsClientCreateOrUpdateResponse contains the response from method NetworkFunctionsClient.BeginCreateOrUpdate. +type NetworkFunctionsClientCreateOrUpdateResponse struct { + // AO5GC Network Function Resource + NetworkFunctionResource +} + +// NetworkFunctionsClientDeleteResponse contains the response from method NetworkFunctionsClient.Delete. +type NetworkFunctionsClientDeleteResponse struct { + // placeholder for future response values +} + +// NetworkFunctionsClientGetResponse contains the response from method NetworkFunctionsClient.Get. +type NetworkFunctionsClientGetResponse struct { + // AO5GC Network Function Resource + NetworkFunctionResource +} + +// NetworkFunctionsClientListByResourceGroupResponse contains the response from method NetworkFunctionsClient.NewListByResourceGroupPager. +type NetworkFunctionsClientListByResourceGroupResponse struct { + // The response of a NetworkFunctionResource list operation. + NetworkFunctionResourceListResult +} + +// NetworkFunctionsClientListBySubscriptionResponse contains the response from method NetworkFunctionsClient.NewListBySubscriptionPager. +type NetworkFunctionsClientListBySubscriptionResponse struct { + // The response of a NetworkFunctionResource list operation. + NetworkFunctionResourceListResult +} + +// NetworkFunctionsClientUpdateTagsResponse contains the response from method NetworkFunctionsClient.UpdateTags. +type NetworkFunctionsClientUpdateTagsResponse struct { + // AO5GC Network Function Resource + NetworkFunctionResource +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/time_rfc3339.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/time_rfc3339.go new file mode 100644 index 000000000000..af1ac13c9b42 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/time_rfc3339.go @@ -0,0 +1,86 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmobilepacketcore + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +}