diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 0374d99aa7fa..a2335f8fb930 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -437,6 +437,7 @@ com.azure.resourcemanager:azure-resourcemanager-apicenter;1.0.0-beta.1;1.0.0-bet com.azure.resourcemanager:azure-resourcemanager-hybridconnectivity;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-playwrighttesting;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-recoveryservicesdatareplication;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-mpcnetworkfunction;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 diff --git a/pom.xml b/pom.xml index 48806d3b8a00..396761440a2b 100644 --- a/pom.xml +++ b/pom.xml @@ -129,6 +129,7 @@ sdk/mobilenetwork sdk/modelsrepository sdk/monitor + sdk/mpcnetworkfunction sdk/mysql sdk/mysqlflexibleserver sdk/netapp diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/CHANGELOG.md b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/CHANGELOG.md new file mode 100644 index 000000000000..09fcbc115a2b --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-11-24) + +- Azure Resource Manager mpcnetworkfunction client library for Java. This package contains Microsoft Azure SDK for mpcnetworkfunction Management SDK. Mobile Packet Core Network Function Management API. Package tag package-2023-05-15-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/README.md b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/README.md new file mode 100644 index 000000000000..070adfbb21a5 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/README.md @@ -0,0 +1,107 @@ +# Azure Resource Manager mpcnetworkfunction client library for Java + +Azure Resource Manager mpcnetworkfunction client library for Java. + +This package contains Microsoft Azure SDK for mpcnetworkfunction Management SDK. Mobile Packet Core Network Function Management API. Package tag package-2023-05-15-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-mpcnetworkfunction;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-mpcnetworkfunction + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +MpcnetworkfunctionManager manager = MpcnetworkfunctionManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +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 . + +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 repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fmpcnetworkfunction%2Fazure-resourcemanager-mpcnetworkfunction%2FREADME.png) diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/SAMPLE.md b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/SAMPLE.md new file mode 100644 index 000000000000..64c110d5ca18 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/SAMPLE.md @@ -0,0 +1,185 @@ +# Code snippets and samples + + +## NetworkFunctions + +- [CreateOrUpdate](#networkfunctions_createorupdate) +- [Delete](#networkfunctions_delete) +- [GetByResourceGroup](#networkfunctions_getbyresourcegroup) +- [List](#networkfunctions_list) +- [ListByResourceGroup](#networkfunctions_listbyresourcegroup) +- [UpdateTags](#networkfunctions_updatetags) + +## Operations + +- [List](#operations_list) +### NetworkFunctions_CreateOrUpdate + +```java +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionAdministrativeState; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResourceProperties; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionType; +import com.azure.resourcemanager.mpcnetworkfunction.models.SkuDefinitions; +import java.util.stream.Collectors; + +/** + * Samples for NetworkFunctions CreateOrUpdate. + */ +public final class NetworkFunctionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/NetworkFunctions_CreateOrUpdate.json + */ + /** + * Sample code: NetworkFunctions_CreateOrUpdate. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void networkFunctionsCreateOrUpdate(com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + manager.networkFunctions().define("nf1").withRegion("eastus").withExistingResourceGroup("rg1").withProperties(new NetworkFunctionResourceProperties().withSku(SkuDefinitions.NEXUS_PRODUCTION).withNetworkFunctionType(NetworkFunctionType.SMF).withNetworkFunctionAdministrativeState(NetworkFunctionAdministrativeState.COMMISSIONED).withCapacity(100000).withUserDescription("string").withDeploymentNotes("string")).create(); + } +} +``` + +### NetworkFunctions_Delete + +```java +/** + * Samples for NetworkFunctions Delete. + */ +public final class NetworkFunctionsDeleteSamples { + /* + * x-ms-original-file: specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/NetworkFunctions_Delete.json + */ + /** + * Sample code: NetworkFunctions_Delete. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void networkFunctionsDelete(com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + manager.networkFunctions().deleteByResourceGroupWithResponse("rg1", "nf1", com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkFunctions_GetByResourceGroup + +```java +/** + * Samples for NetworkFunctions GetByResourceGroup. + */ +public final class NetworkFunctionsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/NetworkFunctions_Get.json + */ + /** + * Sample code: NetworkFunctions_Get. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void networkFunctionsGet(com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + manager.networkFunctions().getByResourceGroupWithResponse("rg1", "nf1", com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkFunctions_List + +```java +/** + * Samples for NetworkFunctions List. + */ +public final class NetworkFunctionsListSamples { + /* + * x-ms-original-file: specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/NetworkFunctions_ListBySubscription.json + */ + /** + * Sample code: NetworkFunctions_ListBySubscription. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void networkFunctionsListBySubscription(com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + manager.networkFunctions().list(com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkFunctions_ListByResourceGroup + +```java +/** + * Samples for NetworkFunctions ListByResourceGroup. + */ +public final class NetworkFunctionsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/NetworkFunctions_ListByResourceGroup.json + */ + /** + * Sample code: NetworkFunctions_ListByResourceGroup. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void networkFunctionsListByResourceGroup(com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + manager.networkFunctions().listByResourceGroup("rg1", com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkFunctions_UpdateTags + +```java +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for NetworkFunctions UpdateTags. + */ +public final class NetworkFunctionsUpdateTagsSamples { + /* + * x-ms-original-file: specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/NetworkFunctions_UpdateTags.json + */ + /** + * Sample code: NetworkFunctions_UpdateTags. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void networkFunctionsUpdateTags(com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + NetworkFunctionResource resource = manager.networkFunctions().getByResourceGroupWithResponse("rg1", "nf1", com.azure.core.util.Context.NONE).getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/OperationList.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void operationsList(com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/pom.xml b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/pom.xml new file mode 100644 index 000000000000..eeac34768517 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-mpcnetworkfunction + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for mpcnetworkfunction Management + This package contains Microsoft Azure SDK for mpcnetworkfunction Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Mobile Packet Core Network Function Management API. Package tag package-2023-05-15-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.45.0 + + + com.azure + azure-core-management + 1.11.8 + + + diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/MpcnetworkfunctionManager.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/MpcnetworkfunctionManager.java new file mode 100644 index 000000000000..967a1ab53e47 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/MpcnetworkfunctionManager.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.MicrosoftMobilePacketCoreNetworkFunctionResource; +import com.azure.resourcemanager.mpcnetworkfunction.implementation.MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder; +import com.azure.resourcemanager.mpcnetworkfunction.implementation.NetworkFunctionsImpl; +import com.azure.resourcemanager.mpcnetworkfunction.implementation.OperationsImpl; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctions; +import com.azure.resourcemanager.mpcnetworkfunction.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to MpcnetworkfunctionManager. + * Mobile Packet Core Network Function Management API. + */ +public final class MpcnetworkfunctionManager { + private Operations operations; + + private NetworkFunctions networkFunctions; + + private final MicrosoftMobilePacketCoreNetworkFunctionResource clientObject; + + private MpcnetworkfunctionManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()).subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval).buildClient(); + } + + /** + * Creates an instance of mpcnetworkfunction service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the mpcnetworkfunction service API instance. + */ + public static MpcnetworkfunctionManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of mpcnetworkfunction service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the mpcnetworkfunction service API instance. + */ + public static MpcnetworkfunctionManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new MpcnetworkfunctionManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create MpcnetworkfunctionManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new MpcnetworkfunctionManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of mpcnetworkfunction service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the mpcnetworkfunction service API instance. + */ + public MpcnetworkfunctionManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java").append("-").append("com.azure.resourcemanager.mpcnetworkfunction") + .append("/").append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (").append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ").append(Configuration.getGlobalConfiguration().get("os.name")).append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")).append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY).collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])).build(); + return new MpcnetworkfunctionManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of NetworkFunctions. It manages NetworkFunctionResource. + * + * @return Resource collection API of NetworkFunctions. + */ + public NetworkFunctions networkFunctions() { + if (this.networkFunctions == null) { + this.networkFunctions = new NetworkFunctionsImpl(clientObject.getNetworkFunctions(), this); + } + return networkFunctions; + } + + /** + * Gets wrapped service client MicrosoftMobilePacketCoreNetworkFunctionResource providing direct access to the + * underlying auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client MicrosoftMobilePacketCoreNetworkFunctionResource. + */ + public MicrosoftMobilePacketCoreNetworkFunctionResource serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/MicrosoftMobilePacketCoreNetworkFunctionResource.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/MicrosoftMobilePacketCoreNetworkFunctionResource.java new file mode 100644 index 000000000000..79cefee0a144 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/MicrosoftMobilePacketCoreNetworkFunctionResource.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for MicrosoftMobilePacketCoreNetworkFunctionResource class. + */ +public interface MicrosoftMobilePacketCoreNetworkFunctionResource { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the NetworkFunctionsClient object to access its operations. + * + * @return the NetworkFunctionsClient object. + */ + NetworkFunctionsClient getNetworkFunctions(); +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/NetworkFunctionsClient.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/NetworkFunctionsClient.java new file mode 100644 index 000000000000..d369369719fa --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/NetworkFunctionsClient.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.models.NetworkFunctionResourceInner; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResourceTagsUpdate; + +/** + * An instance of this class provides access to all the operations defined in NetworkFunctionsClient. + */ +public interface NetworkFunctionsClient { + /** + * List NetworkFunctionResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List NetworkFunctionResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List NetworkFunctionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List NetworkFunctionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NetworkFunctionResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String networkFunctionName, Context context); + + /** + * Get a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NetworkFunctionResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkFunctionResourceInner getByResourceGroup(String resourceGroupName, String networkFunctionName); + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of aO5GC Network Function Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkFunctionResourceInner> beginCreateOrUpdate( + String resourceGroupName, String networkFunctionName, NetworkFunctionResourceInner resource); + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of aO5GC Network Function Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkFunctionResourceInner> beginCreateOrUpdate( + String resourceGroupName, String networkFunctionName, NetworkFunctionResourceInner resource, Context context); + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkFunctionResourceInner createOrUpdate(String resourceGroupName, String networkFunctionName, + NetworkFunctionResourceInner resource); + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkFunctionResourceInner createOrUpdate(String resourceGroupName, String networkFunctionName, + NetworkFunctionResourceInner resource, Context context); + + /** + * Update a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateTagsWithResponse(String resourceGroupName, String networkFunctionName, + NetworkFunctionResourceTagsUpdate properties, Context context); + + /** + * Update a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkFunctionResourceInner updateTags(String resourceGroupName, String networkFunctionName, + NetworkFunctionResourceTagsUpdate properties); + + /** + * Delete a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String networkFunctionName, Context context); + + /** + * Delete a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String networkFunctionName); +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/OperationsClient.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/OperationsClient.java new file mode 100644 index 000000000000..2741c490bafc --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/models/NetworkFunctionResourceInner.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/models/NetworkFunctionResourceInner.java new file mode 100644 index 000000000000..bf65b4ba0b18 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/models/NetworkFunctionResourceInner.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * AO5GC Network Function Resource. + */ +@Fluent +public final class NetworkFunctionResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private NetworkFunctionResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of NetworkFunctionResourceInner class. + */ + public NetworkFunctionResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public NetworkFunctionResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the NetworkFunctionResourceInner object itself. + */ + public NetworkFunctionResourceInner withProperties(NetworkFunctionResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * {@inheritDoc} + */ + @Override + public NetworkFunctionResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public NetworkFunctionResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/models/OperationInner.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/models/OperationInner.java new file mode 100644 index 000000000000..197d0dfa9797 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/models/OperationInner.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.mpcnetworkfunction.models.ActionType; +import com.azure.resourcemanager.mpcnetworkfunction.models.OperationDisplay; +import com.azure.resourcemanager.mpcnetworkfunction.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/models/package-info.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/models/package-info.java new file mode 100644 index 000000000000..c1bedd3543c8 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for MicrosoftMobilePacketCoreNetworkFunctionResource. + * Mobile Packet Core Network Function Management API. + */ +package com.azure.resourcemanager.mpcnetworkfunction.fluent.models; diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/package-info.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/package-info.java new file mode 100644 index 000000000000..fb1b0d32958d --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for MicrosoftMobilePacketCoreNetworkFunctionResource. + * Mobile Packet Core Network Function Management API. + */ +package com.azure.resourcemanager.mpcnetworkfunction.fluent; diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder.java new file mode 100644 index 000000000000..54991aed81c3 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the MicrosoftMobilePacketCoreNetworkFunctionResourceImpl type. + */ +@ServiceClientBuilder(serviceClients = { MicrosoftMobilePacketCoreNetworkFunctionResourceImpl.class }) +public final class MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder. + */ + public MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder. + */ + public MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder. + */ + public MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder. + */ + public MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder. + */ + public MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder. + */ + public MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder + serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MicrosoftMobilePacketCoreNetworkFunctionResourceImpl with the provided parameters. + * + * @return an instance of MicrosoftMobilePacketCoreNetworkFunctionResourceImpl. + */ + public MicrosoftMobilePacketCoreNetworkFunctionResourceImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + MicrosoftMobilePacketCoreNetworkFunctionResourceImpl client + = new MicrosoftMobilePacketCoreNetworkFunctionResourceImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/MicrosoftMobilePacketCoreNetworkFunctionResourceImpl.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/MicrosoftMobilePacketCoreNetworkFunctionResourceImpl.java new file mode 100644 index 000000000000..718e67fa0277 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/MicrosoftMobilePacketCoreNetworkFunctionResourceImpl.java @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.MicrosoftMobilePacketCoreNetworkFunctionResource; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.NetworkFunctionsClient; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.OperationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the MicrosoftMobilePacketCoreNetworkFunctionResourceImpl type. + */ +@ServiceClient(builder = MicrosoftMobilePacketCoreNetworkFunctionResourceBuilder.class) +public final class MicrosoftMobilePacketCoreNetworkFunctionResourceImpl + implements MicrosoftMobilePacketCoreNetworkFunctionResource { + /** + * The ID of the target subscription. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * server parameter. + */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Api Version. + */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The NetworkFunctionsClient object to access its operations. + */ + private final NetworkFunctionsClient networkFunctions; + + /** + * Gets the NetworkFunctionsClient object to access its operations. + * + * @return the NetworkFunctionsClient object. + */ + public NetworkFunctionsClient getNetworkFunctions() { + return this.networkFunctions; + } + + /** + * Initializes an instance of MicrosoftMobilePacketCoreNetworkFunctionResource client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + MicrosoftMobilePacketCoreNetworkFunctionResourceImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2023-05-15-preview"; + this.operations = new OperationsClientImpl(this); + this.networkFunctions = new NetworkFunctionsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter().deserialize(errorBody, ManagementError.class, + SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER + = new ClientLogger(MicrosoftMobilePacketCoreNetworkFunctionResourceImpl.class); +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/NetworkFunctionResourceImpl.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/NetworkFunctionResourceImpl.java new file mode 100644 index 000000000000..b3ad6425c706 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/NetworkFunctionResourceImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.models.NetworkFunctionResourceInner; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResource; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResourceProperties; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResourceTagsUpdate; +import java.util.Collections; +import java.util.Map; + +public final class NetworkFunctionResourceImpl + implements NetworkFunctionResource, NetworkFunctionResource.Definition, NetworkFunctionResource.Update { + private NetworkFunctionResourceInner innerObject; + + private final com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public NetworkFunctionResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public NetworkFunctionResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String networkFunctionName; + + private NetworkFunctionResourceTagsUpdate updateProperties; + + public NetworkFunctionResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public NetworkFunctionResource create() { + this.innerObject = serviceManager.serviceClient().getNetworkFunctions().createOrUpdate(resourceGroupName, + networkFunctionName, this.innerModel(), Context.NONE); + return this; + } + + public NetworkFunctionResource create(Context context) { + this.innerObject = serviceManager.serviceClient().getNetworkFunctions().createOrUpdate(resourceGroupName, + networkFunctionName, this.innerModel(), context); + return this; + } + + NetworkFunctionResourceImpl(String name, + com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager serviceManager) { + this.innerObject = new NetworkFunctionResourceInner(); + this.serviceManager = serviceManager; + this.networkFunctionName = name; + } + + public NetworkFunctionResourceImpl update() { + this.updateProperties = new NetworkFunctionResourceTagsUpdate(); + return this; + } + + public NetworkFunctionResource apply() { + this.innerObject = serviceManager.serviceClient().getNetworkFunctions() + .updateTagsWithResponse(resourceGroupName, networkFunctionName, updateProperties, Context.NONE).getValue(); + return this; + } + + public NetworkFunctionResource apply(Context context) { + this.innerObject = serviceManager.serviceClient().getNetworkFunctions() + .updateTagsWithResponse(resourceGroupName, networkFunctionName, updateProperties, context).getValue(); + return this; + } + + NetworkFunctionResourceImpl(NetworkFunctionResourceInner innerObject, + com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.networkFunctionName = Utils.getValueFromIdByName(innerObject.id(), "networkFunctions"); + } + + public NetworkFunctionResource refresh() { + this.innerObject = serviceManager.serviceClient().getNetworkFunctions() + .getByResourceGroupWithResponse(resourceGroupName, networkFunctionName, Context.NONE).getValue(); + return this; + } + + public NetworkFunctionResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient().getNetworkFunctions() + .getByResourceGroupWithResponse(resourceGroupName, networkFunctionName, context).getValue(); + return this; + } + + public NetworkFunctionResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public NetworkFunctionResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public NetworkFunctionResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public NetworkFunctionResourceImpl withProperties(NetworkFunctionResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/NetworkFunctionsClientImpl.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/NetworkFunctionsClientImpl.java new file mode 100644 index 000000000000..5c7d5a1dedbd --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/NetworkFunctionsClientImpl.java @@ -0,0 +1,1123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.NetworkFunctionsClient; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.models.NetworkFunctionResourceInner; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResourceListResult; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResourceTagsUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NetworkFunctionsClient. + */ +public final class NetworkFunctionsClientImpl implements NetworkFunctionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final NetworkFunctionsService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftMobilePacketCoreNetworkFunctionResourceImpl client; + + /** + * Initializes an instance of NetworkFunctionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NetworkFunctionsClientImpl(MicrosoftMobilePacketCoreNetworkFunctionResourceImpl client) { + this.service + = RestProxy.create(NetworkFunctionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftMobilePacketCoreNetworkFunctionResourceNetworkFunctions to + * be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftMobilePacke") + public interface NetworkFunctionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.MobilePacketCore/networkFunctions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions/{networkFunctionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkFunctionName") String networkFunctionName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions/{networkFunctionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkFunctionName") String networkFunctionName, + @BodyParam("application/json") NetworkFunctionResourceInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions/{networkFunctionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateTags(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkFunctionName") String networkFunctionName, + @BodyParam("application/json") NetworkFunctionResourceTagsUpdate properties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions/{networkFunctionName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkFunctionName") String networkFunctionName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List NetworkFunctionResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List NetworkFunctionResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List NetworkFunctionResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List NetworkFunctionResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List NetworkFunctionResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List NetworkFunctionResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List NetworkFunctionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List NetworkFunctionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List NetworkFunctionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List NetworkFunctionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, + Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List NetworkFunctionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List NetworkFunctionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NetworkFunctionResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String networkFunctionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkFunctionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkFunctionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkFunctionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NetworkFunctionResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String networkFunctionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkFunctionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkFunctionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkFunctionName, accept, context); + } + + /** + * Get a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NetworkFunctionResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String networkFunctionName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, networkFunctionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NetworkFunctionResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String networkFunctionName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, networkFunctionName, context).block(); + } + + /** + * Get a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NetworkFunctionResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkFunctionResourceInner getByResourceGroup(String resourceGroupName, String networkFunctionName) { + return getByResourceGroupWithResponse(resourceGroupName, networkFunctionName, Context.NONE).getValue(); + } + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String networkFunctionName, NetworkFunctionResourceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkFunctionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkFunctionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkFunctionName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String networkFunctionName, NetworkFunctionResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkFunctionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkFunctionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkFunctionName, resource, accept, context); + } + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of aO5GC Network Function Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NetworkFunctionResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String networkFunctionName, NetworkFunctionResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, networkFunctionName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), NetworkFunctionResourceInner.class, NetworkFunctionResourceInner.class, + this.client.getContext()); + } + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of aO5GC Network Function Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NetworkFunctionResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String networkFunctionName, NetworkFunctionResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, networkFunctionName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), NetworkFunctionResourceInner.class, NetworkFunctionResourceInner.class, + context); + } + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of aO5GC Network Function Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkFunctionResourceInner> beginCreateOrUpdate( + String resourceGroupName, String networkFunctionName, NetworkFunctionResourceInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, networkFunctionName, resource).getSyncPoller(); + } + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of aO5GC Network Function Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkFunctionResourceInner> beginCreateOrUpdate( + String resourceGroupName, String networkFunctionName, NetworkFunctionResourceInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, networkFunctionName, resource, context).getSyncPoller(); + } + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String networkFunctionName, + NetworkFunctionResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, networkFunctionName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String networkFunctionName, + NetworkFunctionResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, networkFunctionName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkFunctionResourceInner createOrUpdate(String resourceGroupName, String networkFunctionName, + NetworkFunctionResourceInner resource) { + return createOrUpdateAsync(resourceGroupName, networkFunctionName, resource).block(); + } + + /** + * Create a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkFunctionResourceInner createOrUpdate(String resourceGroupName, String networkFunctionName, + NetworkFunctionResourceInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, networkFunctionName, resource, context).block(); + } + + /** + * Update a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateTagsWithResponseAsync(String resourceGroupName, + String networkFunctionName, NetworkFunctionResourceTagsUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkFunctionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkFunctionName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.updateTags(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkFunctionName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateTagsWithResponseAsync(String resourceGroupName, + String networkFunctionName, NetworkFunctionResourceTagsUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkFunctionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkFunctionName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.updateTags(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkFunctionName, properties, accept, context); + } + + /** + * Update a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTagsAsync(String resourceGroupName, String networkFunctionName, + NetworkFunctionResourceTagsUpdate properties) { + return updateTagsWithResponseAsync(resourceGroupName, networkFunctionName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateTagsWithResponse(String resourceGroupName, + String networkFunctionName, NetworkFunctionResourceTagsUpdate properties, Context context) { + return updateTagsWithResponseAsync(resourceGroupName, networkFunctionName, properties, context).block(); + } + + /** + * Update a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aO5GC Network Function Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkFunctionResourceInner updateTags(String resourceGroupName, String networkFunctionName, + NetworkFunctionResourceTagsUpdate properties) { + return updateTagsWithResponse(resourceGroupName, networkFunctionName, properties, Context.NONE).getValue(); + } + + /** + * Delete a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String networkFunctionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkFunctionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkFunctionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkFunctionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String networkFunctionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkFunctionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkFunctionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, networkFunctionName, accept, context); + } + + /** + * Delete a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String networkFunctionName) { + return deleteWithResponseAsync(resourceGroupName, networkFunctionName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String networkFunctionName, Context context) { + return deleteWithResponseAsync(resourceGroupName, networkFunctionName, context).block(); + } + + /** + * Delete a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String networkFunctionName) { + deleteWithResponse(resourceGroupName, networkFunctionName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/NetworkFunctionsImpl.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/NetworkFunctionsImpl.java new file mode 100644 index 000000000000..f56d3407260f --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/NetworkFunctionsImpl.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.NetworkFunctionsClient; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.models.NetworkFunctionResourceInner; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResource; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctions; + +public final class NetworkFunctionsImpl implements NetworkFunctions { + private static final ClientLogger LOGGER = new ClientLogger(NetworkFunctionsImpl.class); + + private final NetworkFunctionsClient innerClient; + + private final com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager serviceManager; + + public NetworkFunctionsImpl(NetworkFunctionsClient innerClient, + com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new NetworkFunctionResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new NetworkFunctionResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new NetworkFunctionResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new NetworkFunctionResourceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String networkFunctionName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, networkFunctionName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new NetworkFunctionResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public NetworkFunctionResource getByResourceGroup(String resourceGroupName, String networkFunctionName) { + NetworkFunctionResourceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, networkFunctionName); + if (inner != null) { + return new NetworkFunctionResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String networkFunctionName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, networkFunctionName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String networkFunctionName) { + this.serviceClient().delete(resourceGroupName, networkFunctionName); + } + + public NetworkFunctionResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String networkFunctionName = Utils.getValueFromIdByName(id, "networkFunctions"); + if (networkFunctionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkFunctions'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, networkFunctionName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String networkFunctionName = Utils.getValueFromIdByName(id, "networkFunctions"); + if (networkFunctionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkFunctions'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, networkFunctionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String networkFunctionName = Utils.getValueFromIdByName(id, "networkFunctions"); + if (networkFunctionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkFunctions'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, networkFunctionName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String networkFunctionName = Utils.getValueFromIdByName(id, "networkFunctions"); + if (networkFunctionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkFunctions'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, networkFunctionName, context); + } + + private NetworkFunctionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager() { + return this.serviceManager; + } + + public NetworkFunctionResourceImpl define(String name) { + return new NetworkFunctionResourceImpl(name, this.manager()); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/OperationImpl.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/OperationImpl.java new file mode 100644 index 000000000000..d6618ab58c01 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.implementation; + +import com.azure.resourcemanager.mpcnetworkfunction.fluent.models.OperationInner; +import com.azure.resourcemanager.mpcnetworkfunction.models.ActionType; +import com.azure.resourcemanager.mpcnetworkfunction.models.Operation; +import com.azure.resourcemanager.mpcnetworkfunction.models.OperationDisplay; +import com.azure.resourcemanager.mpcnetworkfunction.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/OperationsClientImpl.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..67bfae920348 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/OperationsClientImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.OperationsClient; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.models.OperationInner; +import com.azure.resourcemanager.mpcnetworkfunction.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftMobilePacketCoreNetworkFunctionResourceImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MicrosoftMobilePacketCoreNetworkFunctionResourceImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftMobilePacketCoreNetworkFunctionResourceOperations to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftMobilePacke") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.MobilePacketCore/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/OperationsImpl.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/OperationsImpl.java new file mode 100644 index 000000000000..6f48920dd0c5 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.OperationsClient; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.models.OperationInner; +import com.azure.resourcemanager.mpcnetworkfunction.models.Operation; +import com.azure.resourcemanager.mpcnetworkfunction.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/Utils.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/Utils.java new file mode 100644 index 000000000000..bd5b917fc4cd --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/Utils.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + private Utils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/package-info.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/package-info.java new file mode 100644 index 000000000000..6e8aa311d8e5 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for MicrosoftMobilePacketCoreNetworkFunctionResource. + * Mobile Packet Core Network Function Management API. + */ +package com.azure.resourcemanager.mpcnetworkfunction.implementation; diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/ActionType.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/ActionType.java new file mode 100644 index 000000000000..deb4fa536c94 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/ActionType.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionAdministrativeState.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionAdministrativeState.java new file mode 100644 index 000000000000..b662c9f42040 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionAdministrativeState.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Network Function Administrative State enumerations. + */ +public final class NetworkFunctionAdministrativeState extends ExpandableStringEnum { + /** + * Static value Commissioned for NetworkFunctionAdministrativeState. + */ + public static final NetworkFunctionAdministrativeState COMMISSIONED = fromString("Commissioned"); + + /** + * Static value Decommissioned for NetworkFunctionAdministrativeState. + */ + public static final NetworkFunctionAdministrativeState DECOMMISSIONED = fromString("Decommissioned"); + + /** + * Creates a new instance of NetworkFunctionAdministrativeState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NetworkFunctionAdministrativeState() { + } + + /** + * Creates or finds a NetworkFunctionAdministrativeState from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkFunctionAdministrativeState. + */ + @JsonCreator + public static NetworkFunctionAdministrativeState fromString(String name) { + return fromString(name, NetworkFunctionAdministrativeState.class); + } + + /** + * Gets known NetworkFunctionAdministrativeState values. + * + * @return known NetworkFunctionAdministrativeState values. + */ + public static Collection values() { + return values(NetworkFunctionAdministrativeState.class); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionOperationalStatus.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionOperationalStatus.java new file mode 100644 index 000000000000..eae2eec58596 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionOperationalStatus.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Network Function Operational Status enumerations. + */ +public final class NetworkFunctionOperationalStatus extends ExpandableStringEnum { + /** + * Static value Inactive for NetworkFunctionOperationalStatus. + */ + public static final NetworkFunctionOperationalStatus INACTIVE = fromString("Inactive"); + + /** + * Static value InstantiatedNotProvisioned for NetworkFunctionOperationalStatus. + */ + public static final NetworkFunctionOperationalStatus INSTANTIATED_NOT_PROVISIONED + = fromString("InstantiatedNotProvisioned"); + + /** + * Static value InstantiatedProvisioned for NetworkFunctionOperationalStatus. + */ + public static final NetworkFunctionOperationalStatus INSTANTIATED_PROVISIONED + = fromString("InstantiatedProvisioned"); + + /** + * Static value Active for NetworkFunctionOperationalStatus. + */ + public static final NetworkFunctionOperationalStatus ACTIVE = fromString("Active"); + + /** + * Creates a new instance of NetworkFunctionOperationalStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NetworkFunctionOperationalStatus() { + } + + /** + * Creates or finds a NetworkFunctionOperationalStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkFunctionOperationalStatus. + */ + @JsonCreator + public static NetworkFunctionOperationalStatus fromString(String name) { + return fromString(name, NetworkFunctionOperationalStatus.class); + } + + /** + * Gets known NetworkFunctionOperationalStatus values. + * + * @return known NetworkFunctionOperationalStatus values. + */ + public static Collection values() { + return values(NetworkFunctionOperationalStatus.class); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionResource.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionResource.java new file mode 100644 index 000000000000..d48d654982ac --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionResource.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.models.NetworkFunctionResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of NetworkFunctionResource. + */ +public interface NetworkFunctionResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + NetworkFunctionResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.mpcnetworkfunction.fluent.models.NetworkFunctionResourceInner object. + * + * @return the inner object. + */ + NetworkFunctionResourceInner innerModel(); + + /** + * The entirety of the NetworkFunctionResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The NetworkFunctionResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the NetworkFunctionResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the NetworkFunctionResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the NetworkFunctionResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the NetworkFunctionResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + NetworkFunctionResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NetworkFunctionResource create(Context context); + } + + /** + * The stage of the NetworkFunctionResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the NetworkFunctionResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(NetworkFunctionResourceProperties properties); + } + } + + /** + * Begins update for the NetworkFunctionResource resource. + * + * @return the stage of resource update. + */ + NetworkFunctionResource.Update update(); + + /** + * The template for NetworkFunctionResource update. + */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + NetworkFunctionResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + NetworkFunctionResource apply(Context context); + } + + /** + * The NetworkFunctionResource update stages. + */ + interface UpdateStages { + /** + * The stage of the NetworkFunctionResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + NetworkFunctionResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + NetworkFunctionResource refresh(Context context); +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionResourceListResult.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionResourceListResult.java new file mode 100644 index 000000000000..080cbe528971 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionResourceListResult.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.models.NetworkFunctionResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a NetworkFunctionResource list operation. + */ +@Fluent +public final class NetworkFunctionResourceListResult { + /* + * The NetworkFunctionResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Creates an instance of NetworkFunctionResourceListResult class. + */ + public NetworkFunctionResourceListResult() { + } + + /** + * Get the value property: The NetworkFunctionResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The NetworkFunctionResource items on this page. + * + * @param value the value value to set. + * @return the NetworkFunctionResourceListResult object itself. + */ + public NetworkFunctionResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the NetworkFunctionResourceListResult object itself. + */ + public NetworkFunctionResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property value in model NetworkFunctionResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NetworkFunctionResourceListResult.class); +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionResourceProperties.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionResourceProperties.java new file mode 100644 index 000000000000..bf9bad4a5a49 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionResourceProperties.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Network Function Properties. + */ +@Fluent +public final class NetworkFunctionResourceProperties { + /* + * Provisioned SKU Value. + */ + @JsonProperty(value = "sku", required = true) + private SkuDefinitions sku; + + /* + * Type of network function + */ + @JsonProperty(value = "networkFunctionType", required = true) + private NetworkFunctionType networkFunctionType; + + /* + * Administrative state of the network function + */ + @JsonProperty(value = "networkFunctionAdministrativeState", required = true) + private NetworkFunctionAdministrativeState networkFunctionAdministrativeState; + + /* + * Operational state of the network function + */ + @JsonProperty(value = "networkFunctionOperationalStatus", access = JsonProperty.Access.WRITE_ONLY) + private NetworkFunctionOperationalStatus networkFunctionOperationalStatus; + + /* + * Count of infrastructure elements used by this network function (vCPUs, in units of 8) + */ + @JsonProperty(value = "infrastructureElementCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer infrastructureElementCount; + + /* + * Capacity of the network function in units of 10000. This represents the session count or the Simultaneously + * Attached Users (SAU) count as applicable + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /* + * User provided description + */ + @JsonProperty(value = "userDescription") + private String userDescription; + + /* + * User provided deployment notes. This is used to optionally provide details about the NF deployment + */ + @JsonProperty(value = "deploymentNotes") + private String deploymentNotes; + + /* + * The status of the last operation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Creates an instance of NetworkFunctionResourceProperties class. + */ + public NetworkFunctionResourceProperties() { + } + + /** + * Get the sku property: Provisioned SKU Value. + * + * @return the sku value. + */ + public SkuDefinitions sku() { + return this.sku; + } + + /** + * Set the sku property: Provisioned SKU Value. + * + * @param sku the sku value to set. + * @return the NetworkFunctionResourceProperties object itself. + */ + public NetworkFunctionResourceProperties withSku(SkuDefinitions sku) { + this.sku = sku; + return this; + } + + /** + * Get the networkFunctionType property: Type of network function. + * + * @return the networkFunctionType value. + */ + public NetworkFunctionType networkFunctionType() { + return this.networkFunctionType; + } + + /** + * Set the networkFunctionType property: Type of network function. + * + * @param networkFunctionType the networkFunctionType value to set. + * @return the NetworkFunctionResourceProperties object itself. + */ + public NetworkFunctionResourceProperties withNetworkFunctionType(NetworkFunctionType networkFunctionType) { + this.networkFunctionType = networkFunctionType; + return this; + } + + /** + * Get the networkFunctionAdministrativeState property: Administrative state of the network function. + * + * @return the networkFunctionAdministrativeState value. + */ + public NetworkFunctionAdministrativeState networkFunctionAdministrativeState() { + return this.networkFunctionAdministrativeState; + } + + /** + * Set the networkFunctionAdministrativeState property: Administrative state of the network function. + * + * @param networkFunctionAdministrativeState the networkFunctionAdministrativeState value to set. + * @return the NetworkFunctionResourceProperties object itself. + */ + public NetworkFunctionResourceProperties + withNetworkFunctionAdministrativeState(NetworkFunctionAdministrativeState networkFunctionAdministrativeState) { + this.networkFunctionAdministrativeState = networkFunctionAdministrativeState; + return this; + } + + /** + * Get the networkFunctionOperationalStatus property: Operational state of the network function. + * + * @return the networkFunctionOperationalStatus value. + */ + public NetworkFunctionOperationalStatus networkFunctionOperationalStatus() { + return this.networkFunctionOperationalStatus; + } + + /** + * Get the infrastructureElementCount property: Count of infrastructure elements used by this network function + * (vCPUs, in units of 8). + * + * @return the infrastructureElementCount value. + */ + public Integer infrastructureElementCount() { + return this.infrastructureElementCount; + } + + /** + * Get the capacity property: Capacity of the network function in units of 10000. This represents the session + * count or the Simultaneously Attached Users (SAU) count as applicable. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: Capacity of the network function in units of 10000. This represents the session + * count or the Simultaneously Attached Users (SAU) count as applicable. + * + * @param capacity the capacity value to set. + * @return the NetworkFunctionResourceProperties object itself. + */ + public NetworkFunctionResourceProperties withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the userDescription property: User provided description. + * + * @return the userDescription value. + */ + public String userDescription() { + return this.userDescription; + } + + /** + * Set the userDescription property: User provided description. + * + * @param userDescription the userDescription value to set. + * @return the NetworkFunctionResourceProperties object itself. + */ + public NetworkFunctionResourceProperties withUserDescription(String userDescription) { + this.userDescription = userDescription; + return this; + } + + /** + * Get the deploymentNotes property: User provided deployment notes. This is used to optionally provide details + * about the NF deployment. + * + * @return the deploymentNotes value. + */ + public String deploymentNotes() { + return this.deploymentNotes; + } + + /** + * Set the deploymentNotes property: User provided deployment notes. This is used to optionally provide details + * about the NF deployment. + * + * @param deploymentNotes the deploymentNotes value to set. + * @return the NetworkFunctionResourceProperties object itself. + */ + public NetworkFunctionResourceProperties withDeploymentNotes(String deploymentNotes) { + this.deploymentNotes = deploymentNotes; + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property sku in model NetworkFunctionResourceProperties")); + } + if (networkFunctionType() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property networkFunctionType in model NetworkFunctionResourceProperties")); + } + if (networkFunctionAdministrativeState() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property networkFunctionAdministrativeState in model NetworkFunctionResourceProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NetworkFunctionResourceProperties.class); +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionResourceTagsUpdate.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionResourceTagsUpdate.java new file mode 100644 index 000000000000..9ec363edb853 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionResourceTagsUpdate.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * The type used for updating tags in NetworkFunctionResource resources. + */ +@Fluent +public final class NetworkFunctionResourceTagsUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Creates an instance of NetworkFunctionResourceTagsUpdate class. + */ + public NetworkFunctionResourceTagsUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the NetworkFunctionResourceTagsUpdate object itself. + */ + public NetworkFunctionResourceTagsUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionType.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionType.java new file mode 100644 index 000000000000..46b69b9f820e --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctionType.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Type of Network Function. + */ +public final class NetworkFunctionType extends ExpandableStringEnum { + /** + * Static value AMF for NetworkFunctionType. + */ + public static final NetworkFunctionType AMF = fromString("AMF"); + + /** + * Static value SMF for NetworkFunctionType. + */ + public static final NetworkFunctionType SMF = fromString("SMF"); + + /** + * Static value UPF for NetworkFunctionType. + */ + public static final NetworkFunctionType UPF = fromString("UPF"); + + /** + * Static value NRF for NetworkFunctionType. + */ + public static final NetworkFunctionType NRF = fromString("NRF"); + + /** + * Static value NSSF for NetworkFunctionType. + */ + public static final NetworkFunctionType NSSF = fromString("NSSF"); + + /** + * Static value MME for NetworkFunctionType. + */ + public static final NetworkFunctionType MME = fromString("MME"); + + /** + * Static value SaegwControlPlane for NetworkFunctionType. + */ + public static final NetworkFunctionType SAEGW_CONTROL_PLANE = fromString("SaegwControlPlane"); + + /** + * Static value SaegwUserPlane for NetworkFunctionType. + */ + public static final NetworkFunctionType SAEGW_USER_PLANE = fromString("SaegwUserPlane"); + + /** + * Static value Saegw for NetworkFunctionType. + */ + public static final NetworkFunctionType SAEGW = fromString("Saegw"); + + /** + * Static value ePDG for NetworkFunctionType. + */ + public static final NetworkFunctionType E_PDG = fromString("ePDG"); + + /** + * Static value N3IWF for NetworkFunctionType. + */ + public static final NetworkFunctionType N3IWF = fromString("N3IWF"); + + /** + * Static value RemotePaaS for NetworkFunctionType. + */ + public static final NetworkFunctionType REMOTE_PAAS = fromString("RemotePaaS"); + + /** + * Static value EMS for NetworkFunctionType. + */ + public static final NetworkFunctionType EMS = fromString("EMS"); + + /** + * Static value OperationsPolicyManager for NetworkFunctionType. + */ + public static final NetworkFunctionType OPERATIONS_POLICY_MANAGER = fromString("OperationsPolicyManager"); + + /** + * Creates a new instance of NetworkFunctionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NetworkFunctionType() { + } + + /** + * Creates or finds a NetworkFunctionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkFunctionType. + */ + @JsonCreator + public static NetworkFunctionType fromString(String name) { + return fromString(name, NetworkFunctionType.class); + } + + /** + * Gets known NetworkFunctionType values. + * + * @return known NetworkFunctionType values. + */ + public static Collection values() { + return values(NetworkFunctionType.class); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctions.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctions.java new file mode 100644 index 000000000000..a61b89a5a04e --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/NetworkFunctions.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of NetworkFunctions. + */ +public interface NetworkFunctions { + /** + * List NetworkFunctionResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List NetworkFunctionResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List NetworkFunctionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List NetworkFunctionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkFunctionResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NetworkFunctionResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String networkFunctionName, Context context); + + /** + * Get a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NetworkFunctionResource. + */ + NetworkFunctionResource getByResourceGroup(String resourceGroupName, String networkFunctionName); + + /** + * Delete a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String networkFunctionName, + Context context); + + /** + * Delete a NetworkFunctionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkFunctionName The name of the network function. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String networkFunctionName); + + /** + * Get a NetworkFunctionResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NetworkFunctionResource along with {@link Response}. + */ + NetworkFunctionResource getById(String id); + + /** + * Get a NetworkFunctionResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NetworkFunctionResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a NetworkFunctionResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a NetworkFunctionResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new NetworkFunctionResource resource. + * + * @param name resource name. + * @return the first stage of the new NetworkFunctionResource definition. + */ + NetworkFunctionResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/Operation.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/Operation.java new file mode 100644 index 000000000000..05c206e50a3b --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.resourcemanager.mpcnetworkfunction.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.mpcnetworkfunction.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/OperationDisplay.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/OperationDisplay.java new file mode 100644 index 000000000000..e592923c2b4b --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/OperationDisplay.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + * Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + * Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + * Machine", "Restart Virtual Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/OperationListResult.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/OperationListResult.java new file mode 100644 index 000000000000..5faae27e367d --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/OperationListResult.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.mpcnetworkfunction.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set + * of results. + */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/Operations.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/Operations.java new file mode 100644 index 000000000000..06ae94b73a2d --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/Origin.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/Origin.java new file mode 100644 index 000000000000..d0ec598e56ea --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/Origin.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Static value user for Origin. + */ + public static final Origin USER = fromString("user"); + + /** + * Static value system for Origin. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Static value user,system for Origin. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/ProvisioningState.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/ProvisioningState.java new file mode 100644 index 000000000000..a775ad5c77ff --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/ProvisioningState.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Provisioning state of the resource. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Provisioning for ProvisioningState. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Static value Updating for ProvisioningState. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Accepted for ProvisioningState. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/SkuDefinitions.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/SkuDefinitions.java new file mode 100644 index 000000000000..7d597177ec54 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/SkuDefinitions.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * SKU Definitions. + */ +public final class SkuDefinitions extends ExpandableStringEnum { + /** + * Static value AzureLab for SkuDefinitions. + */ + public static final SkuDefinitions AZURE_LAB = fromString("AzureLab"); + + /** + * Static value AzureProduction for SkuDefinitions. + */ + public static final SkuDefinitions AZURE_PRODUCTION = fromString("AzureProduction"); + + /** + * Static value NexusLab for SkuDefinitions. + */ + public static final SkuDefinitions NEXUS_LAB = fromString("NexusLab"); + + /** + * Static value NexusProduction for SkuDefinitions. + */ + public static final SkuDefinitions NEXUS_PRODUCTION = fromString("NexusProduction"); + + /** + * Creates a new instance of SkuDefinitions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SkuDefinitions() { + } + + /** + * Creates or finds a SkuDefinitions from its string representation. + * + * @param name a name to look for. + * @return the corresponding SkuDefinitions. + */ + @JsonCreator + public static SkuDefinitions fromString(String name) { + return fromString(name, SkuDefinitions.class); + } + + /** + * Gets known SkuDefinitions values. + * + * @return known SkuDefinitions values. + */ + public static Collection values() { + return values(SkuDefinitions.class); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/package-info.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/package-info.java new file mode 100644 index 000000000000..2368a8a9f69e --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for MicrosoftMobilePacketCoreNetworkFunctionResource. + * Mobile Packet Core Network Function Management API. + */ +package com.azure.resourcemanager.mpcnetworkfunction.models; diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/package-info.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/package-info.java new file mode 100644 index 000000000000..91c6e4952057 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/com/azure/resourcemanager/mpcnetworkfunction/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for MicrosoftMobilePacketCoreNetworkFunctionResource. + * Mobile Packet Core Network Function Management API. + */ +package com.azure.resourcemanager.mpcnetworkfunction; diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/module-info.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/module-info.java new file mode 100644 index 000000000000..98115043659a --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/java/module-info.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.mpcnetworkfunction { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.mpcnetworkfunction; + exports com.azure.resourcemanager.mpcnetworkfunction.fluent; + exports com.azure.resourcemanager.mpcnetworkfunction.fluent.models; + exports com.azure.resourcemanager.mpcnetworkfunction.models; + + opens com.azure.resourcemanager.mpcnetworkfunction.fluent.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.mpcnetworkfunction.models to com.azure.core, com.fasterxml.jackson.databind; +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mpcnetworkfunction/proxy-config.json b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mpcnetworkfunction/proxy-config.json new file mode 100644 index 000000000000..632307fce71c --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mpcnetworkfunction/proxy-config.json @@ -0,0 +1 @@ +[ [ "com.azure.resourcemanager.mpcnetworkfunction.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.mpcnetworkfunction.implementation.NetworkFunctionsClientImpl$NetworkFunctionsService" ] ] \ No newline at end of file diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mpcnetworkfunction/reflect-config.json b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mpcnetworkfunction/reflect-config.json new file mode 100644 index 000000000000..b13d93aaa0c9 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mpcnetworkfunction/reflect-config.json @@ -0,0 +1,71 @@ +[ { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.models.OperationListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.fluent.models.OperationInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.models.OperationDisplay", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResourceListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.fluent.models.NetworkFunctionResourceInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResourceProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResourceTagsUpdate", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.models.Origin", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.models.ActionType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.models.SkuDefinitions", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionAdministrativeState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionOperationalStatus", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mpcnetworkfunction.models.ProvisioningState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +} ] \ No newline at end of file diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsCreateOrUpdateSamples.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..9d81d08693bd --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsCreateOrUpdateSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.generated; + +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionAdministrativeState; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResourceProperties; +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionType; +import com.azure.resourcemanager.mpcnetworkfunction.models.SkuDefinitions; + +/** + * Samples for NetworkFunctions CreateOrUpdate. + */ +public final class NetworkFunctionsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/ + * NetworkFunctions_CreateOrUpdate.json + */ + /** + * Sample code: NetworkFunctions_CreateOrUpdate. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void + networkFunctionsCreateOrUpdate(com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + manager.networkFunctions().define("nf1").withRegion("eastus").withExistingResourceGroup("rg1") + .withProperties(new NetworkFunctionResourceProperties().withSku(SkuDefinitions.NEXUS_PRODUCTION) + .withNetworkFunctionType(NetworkFunctionType.SMF) + .withNetworkFunctionAdministrativeState(NetworkFunctionAdministrativeState.COMMISSIONED) + .withCapacity(100000).withUserDescription("string").withDeploymentNotes("string")) + .create(); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsDeleteSamples.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsDeleteSamples.java new file mode 100644 index 000000000000..e660bdd8d412 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.generated; + +/** + * Samples for NetworkFunctions Delete. + */ +public final class NetworkFunctionsDeleteSamples { + /* + * x-ms-original-file: + * specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/ + * NetworkFunctions_Delete.json + */ + /** + * Sample code: NetworkFunctions_Delete. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void + networkFunctionsDelete(com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + manager.networkFunctions().deleteByResourceGroupWithResponse("rg1", "nf1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsGetByResourceGroupSamples.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..6fa19d7424f6 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsGetByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.generated; + +/** + * Samples for NetworkFunctions GetByResourceGroup. + */ +public final class NetworkFunctionsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/ + * NetworkFunctions_Get.json + */ + /** + * Sample code: NetworkFunctions_Get. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void + networkFunctionsGet(com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + manager.networkFunctions().getByResourceGroupWithResponse("rg1", "nf1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsListByResourceGroupSamples.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsListByResourceGroupSamples.java new file mode 100644 index 000000000000..87eebbfe8954 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsListByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.generated; + +/** + * Samples for NetworkFunctions ListByResourceGroup. + */ +public final class NetworkFunctionsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/ + * NetworkFunctions_ListByResourceGroup.json + */ + /** + * Sample code: NetworkFunctions_ListByResourceGroup. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void networkFunctionsListByResourceGroup( + com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + manager.networkFunctions().listByResourceGroup("rg1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsListSamples.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsListSamples.java new file mode 100644 index 000000000000..13944ec2bad8 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.generated; + +/** + * Samples for NetworkFunctions List. + */ +public final class NetworkFunctionsListSamples { + /* + * x-ms-original-file: + * specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/ + * NetworkFunctions_ListBySubscription.json + */ + /** + * Sample code: NetworkFunctions_ListBySubscription. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void networkFunctionsListBySubscription( + com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + manager.networkFunctions().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsUpdateTagsSamples.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsUpdateTagsSamples.java new file mode 100644 index 000000000000..38d3a40be827 --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/NetworkFunctionsUpdateTagsSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.generated; + +import com.azure.resourcemanager.mpcnetworkfunction.models.NetworkFunctionResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for NetworkFunctions UpdateTags. + */ +public final class NetworkFunctionsUpdateTagsSamples { + /* + * x-ms-original-file: + * specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/ + * NetworkFunctions_UpdateTags.json + */ + /** + * Sample code: NetworkFunctions_UpdateTags. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void + networkFunctionsUpdateTags(com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + NetworkFunctionResource resource = manager.networkFunctions() + .getByResourceGroupWithResponse("rg1", "nf1", com.azure.core.util.Context.NONE).getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/OperationsListSamples.java b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/OperationsListSamples.java new file mode 100644 index 000000000000..e436ac5e696b --- /dev/null +++ b/sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/src/samples/java/com/azure/resourcemanager/mpcnetworkfunction/generated/OperationsListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mpcnetworkfunction.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/mpcnetworkfunction/resource-manager/Microsoft.MobilePacketCore/preview/2023-05-15-preview/examples/ + * OperationList.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to MpcnetworkfunctionManager. + */ + public static void operationsList(com.azure.resourcemanager.mpcnetworkfunction.MpcnetworkfunctionManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mpcnetworkfunction/ci.yml b/sdk/mpcnetworkfunction/ci.yml new file mode 100644 index 000000000000..f9123dd8cb6a --- /dev/null +++ b/sdk/mpcnetworkfunction/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/mpcnetworkfunction/ci.yml + - sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/ + exclude: + - sdk/mpcnetworkfunction/pom.xml + - sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mpcnetworkfunction/ci.yml + - sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/ + exclude: + - sdk/mpcnetworkfunction/pom.xml + - sdk/mpcnetworkfunction/azure-resourcemanager-mpcnetworkfunction/pom.xml + +parameters: + - name: release_azureresourcemanagermpcnetworkfunction + displayName: azure-resourcemanager-mpcnetworkfunction + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: mpcnetworkfunction + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-mpcnetworkfunction + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermpcnetworkfunction + releaseInBatch: ${{ parameters.release_azureresourcemanagermpcnetworkfunction }} diff --git a/sdk/mpcnetworkfunction/pom.xml b/sdk/mpcnetworkfunction/pom.xml new file mode 100644 index 000000000000..e1bdd836c2bc --- /dev/null +++ b/sdk/mpcnetworkfunction/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-mpcnetworkfunction-service + pom + 1.0.0 + + + azure-resourcemanager-mpcnetworkfunction + +