diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index c630c5ae1886..ac49f1cbb682 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -340,6 +340,7 @@ com.azure.resourcemanager:azure-resourcemanager-servicelinker;1.0.0-beta.1;1.0.0 com.azure.resourcemanager:azure-resourcemanager-appcontainers;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-scvmm;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-hardwaresecuritymodules;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-networkfunction;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 0d08d4fb5914..cbae694f6897 100644 --- a/pom.xml +++ b/pom.xml @@ -935,6 +935,7 @@ sdk/mysql sdk/mysqlflexibleserver sdk/netapp + sdk/networkfunction sdk/notificationhubs sdk/oep sdk/operationsmanagement diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/CHANGELOG.md b/sdk/networkfunction/azure-resourcemanager-networkfunction/CHANGELOG.md new file mode 100644 index 000000000000..ec4d50706ec8 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-05-12) + +- Azure Resource Manager AzureTrafficCollector client library for Java. This package contains Microsoft Azure SDK for AzureTrafficCollector Management SDK. Azure Traffic Collector service. Package tag package-2022-05-01. 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/networkfunction/azure-resourcemanager-networkfunction/README.md b/sdk/networkfunction/azure-resourcemanager-networkfunction/README.md new file mode 100644 index 000000000000..02e98ca14974 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager AzureTrafficCollector client library for Java + +Azure Resource Manager AzureTrafficCollector client library for Java. + +This package contains Microsoft Azure SDK for AzureTrafficCollector Management SDK. Azure Traffic Collector service. Package tag package-2022-05-01. 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-networkfunction;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-networkfunction + 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] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of 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 environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +AzureTrafficCollectorManager manager = AzureTrafficCollectorManager + .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/networkfunction/azure-resourcemanager-networkfunction/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[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 diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/SAMPLE.md b/sdk/networkfunction/azure-resourcemanager-networkfunction/SAMPLE.md new file mode 100644 index 000000000000..876d357a4890 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/SAMPLE.md @@ -0,0 +1,337 @@ +# Code snippets and samples + + +## AzureTrafficCollectors + +- [CreateOrUpdate](#azuretrafficcollectors_createorupdate) +- [Delete](#azuretrafficcollectors_delete) +- [GetByResourceGroup](#azuretrafficcollectors_getbyresourcegroup) +- [UpdateTags](#azuretrafficcollectors_updatetags) + +## AzureTrafficCollectorsByResourceGroup + +- [ListByResourceGroup](#azuretrafficcollectorsbyresourcegroup_listbyresourcegroup) + +## AzureTrafficCollectorsBySubscription + +- [List](#azuretrafficcollectorsbysubscription_list) + +## CollectorPolicies + +- [CreateOrUpdate](#collectorpolicies_createorupdate) +- [Delete](#collectorpolicies_delete) +- [Get](#collectorpolicies_get) +- [List](#collectorpolicies_list) + +## NetworkFunction + +- [ListOperations](#networkfunction_listoperations) +### AzureTrafficCollectors_CreateOrUpdate + +```java +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AzureTrafficCollectors CreateOrUpdate. */ +public final class AzureTrafficCollectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorCreate.json + */ + /** + * Sample code: Create a traffic collector. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void createATrafficCollector( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager + .azureTrafficCollectors() + .define("atc") + .withRegion("West US") + .withExistingResourceGroup("rg1") + .withTags(mapOf("key1", "value1")) + .withCollectorPolicies(Arrays.asList()) + .create(); + } + + @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; + } +} +``` + +### AzureTrafficCollectors_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for AzureTrafficCollectors Delete. */ +public final class AzureTrafficCollectorsDeleteSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorDelete.json + */ + /** + * Sample code: Delete Traffic Collector. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void deleteTrafficCollector( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.azureTrafficCollectors().delete("rg1", "atc", Context.NONE); + } +} +``` + +### AzureTrafficCollectors_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for AzureTrafficCollectors GetByResourceGroup. */ +public final class AzureTrafficCollectorsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorGet.json + */ + /** + * Sample code: Get Traffic Collector. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void getTrafficCollector( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.azureTrafficCollectors().getByResourceGroupWithResponse("rg1", "atc", Context.NONE); + } +} +``` + +### AzureTrafficCollectors_UpdateTags + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollector; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AzureTrafficCollectors UpdateTags. */ +public final class AzureTrafficCollectorsUpdateTagsSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorUpdateTags.json + */ + /** + * Sample code: Update Traffic Collector tags. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void updateTrafficCollectorTags( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + AzureTrafficCollector resource = + manager.azureTrafficCollectors().getByResourceGroupWithResponse("rg1", "atc", Context.NONE).getValue(); + resource.update().withTags(mapOf("key1", "value1", "key2", "value2")).apply(); + } + + @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; + } +} +``` + +### AzureTrafficCollectorsByResourceGroup_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for AzureTrafficCollectorsByResourceGroup ListByResourceGroup. */ +public final class AzureTrafficCollectorsByResourceGroupListByResourceGroupSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorsByResourceGroupList.json + */ + /** + * Sample code: List of Traffic Collectors by ResourceGroup. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void listOfTrafficCollectorsByResourceGroup( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.azureTrafficCollectorsByResourceGroups().listByResourceGroup("rg1", Context.NONE); + } +} +``` + +### AzureTrafficCollectorsBySubscription_List + +```java +import com.azure.core.util.Context; + +/** Samples for AzureTrafficCollectorsBySubscription List. */ +public final class AzureTrafficCollectorsBySubscriptionListSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorsBySubscriptionList.json + */ + /** + * Sample code: List of Traffic Collectors by Subscription. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void listOfTrafficCollectorsBySubscription( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.azureTrafficCollectorsBySubscriptions().list(Context.NONE); + } +} +``` + +### CollectorPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.networkfunction.models.DestinationType; +import com.azure.resourcemanager.networkfunction.models.EmissionPoliciesPropertiesFormat; +import com.azure.resourcemanager.networkfunction.models.EmissionPolicyDestination; +import com.azure.resourcemanager.networkfunction.models.EmissionType; +import com.azure.resourcemanager.networkfunction.models.IngestionPolicyPropertiesFormat; +import com.azure.resourcemanager.networkfunction.models.IngestionSourcesPropertiesFormat; +import com.azure.resourcemanager.networkfunction.models.IngestionType; +import com.azure.resourcemanager.networkfunction.models.SourceType; +import java.util.Arrays; + +/** Samples for CollectorPolicies CreateOrUpdate. */ +public final class CollectorPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/CollectorPolicyCreate.json + */ + /** + * Sample code: Create a collection policy. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void createACollectionPolicy( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager + .collectorPolicies() + .define("cp1") + .withExistingAzureTrafficCollector("rg1", "atc") + .withIngestionPolicy( + new IngestionPolicyPropertiesFormat() + .withIngestionType(IngestionType.IPFIX) + .withIngestionSources( + Arrays + .asList( + new IngestionSourcesPropertiesFormat() + .withSourceType(SourceType.RESOURCE) + .withResourceId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName")))) + .withEmissionPolicies( + Arrays + .asList( + new EmissionPoliciesPropertiesFormat() + .withEmissionType(EmissionType.IPFIX) + .withEmissionDestinations( + Arrays + .asList( + new EmissionPolicyDestination() + .withDestinationType(DestinationType.AZURE_MONITOR))))) + .create(); + } +} +``` + +### CollectorPolicies_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for CollectorPolicies Delete. */ +public final class CollectorPoliciesDeleteSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/CollectorPolicyDelete.json + */ + /** + * Sample code: Delete Collection Policy. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void deleteCollectionPolicy( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.collectorPolicies().delete("rg1", "atc", "cp1", Context.NONE); + } +} +``` + +### CollectorPolicies_Get + +```java +import com.azure.core.util.Context; + +/** Samples for CollectorPolicies Get. */ +public final class CollectorPoliciesGetSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/CollectorPolicyGet.json + */ + /** + * Sample code: Get Collection Policy. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void getCollectionPolicy( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.collectorPolicies().getWithResponse("rg1", "atc", "cp1", Context.NONE); + } +} +``` + +### CollectorPolicies_List + +```java +import com.azure.core.util.Context; + +/** Samples for CollectorPolicies List. */ +public final class CollectorPoliciesListSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/CollectorPoliciesList.json + */ + /** + * Sample code: List of Collection Policies. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void listOfCollectionPolicies( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.collectorPolicies().list("rg1", "atc", Context.NONE); + } +} +``` + +### NetworkFunction_ListOperations + +```java +import com.azure.core.util.Context; + +/** Samples for NetworkFunction ListOperations. */ +public final class NetworkFunctionListOperationsSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/OperationsList.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void operationsList(com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.networkFunctions().listOperations(Context.NONE); + } +} +``` + diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/pom.xml b/sdk/networkfunction/azure-resourcemanager-networkfunction/pom.xml new file mode 100644 index 000000000000..0bfe74588c55 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-networkfunction + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for AzureTrafficCollector Management + This package contains Microsoft Azure SDK for AzureTrafficCollector Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Traffic Collector service. Package tag package-2022-05-01. + 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 + true + + + + com.azure + azure-core + 1.28.0 + + + com.azure + azure-core-management + 1.6.0 + + + diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/AzureTrafficCollectorManager.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/AzureTrafficCollectorManager.java new file mode 100644 index 000000000000..dca5f9c6206a --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/AzureTrafficCollectorManager.java @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction; + +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.networkfunction.fluent.AzureTrafficCollectorManagementClient; +import com.azure.resourcemanager.networkfunction.implementation.AzureTrafficCollectorManagementClientBuilder; +import com.azure.resourcemanager.networkfunction.implementation.AzureTrafficCollectorsByResourceGroupsImpl; +import com.azure.resourcemanager.networkfunction.implementation.AzureTrafficCollectorsBySubscriptionsImpl; +import com.azure.resourcemanager.networkfunction.implementation.AzureTrafficCollectorsImpl; +import com.azure.resourcemanager.networkfunction.implementation.CollectorPoliciesImpl; +import com.azure.resourcemanager.networkfunction.implementation.NetworkFunctionsImpl; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollectors; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollectorsByResourceGroups; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollectorsBySubscriptions; +import com.azure.resourcemanager.networkfunction.models.CollectorPolicies; +import com.azure.resourcemanager.networkfunction.models.NetworkFunctions; +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 AzureTrafficCollectorManager. Azure Traffic Collector service. */ +public final class AzureTrafficCollectorManager { + private NetworkFunctions networkFunctions; + + private AzureTrafficCollectorsBySubscriptions azureTrafficCollectorsBySubscriptions; + + private AzureTrafficCollectorsByResourceGroups azureTrafficCollectorsByResourceGroups; + + private AzureTrafficCollectors azureTrafficCollectors; + + private CollectorPolicies collectorPolicies; + + private final AzureTrafficCollectorManagementClient clientObject; + + private AzureTrafficCollectorManager( + HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new AzureTrafficCollectorManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of AzureTrafficCollector service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the AzureTrafficCollector service API instance. + */ + public static AzureTrafficCollectorManager 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 AzureTrafficCollector service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the AzureTrafficCollector service API instance. + */ + public static AzureTrafficCollectorManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new AzureTrafficCollectorManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create AzureTrafficCollectorManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new AzureTrafficCollectorManager.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 AzureTrafficCollector service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the AzureTrafficCollector service API instance. + */ + public AzureTrafficCollectorManager 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.networkfunction") + .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 AzureTrafficCollectorManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of NetworkFunctions. + * + * @return Resource collection API of NetworkFunctions. + */ + public NetworkFunctions networkFunctions() { + if (this.networkFunctions == null) { + this.networkFunctions = new NetworkFunctionsImpl(clientObject.getNetworkFunctions(), this); + } + return networkFunctions; + } + + /** + * Gets the resource collection API of AzureTrafficCollectorsBySubscriptions. + * + * @return Resource collection API of AzureTrafficCollectorsBySubscriptions. + */ + public AzureTrafficCollectorsBySubscriptions azureTrafficCollectorsBySubscriptions() { + if (this.azureTrafficCollectorsBySubscriptions == null) { + this.azureTrafficCollectorsBySubscriptions = + new AzureTrafficCollectorsBySubscriptionsImpl( + clientObject.getAzureTrafficCollectorsBySubscriptions(), this); + } + return azureTrafficCollectorsBySubscriptions; + } + + /** + * Gets the resource collection API of AzureTrafficCollectorsByResourceGroups. + * + * @return Resource collection API of AzureTrafficCollectorsByResourceGroups. + */ + public AzureTrafficCollectorsByResourceGroups azureTrafficCollectorsByResourceGroups() { + if (this.azureTrafficCollectorsByResourceGroups == null) { + this.azureTrafficCollectorsByResourceGroups = + new AzureTrafficCollectorsByResourceGroupsImpl( + clientObject.getAzureTrafficCollectorsByResourceGroups(), this); + } + return azureTrafficCollectorsByResourceGroups; + } + + /** + * Gets the resource collection API of AzureTrafficCollectors. + * + * @return Resource collection API of AzureTrafficCollectors. + */ + public AzureTrafficCollectors azureTrafficCollectors() { + if (this.azureTrafficCollectors == null) { + this.azureTrafficCollectors = + new AzureTrafficCollectorsImpl(clientObject.getAzureTrafficCollectors(), this); + } + return azureTrafficCollectors; + } + + /** + * Gets the resource collection API of CollectorPolicies. + * + * @return Resource collection API of CollectorPolicies. + */ + public CollectorPolicies collectorPolicies() { + if (this.collectorPolicies == null) { + this.collectorPolicies = new CollectorPoliciesImpl(clientObject.getCollectorPolicies(), this); + } + return collectorPolicies; + } + + /** + * @return Wrapped service client AzureTrafficCollectorManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public AzureTrafficCollectorManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/AzureTrafficCollectorManagementClient.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/AzureTrafficCollectorManagementClient.java new file mode 100644 index 000000000000..db9216f671fe --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/AzureTrafficCollectorManagementClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for AzureTrafficCollectorManagementClient class. */ +public interface AzureTrafficCollectorManagementClient { + /** + * Gets Azure Subscription ID. + * + * @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 NetworkFunctionsClient object to access its operations. + * + * @return the NetworkFunctionsClient object. + */ + NetworkFunctionsClient getNetworkFunctions(); + + /** + * Gets the AzureTrafficCollectorsBySubscriptionsClient object to access its operations. + * + * @return the AzureTrafficCollectorsBySubscriptionsClient object. + */ + AzureTrafficCollectorsBySubscriptionsClient getAzureTrafficCollectorsBySubscriptions(); + + /** + * Gets the AzureTrafficCollectorsByResourceGroupsClient object to access its operations. + * + * @return the AzureTrafficCollectorsByResourceGroupsClient object. + */ + AzureTrafficCollectorsByResourceGroupsClient getAzureTrafficCollectorsByResourceGroups(); + + /** + * Gets the AzureTrafficCollectorsClient object to access its operations. + * + * @return the AzureTrafficCollectorsClient object. + */ + AzureTrafficCollectorsClient getAzureTrafficCollectors(); + + /** + * Gets the CollectorPoliciesClient object to access its operations. + * + * @return the CollectorPoliciesClient object. + */ + CollectorPoliciesClient getCollectorPolicies(); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/AzureTrafficCollectorsByResourceGroupsClient.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/AzureTrafficCollectorsByResourceGroupsClient.java new file mode 100644 index 000000000000..0ceab4cf6006 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/AzureTrafficCollectorsByResourceGroupsClient.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.networkfunction.fluent.models.AzureTrafficCollectorInner; + +/** + * An instance of this class provides access to all the operations defined in + * AzureTrafficCollectorsByResourceGroupsClient. + */ +public interface AzureTrafficCollectorsByResourceGroupsClient { + /** + * Return list of Azure Traffic Collectors in a Resource Group. + * + * @param resourceGroupName The name of the resource group. + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Return list of Azure Traffic Collectors in a Resource Group. + * + * @param resourceGroupName The name of the resource group. + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/AzureTrafficCollectorsBySubscriptionsClient.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/AzureTrafficCollectorsBySubscriptionsClient.java new file mode 100644 index 000000000000..1d5e4fdc2f46 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/AzureTrafficCollectorsBySubscriptionsClient.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.networkfunction.fluent.models.AzureTrafficCollectorInner; + +/** + * An instance of this class provides access to all the operations defined in + * AzureTrafficCollectorsBySubscriptionsClient. + */ +public interface AzureTrafficCollectorsBySubscriptionsClient { + /** + * Return list of Azure Traffic Collectors in a subscription. + * + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Return list of Azure Traffic Collectors in a subscription. + * + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/AzureTrafficCollectorsClient.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/AzureTrafficCollectorsClient.java new file mode 100644 index 000000000000..6604511f0ce4 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/AzureTrafficCollectorsClient.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.networkfunction.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +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.networkfunction.fluent.models.AzureTrafficCollectorInner; +import com.azure.resourcemanager.networkfunction.models.TagsObject; + +/** An instance of this class provides access to all the operations defined in AzureTrafficCollectorsClient. */ +public interface AzureTrafficCollectorsClient { + /** + * Gets the specified Azure Traffic Collector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 specified Azure Traffic Collector in a specified resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureTrafficCollectorInner getByResourceGroup(String resourceGroupName, String azureTrafficCollectorName); + + /** + * Gets the specified Azure Traffic Collector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 specified Azure Traffic Collector in a specified resource group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String azureTrafficCollectorName, Context context); + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureTrafficCollectorInner> beginCreateOrUpdate( + String resourceGroupName, String azureTrafficCollectorName, AzureTrafficCollectorInner parameters); + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureTrafficCollectorInner> beginCreateOrUpdate( + String resourceGroupName, + String azureTrafficCollectorName, + AzureTrafficCollectorInner parameters, + Context context); + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureTrafficCollectorInner createOrUpdate( + String resourceGroupName, String azureTrafficCollectorName, AzureTrafficCollectorInner parameters); + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureTrafficCollectorInner createOrUpdate( + String resourceGroupName, + String azureTrafficCollectorName, + AzureTrafficCollectorInner parameters, + Context context); + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String azureTrafficCollectorName); + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String azureTrafficCollectorName, Context context); + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 azureTrafficCollectorName); + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String azureTrafficCollectorName, Context context); + + /** + * Updates the specified Azure Traffic Collector tags. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters Parameters supplied to update Azure Traffic Collector tags. + * @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 azure Traffic Collector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureTrafficCollectorInner updateTags( + String resourceGroupName, String azureTrafficCollectorName, TagsObject parameters); + + /** + * Updates the specified Azure Traffic Collector tags. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters Parameters supplied to update Azure Traffic Collector tags. + * @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 azure Traffic Collector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateTagsWithResponse( + String resourceGroupName, String azureTrafficCollectorName, TagsObject parameters, Context context); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/CollectorPoliciesClient.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/CollectorPoliciesClient.java new file mode 100644 index 000000000000..4535f6267c6d --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/CollectorPoliciesClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.networkfunction.fluent.models.CollectorPolicyInner; + +/** An instance of this class provides access to all the operations defined in CollectorPoliciesClient. */ +public interface CollectorPoliciesClient { + /** + * Return list of Collector policies in a Azure Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 response for the ListCollectorPolicies API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String azureTrafficCollectorName); + + /** + * Return list of Collector policies in a Azure Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 response for the ListCollectorPolicies API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String azureTrafficCollectorName, Context context); + + /** + * Gets the collector policy in a specified Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 collector policy in a specified Traffic Collector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CollectorPolicyInner get(String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName); + + /** + * Gets the collector policy in a specified Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 collector policy in a specified Traffic Collector along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName, Context context); + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CollectorPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters); + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CollectorPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters, + Context context); + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CollectorPolicyInner createOrUpdate( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters); + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CollectorPolicyInner createOrUpdate( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters, + Context context); + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName); + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName, Context context); + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 azureTrafficCollectorName, String collectorPolicyName); + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName, Context context); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/NetworkFunctionsClient.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/NetworkFunctionsClient.java new file mode 100644 index 000000000000..d23276d85d57 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/NetworkFunctionsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.networkfunction.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in NetworkFunctionsClient. */ +public interface NetworkFunctionsClient { + /** + * Lists all of the available NetworkFunction Rest API operations. + * + * @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 result of the request to list Azure Traffic Collector operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOperations(); + + /** + * Lists all of the available NetworkFunction Rest API operations. + * + * @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 result of the request to list Azure Traffic Collector operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOperations(Context context); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/AzureTrafficCollectorInner.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/AzureTrafficCollectorInner.java new file mode 100644 index 000000000000..a4e9f9f30cbc --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/AzureTrafficCollectorInner.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.networkfunction.models.ProvisioningState; +import com.azure.resourcemanager.networkfunction.models.ResourceReference; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Azure Traffic Collector resource. */ +@Fluent +public final class AzureTrafficCollectorInner extends Resource { + /* + * Properties of the Azure Traffic Collector. + */ + @JsonProperty(value = "properties") + private AzureTrafficCollectorPropertiesFormat innerProperties; + + /* + * A unique read-only string that changes whenever the resource is updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Properties of the Azure Traffic Collector. + * + * @return the innerProperties value. + */ + private AzureTrafficCollectorPropertiesFormat innerProperties() { + return this.innerProperties; + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public AzureTrafficCollectorInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureTrafficCollectorInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the collectorPolicies property: Collector Policies for Azure Traffic Collector. + * + * @return the collectorPolicies value. + */ + public List collectorPolicies() { + return this.innerProperties() == null ? null : this.innerProperties().collectorPolicies(); + } + + /** + * Set the collectorPolicies property: Collector Policies for Azure Traffic Collector. + * + * @param collectorPolicies the collectorPolicies value to set. + * @return the AzureTrafficCollectorInner object itself. + */ + public AzureTrafficCollectorInner withCollectorPolicies(List collectorPolicies) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureTrafficCollectorPropertiesFormat(); + } + this.innerProperties().withCollectorPolicies(collectorPolicies); + return this; + } + + /** + * Get the virtualHub property: The virtualHub to which the Azure Traffic Collector belongs. + * + * @return the virtualHub value. + */ + public ResourceReference virtualHub() { + return this.innerProperties() == null ? null : this.innerProperties().virtualHub(); + } + + /** + * Set the virtualHub property: The virtualHub to which the Azure Traffic Collector belongs. + * + * @param virtualHub the virtualHub value to set. + * @return the AzureTrafficCollectorInner object itself. + */ + public AzureTrafficCollectorInner withVirtualHub(ResourceReference virtualHub) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureTrafficCollectorPropertiesFormat(); + } + this.innerProperties().withVirtualHub(virtualHub); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the application rule collection resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/AzureTrafficCollectorPropertiesFormat.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/AzureTrafficCollectorPropertiesFormat.java new file mode 100644 index 000000000000..9c6aec5694db --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/AzureTrafficCollectorPropertiesFormat.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.networkfunction.models.ProvisioningState; +import com.azure.resourcemanager.networkfunction.models.ResourceReference; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Azure Traffic Collector resource properties. */ +@Fluent +public final class AzureTrafficCollectorPropertiesFormat { + /* + * Collector Policies for Azure Traffic Collector. + */ + @JsonProperty(value = "collectorPolicies") + private List collectorPolicies; + + /* + * The virtualHub to which the Azure Traffic Collector belongs. + */ + @JsonProperty(value = "virtualHub") + private ResourceReference virtualHub; + + /* + * The provisioning state of the application rule collection resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the collectorPolicies property: Collector Policies for Azure Traffic Collector. + * + * @return the collectorPolicies value. + */ + public List collectorPolicies() { + return this.collectorPolicies; + } + + /** + * Set the collectorPolicies property: Collector Policies for Azure Traffic Collector. + * + * @param collectorPolicies the collectorPolicies value to set. + * @return the AzureTrafficCollectorPropertiesFormat object itself. + */ + public AzureTrafficCollectorPropertiesFormat withCollectorPolicies(List collectorPolicies) { + this.collectorPolicies = collectorPolicies; + return this; + } + + /** + * Get the virtualHub property: The virtualHub to which the Azure Traffic Collector belongs. + * + * @return the virtualHub value. + */ + public ResourceReference virtualHub() { + return this.virtualHub; + } + + /** + * Set the virtualHub property: The virtualHub to which the Azure Traffic Collector belongs. + * + * @param virtualHub the virtualHub value to set. + * @return the AzureTrafficCollectorPropertiesFormat object itself. + */ + public AzureTrafficCollectorPropertiesFormat withVirtualHub(ResourceReference virtualHub) { + this.virtualHub = virtualHub; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the application rule collection resource. + * + * @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 (collectorPolicies() != null) { + collectorPolicies().forEach(e -> e.validate()); + } + if (virtualHub() != null) { + virtualHub().validate(); + } + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/CollectorPolicyInner.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/CollectorPolicyInner.java new file mode 100644 index 000000000000..a4bfc646ae6f --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/CollectorPolicyInner.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.networkfunction.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.networkfunction.models.EmissionPoliciesPropertiesFormat; +import com.azure.resourcemanager.networkfunction.models.IngestionPolicyPropertiesFormat; +import com.azure.resourcemanager.networkfunction.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Collector policy resource. */ +@Fluent +public final class CollectorPolicyInner extends ProxyResource { + /* + * Properties of the Collector Policy. + */ + @JsonProperty(value = "properties") + private CollectorPolicyPropertiesFormat innerProperties; + + /* + * A unique read-only string that changes whenever the resource is updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Properties of the Collector Policy. + * + * @return the innerProperties value. + */ + private CollectorPolicyPropertiesFormat innerProperties() { + return this.innerProperties; + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the ingestionPolicy property: Ingestion policies. + * + * @return the ingestionPolicy value. + */ + public IngestionPolicyPropertiesFormat ingestionPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().ingestionPolicy(); + } + + /** + * Set the ingestionPolicy property: Ingestion policies. + * + * @param ingestionPolicy the ingestionPolicy value to set. + * @return the CollectorPolicyInner object itself. + */ + public CollectorPolicyInner withIngestionPolicy(IngestionPolicyPropertiesFormat ingestionPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new CollectorPolicyPropertiesFormat(); + } + this.innerProperties().withIngestionPolicy(ingestionPolicy); + return this; + } + + /** + * Get the emissionPolicies property: Emission policies. + * + * @return the emissionPolicies value. + */ + public List emissionPolicies() { + return this.innerProperties() == null ? null : this.innerProperties().emissionPolicies(); + } + + /** + * Set the emissionPolicies property: Emission policies. + * + * @param emissionPolicies the emissionPolicies value to set. + * @return the CollectorPolicyInner object itself. + */ + public CollectorPolicyInner withEmissionPolicies(List emissionPolicies) { + if (this.innerProperties() == null) { + this.innerProperties = new CollectorPolicyPropertiesFormat(); + } + this.innerProperties().withEmissionPolicies(emissionPolicies); + return this; + } + + /** + * Get the provisioningState property: The provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/CollectorPolicyPropertiesFormat.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/CollectorPolicyPropertiesFormat.java new file mode 100644 index 000000000000..c96568da5fe0 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/CollectorPolicyPropertiesFormat.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.networkfunction.models.EmissionPoliciesPropertiesFormat; +import com.azure.resourcemanager.networkfunction.models.IngestionPolicyPropertiesFormat; +import com.azure.resourcemanager.networkfunction.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Collection policy properties. */ +@Fluent +public final class CollectorPolicyPropertiesFormat { + /* + * Ingestion policies. + */ + @JsonProperty(value = "ingestionPolicy") + private IngestionPolicyPropertiesFormat ingestionPolicy; + + /* + * Emission policies. + */ + @JsonProperty(value = "emissionPolicies") + private List emissionPolicies; + + /* + * The provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the ingestionPolicy property: Ingestion policies. + * + * @return the ingestionPolicy value. + */ + public IngestionPolicyPropertiesFormat ingestionPolicy() { + return this.ingestionPolicy; + } + + /** + * Set the ingestionPolicy property: Ingestion policies. + * + * @param ingestionPolicy the ingestionPolicy value to set. + * @return the CollectorPolicyPropertiesFormat object itself. + */ + public CollectorPolicyPropertiesFormat withIngestionPolicy(IngestionPolicyPropertiesFormat ingestionPolicy) { + this.ingestionPolicy = ingestionPolicy; + return this; + } + + /** + * Get the emissionPolicies property: Emission policies. + * + * @return the emissionPolicies value. + */ + public List emissionPolicies() { + return this.emissionPolicies; + } + + /** + * Set the emissionPolicies property: Emission policies. + * + * @param emissionPolicies the emissionPolicies value to set. + * @return the CollectorPolicyPropertiesFormat object itself. + */ + public CollectorPolicyPropertiesFormat withEmissionPolicies( + List emissionPolicies) { + this.emissionPolicies = emissionPolicies; + return this; + } + + /** + * Get the provisioningState property: The provisioning state. + * + * @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 (ingestionPolicy() != null) { + ingestionPolicy().validate(); + } + if (emissionPolicies() != null) { + emissionPolicies().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/OperationInner.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/OperationInner.java new file mode 100644 index 000000000000..4ad869d1fcf0 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/OperationInner.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.networkfunction.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Traffic Collector REST API operation definition. */ +@Fluent +public final class OperationInner { + /* + * Operation name: {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * Origin of the operation + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation is a data action. + * + * @param isDataAction the isDataAction value to set. + * @return the OperationInner object itself. + */ + public OperationInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Display metadata associated with the 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: Origin of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: Origin of the operation. + * + * @param origin the origin value to set. + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/package-info.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/package-info.java new file mode 100644 index 000000000000..91965a56eb65 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/models/package-info.java @@ -0,0 +1,8 @@ +// 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 AzureTrafficCollectorManagementClient. Azure Traffic Collector service. + */ +package com.azure.resourcemanager.networkfunction.fluent.models; diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/package-info.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/package-info.java new file mode 100644 index 000000000000..9907fa28abd8 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/fluent/package-info.java @@ -0,0 +1,8 @@ +// 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 AzureTrafficCollectorManagementClient. Azure Traffic Collector service. + */ +package com.azure.resourcemanager.networkfunction.fluent; diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorImpl.java new file mode 100644 index 000000000000..fefbce6791ba --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.networkfunction.fluent.models.AzureTrafficCollectorInner; +import com.azure.resourcemanager.networkfunction.fluent.models.CollectorPolicyInner; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollector; +import com.azure.resourcemanager.networkfunction.models.CollectorPolicy; +import com.azure.resourcemanager.networkfunction.models.ProvisioningState; +import com.azure.resourcemanager.networkfunction.models.ResourceReference; +import com.azure.resourcemanager.networkfunction.models.TagsObject; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class AzureTrafficCollectorImpl + implements AzureTrafficCollector, AzureTrafficCollector.Definition, AzureTrafficCollector.Update { + private AzureTrafficCollectorInner innerObject; + + private final com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager 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 String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public List collectorPolicies() { + List inner = this.innerModel().collectorPolicies(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new CollectorPolicyImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public ResourceReference virtualHub() { + return this.innerModel().virtualHub(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public AzureTrafficCollectorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String azureTrafficCollectorName; + + private TagsObject updateParameters; + + public AzureTrafficCollectorImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public AzureTrafficCollector create() { + this.innerObject = + serviceManager + .serviceClient() + .getAzureTrafficCollectors() + .createOrUpdate(resourceGroupName, azureTrafficCollectorName, this.innerModel(), Context.NONE); + return this; + } + + public AzureTrafficCollector create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAzureTrafficCollectors() + .createOrUpdate(resourceGroupName, azureTrafficCollectorName, this.innerModel(), context); + return this; + } + + AzureTrafficCollectorImpl( + String name, com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager) { + this.innerObject = new AzureTrafficCollectorInner(); + this.serviceManager = serviceManager; + this.azureTrafficCollectorName = name; + } + + public AzureTrafficCollectorImpl update() { + this.updateParameters = new TagsObject(); + return this; + } + + public AzureTrafficCollector apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAzureTrafficCollectors() + .updateTagsWithResponse(resourceGroupName, azureTrafficCollectorName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public AzureTrafficCollector apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAzureTrafficCollectors() + .updateTagsWithResponse(resourceGroupName, azureTrafficCollectorName, updateParameters, context) + .getValue(); + return this; + } + + AzureTrafficCollectorImpl( + AzureTrafficCollectorInner innerObject, + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.azureTrafficCollectorName = Utils.getValueFromIdByName(innerObject.id(), "azureTrafficCollectors"); + } + + public AzureTrafficCollector refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAzureTrafficCollectors() + .getByResourceGroupWithResponse(resourceGroupName, azureTrafficCollectorName, Context.NONE) + .getValue(); + return this; + } + + public AzureTrafficCollector refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAzureTrafficCollectors() + .getByResourceGroupWithResponse(resourceGroupName, azureTrafficCollectorName, context) + .getValue(); + return this; + } + + public AzureTrafficCollectorImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AzureTrafficCollectorImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AzureTrafficCollectorImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public AzureTrafficCollectorImpl withCollectorPolicies(List collectorPolicies) { + this.innerModel().withCollectorPolicies(collectorPolicies); + return this; + } + + public AzureTrafficCollectorImpl withVirtualHub(ResourceReference virtualHub) { + this.innerModel().withVirtualHub(virtualHub); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorManagementClientBuilder.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorManagementClientBuilder.java new file mode 100644 index 000000000000..f2427264f6f2 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorManagementClientBuilder.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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 AzureTrafficCollectorManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {AzureTrafficCollectorManagementClientImpl.class}) +public final class AzureTrafficCollectorManagementClientBuilder { + /* + * Azure Subscription ID. + */ + private String subscriptionId; + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the AzureTrafficCollectorManagementClientBuilder. + */ + public AzureTrafficCollectorManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AzureTrafficCollectorManagementClientBuilder. + */ + public AzureTrafficCollectorManagementClientBuilder 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 AzureTrafficCollectorManagementClientBuilder. + */ + public AzureTrafficCollectorManagementClientBuilder 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 AzureTrafficCollectorManagementClientBuilder. + */ + public AzureTrafficCollectorManagementClientBuilder 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 AzureTrafficCollectorManagementClientBuilder. + */ + public AzureTrafficCollectorManagementClientBuilder 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 AzureTrafficCollectorManagementClientBuilder. + */ + public AzureTrafficCollectorManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AzureTrafficCollectorManagementClientImpl with the provided parameters. + * + * @return an instance of AzureTrafficCollectorManagementClientImpl. + */ + public AzureTrafficCollectorManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (pipeline == null) { + this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + AzureTrafficCollectorManagementClientImpl client = + new AzureTrafficCollectorManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorManagementClientImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorManagementClientImpl.java new file mode 100644 index 000000000000..925cf71c1a24 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorManagementClientImpl.java @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.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.networkfunction.fluent.AzureTrafficCollectorManagementClient; +import com.azure.resourcemanager.networkfunction.fluent.AzureTrafficCollectorsByResourceGroupsClient; +import com.azure.resourcemanager.networkfunction.fluent.AzureTrafficCollectorsBySubscriptionsClient; +import com.azure.resourcemanager.networkfunction.fluent.AzureTrafficCollectorsClient; +import com.azure.resourcemanager.networkfunction.fluent.CollectorPoliciesClient; +import com.azure.resourcemanager.networkfunction.fluent.NetworkFunctionsClient; +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 java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the AzureTrafficCollectorManagementClientImpl type. */ +@ServiceClient(builder = AzureTrafficCollectorManagementClientBuilder.class) +public final class AzureTrafficCollectorManagementClientImpl implements AzureTrafficCollectorManagementClient { + /** Azure Subscription ID. */ + private final String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @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 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; + } + + /** The AzureTrafficCollectorsBySubscriptionsClient object to access its operations. */ + private final AzureTrafficCollectorsBySubscriptionsClient azureTrafficCollectorsBySubscriptions; + + /** + * Gets the AzureTrafficCollectorsBySubscriptionsClient object to access its operations. + * + * @return the AzureTrafficCollectorsBySubscriptionsClient object. + */ + public AzureTrafficCollectorsBySubscriptionsClient getAzureTrafficCollectorsBySubscriptions() { + return this.azureTrafficCollectorsBySubscriptions; + } + + /** The AzureTrafficCollectorsByResourceGroupsClient object to access its operations. */ + private final AzureTrafficCollectorsByResourceGroupsClient azureTrafficCollectorsByResourceGroups; + + /** + * Gets the AzureTrafficCollectorsByResourceGroupsClient object to access its operations. + * + * @return the AzureTrafficCollectorsByResourceGroupsClient object. + */ + public AzureTrafficCollectorsByResourceGroupsClient getAzureTrafficCollectorsByResourceGroups() { + return this.azureTrafficCollectorsByResourceGroups; + } + + /** The AzureTrafficCollectorsClient object to access its operations. */ + private final AzureTrafficCollectorsClient azureTrafficCollectors; + + /** + * Gets the AzureTrafficCollectorsClient object to access its operations. + * + * @return the AzureTrafficCollectorsClient object. + */ + public AzureTrafficCollectorsClient getAzureTrafficCollectors() { + return this.azureTrafficCollectors; + } + + /** The CollectorPoliciesClient object to access its operations. */ + private final CollectorPoliciesClient collectorPolicies; + + /** + * Gets the CollectorPoliciesClient object to access its operations. + * + * @return the CollectorPoliciesClient object. + */ + public CollectorPoliciesClient getCollectorPolicies() { + return this.collectorPolicies; + } + + /** + * Initializes an instance of AzureTrafficCollectorManagementClient 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 Azure Subscription ID. + * @param endpoint server parameter. + */ + AzureTrafficCollectorManagementClientImpl( + 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 = "2022-05-01"; + this.networkFunctions = new NetworkFunctionsClientImpl(this); + this.azureTrafficCollectorsBySubscriptions = new AzureTrafficCollectorsBySubscriptionsClientImpl(this); + this.azureTrafficCollectorsByResourceGroups = new AzureTrafficCollectorsByResourceGroupsClientImpl(this); + this.azureTrafficCollectors = new AzureTrafficCollectorsClientImpl(this); + this.collectorPolicies = new CollectorPoliciesClientImpl(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) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return 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(AzureTrafficCollectorManagementClientImpl.class); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsByResourceGroupsClientImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsByResourceGroupsClientImpl.java new file mode 100644 index 000000000000..aa603c83ba53 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsByResourceGroupsClientImpl.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.networkfunction.fluent.AzureTrafficCollectorsByResourceGroupsClient; +import com.azure.resourcemanager.networkfunction.fluent.models.AzureTrafficCollectorInner; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollectorListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * AzureTrafficCollectorsByResourceGroupsClient. + */ +public final class AzureTrafficCollectorsByResourceGroupsClientImpl + implements AzureTrafficCollectorsByResourceGroupsClient { + /** The proxy service used to perform REST calls. */ + private final AzureTrafficCollectorsByResourceGroupsService service; + + /** The service client containing this operation class. */ + private final AzureTrafficCollectorManagementClientImpl client; + + /** + * Initializes an instance of AzureTrafficCollectorsByResourceGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AzureTrafficCollectorsByResourceGroupsClientImpl(AzureTrafficCollectorManagementClientImpl client) { + this.service = + RestProxy + .create( + AzureTrafficCollectorsByResourceGroupsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for + * AzureTrafficCollectorManagementClientAzureTrafficCollectorsByResourceGroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureTrafficCollecto") + private interface AzureTrafficCollectorsByResourceGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction" + + "/azureTrafficCollectors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @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); + } + + /** + * Return list of Azure Traffic Collectors in a Resource Group. + * + * @param resourceGroupName The name of the resource group. + * @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 response for the ListTrafficCollectors API service call 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + 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())); + } + + /** + * Return list of Azure Traffic Collectors in a Resource Group. + * + * @param resourceGroupName The name of the resource group. + * @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 response for the ListTrafficCollectors API service call 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Return list of Azure Traffic Collectors in a Resource Group. + * + * @param resourceGroupName The name of the resource group. + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Return list of Azure Traffic Collectors in a Resource Group. + * + * @param resourceGroupName The name of the resource group. + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Return list of Azure Traffic Collectors in a Resource Group. + * + * @param resourceGroupName The name of the resource group. + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Return list of Azure Traffic Collectors in a Resource Group. + * + * @param resourceGroupName The name of the resource group. + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 response for the ListTrafficCollectors API service call 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 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 response for the ListTrafficCollectors API service call 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/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsByResourceGroupsImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsByResourceGroupsImpl.java new file mode 100644 index 000000000000..9c422dee236f --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsByResourceGroupsImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.networkfunction.fluent.AzureTrafficCollectorsByResourceGroupsClient; +import com.azure.resourcemanager.networkfunction.fluent.models.AzureTrafficCollectorInner; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollector; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollectorsByResourceGroups; + +public final class AzureTrafficCollectorsByResourceGroupsImpl implements AzureTrafficCollectorsByResourceGroups { + private static final ClientLogger LOGGER = new ClientLogger(AzureTrafficCollectorsByResourceGroupsImpl.class); + + private final AzureTrafficCollectorsByResourceGroupsClient innerClient; + + private final com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager; + + public AzureTrafficCollectorsByResourceGroupsImpl( + AzureTrafficCollectorsByResourceGroupsClient innerClient, + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AzureTrafficCollectorImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AzureTrafficCollectorImpl(inner1, this.manager())); + } + + private AzureTrafficCollectorsByResourceGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsBySubscriptionsClientImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsBySubscriptionsClientImpl.java new file mode 100644 index 000000000000..e12276bc371d --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsBySubscriptionsClientImpl.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.networkfunction.fluent.AzureTrafficCollectorsBySubscriptionsClient; +import com.azure.resourcemanager.networkfunction.fluent.models.AzureTrafficCollectorInner; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollectorListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * AzureTrafficCollectorsBySubscriptionsClient. + */ +public final class AzureTrafficCollectorsBySubscriptionsClientImpl + implements AzureTrafficCollectorsBySubscriptionsClient { + /** The proxy service used to perform REST calls. */ + private final AzureTrafficCollectorsBySubscriptionsService service; + + /** The service client containing this operation class. */ + private final AzureTrafficCollectorManagementClientImpl client; + + /** + * Initializes an instance of AzureTrafficCollectorsBySubscriptionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AzureTrafficCollectorsBySubscriptionsClientImpl(AzureTrafficCollectorManagementClientImpl client) { + this.service = + RestProxy + .create( + AzureTrafficCollectorsBySubscriptionsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for + * AzureTrafficCollectorManagementClientAzureTrafficCollectorsBySubscriptions to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureTrafficCollecto") + private interface AzureTrafficCollectorsBySubscriptionsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.NetworkFunction/azureTrafficCollectors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @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); + } + + /** + * Return list of Azure Traffic Collectors in a subscription. + * + * @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 response for the ListTrafficCollectors API service call 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.getSubscriptionId(), + 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())); + } + + /** + * Return list of Azure Traffic Collectors in a subscription. + * + * @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 response for the ListTrafficCollectors API service call 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.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Return list of Azure Traffic Collectors in a subscription. + * + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Return list of Azure Traffic Collectors in a subscription. + * + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Return list of Azure Traffic Collectors in a subscription. + * + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Return list of Azure Traffic Collectors in a subscription. + * + * @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 response for the ListTrafficCollectors API service call 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 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 response for the ListTrafficCollectors API service call 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 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 response for the ListTrafficCollectors API service call 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/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsBySubscriptionsImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsBySubscriptionsImpl.java new file mode 100644 index 000000000000..f70489225e6e --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsBySubscriptionsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.networkfunction.fluent.AzureTrafficCollectorsBySubscriptionsClient; +import com.azure.resourcemanager.networkfunction.fluent.models.AzureTrafficCollectorInner; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollector; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollectorsBySubscriptions; + +public final class AzureTrafficCollectorsBySubscriptionsImpl implements AzureTrafficCollectorsBySubscriptions { + private static final ClientLogger LOGGER = new ClientLogger(AzureTrafficCollectorsBySubscriptionsImpl.class); + + private final AzureTrafficCollectorsBySubscriptionsClient innerClient; + + private final com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager; + + public AzureTrafficCollectorsBySubscriptionsImpl( + AzureTrafficCollectorsBySubscriptionsClient innerClient, + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AzureTrafficCollectorImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AzureTrafficCollectorImpl(inner1, this.manager())); + } + + private AzureTrafficCollectorsBySubscriptionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsClientImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsClientImpl.java new file mode 100644 index 000000000000..7407e6562046 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsClientImpl.java @@ -0,0 +1,991 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.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.networkfunction.fluent.AzureTrafficCollectorsClient; +import com.azure.resourcemanager.networkfunction.fluent.models.AzureTrafficCollectorInner; +import com.azure.resourcemanager.networkfunction.models.TagsObject; +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 AzureTrafficCollectorsClient. */ +public final class AzureTrafficCollectorsClientImpl implements AzureTrafficCollectorsClient { + /** The proxy service used to perform REST calls. */ + private final AzureTrafficCollectorsService service; + + /** The service client containing this operation class. */ + private final AzureTrafficCollectorManagementClientImpl client; + + /** + * Initializes an instance of AzureTrafficCollectorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AzureTrafficCollectorsClientImpl(AzureTrafficCollectorManagementClientImpl client) { + this.service = + RestProxy + .create(AzureTrafficCollectorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureTrafficCollectorManagementClientAzureTrafficCollectors to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureTrafficCollecto") + private interface AzureTrafficCollectorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction" + + "/azureTrafficCollectors/{azureTrafficCollectorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("azureTrafficCollectorName") String azureTrafficCollectorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction" + + "/azureTrafficCollectors/{azureTrafficCollectorName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("azureTrafficCollectorName") String azureTrafficCollectorName, + @BodyParam("application/json") AzureTrafficCollectorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction" + + "/azureTrafficCollectors/{azureTrafficCollectorName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("azureTrafficCollectorName") String azureTrafficCollectorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction" + + "/azureTrafficCollectors/{azureTrafficCollectorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateTags( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("azureTrafficCollectorName") String azureTrafficCollectorName, + @BodyParam("application/json") TagsObject parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the specified Azure Traffic Collector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 specified Azure Traffic Collector in a specified resource group along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String azureTrafficCollectorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified Azure Traffic Collector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 specified Azure Traffic Collector in a specified resource group along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String azureTrafficCollectorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + accept, + context); + } + + /** + * Gets the specified Azure Traffic Collector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 specified Azure Traffic Collector in a specified resource group on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String azureTrafficCollectorName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, azureTrafficCollectorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the specified Azure Traffic Collector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 specified Azure Traffic Collector in a specified resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureTrafficCollectorInner getByResourceGroup(String resourceGroupName, String azureTrafficCollectorName) { + return getByResourceGroupAsync(resourceGroupName, azureTrafficCollectorName).block(); + } + + /** + * Gets the specified Azure Traffic Collector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 specified Azure Traffic Collector in a specified resource group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String azureTrafficCollectorName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, azureTrafficCollectorName, context).block(); + } + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String azureTrafficCollectorName, AzureTrafficCollectorInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String azureTrafficCollectorName, + AzureTrafficCollectorInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + parameters, + accept, + context); + } + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureTrafficCollectorInner> beginCreateOrUpdateAsync( + String resourceGroupName, String azureTrafficCollectorName, AzureTrafficCollectorInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, azureTrafficCollectorName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AzureTrafficCollectorInner.class, + AzureTrafficCollectorInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureTrafficCollectorInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String azureTrafficCollectorName, + AzureTrafficCollectorInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, azureTrafficCollectorName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AzureTrafficCollectorInner.class, + AzureTrafficCollectorInner.class, + context); + } + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureTrafficCollectorInner> beginCreateOrUpdate( + String resourceGroupName, String azureTrafficCollectorName, AzureTrafficCollectorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, azureTrafficCollectorName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureTrafficCollectorInner> beginCreateOrUpdate( + String resourceGroupName, + String azureTrafficCollectorName, + AzureTrafficCollectorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, azureTrafficCollectorName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String azureTrafficCollectorName, AzureTrafficCollectorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, azureTrafficCollectorName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String azureTrafficCollectorName, + AzureTrafficCollectorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, azureTrafficCollectorName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureTrafficCollectorInner createOrUpdate( + String resourceGroupName, String azureTrafficCollectorName, AzureTrafficCollectorInner parameters) { + return createOrUpdateAsync(resourceGroupName, azureTrafficCollectorName, parameters).block(); + } + + /** + * Creates or updates a Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters The parameters to provide for the created Azure Traffic Collector. + * @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 azure Traffic Collector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureTrafficCollectorInner createOrUpdate( + String resourceGroupName, + String azureTrafficCollectorName, + AzureTrafficCollectorInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, azureTrafficCollectorName, parameters, context).block(); + } + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 azureTrafficCollectorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 azureTrafficCollectorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + accept, + context); + } + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String azureTrafficCollectorName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, azureTrafficCollectorName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String azureTrafficCollectorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, azureTrafficCollectorName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String azureTrafficCollectorName) { + return beginDeleteAsync(resourceGroupName, azureTrafficCollectorName).getSyncPoller(); + } + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String azureTrafficCollectorName, Context context) { + return beginDeleteAsync(resourceGroupName, azureTrafficCollectorName, context).getSyncPoller(); + } + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 azureTrafficCollectorName) { + return beginDeleteAsync(resourceGroupName, azureTrafficCollectorName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String azureTrafficCollectorName, Context context) { + return beginDeleteAsync(resourceGroupName, azureTrafficCollectorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 azureTrafficCollectorName) { + deleteAsync(resourceGroupName, azureTrafficCollectorName).block(); + } + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String azureTrafficCollectorName, Context context) { + deleteAsync(resourceGroupName, azureTrafficCollectorName, context).block(); + } + + /** + * Updates the specified Azure Traffic Collector tags. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters Parameters supplied to update Azure Traffic Collector tags. + * @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 azure Traffic Collector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateTagsWithResponseAsync( + String resourceGroupName, String azureTrafficCollectorName, TagsObject parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateTags( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the specified Azure Traffic Collector tags. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters Parameters supplied to update Azure Traffic Collector tags. + * @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 azure Traffic Collector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateTagsWithResponseAsync( + String resourceGroupName, String azureTrafficCollectorName, TagsObject parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateTags( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + parameters, + accept, + context); + } + + /** + * Updates the specified Azure Traffic Collector tags. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters Parameters supplied to update Azure Traffic Collector tags. + * @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 azure Traffic Collector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTagsAsync( + String resourceGroupName, String azureTrafficCollectorName, TagsObject parameters) { + return updateTagsWithResponseAsync(resourceGroupName, azureTrafficCollectorName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the specified Azure Traffic Collector tags. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters Parameters supplied to update Azure Traffic Collector tags. + * @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 azure Traffic Collector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureTrafficCollectorInner updateTags( + String resourceGroupName, String azureTrafficCollectorName, TagsObject parameters) { + return updateTagsAsync(resourceGroupName, azureTrafficCollectorName, parameters).block(); + } + + /** + * Updates the specified Azure Traffic Collector tags. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param parameters Parameters supplied to update Azure Traffic Collector tags. + * @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 azure Traffic Collector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateTagsWithResponse( + String resourceGroupName, String azureTrafficCollectorName, TagsObject parameters, Context context) { + return updateTagsWithResponseAsync(resourceGroupName, azureTrafficCollectorName, parameters, context).block(); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsImpl.java new file mode 100644 index 000000000000..8443f8ca76d1 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorsImpl.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.implementation; + +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.networkfunction.fluent.AzureTrafficCollectorsClient; +import com.azure.resourcemanager.networkfunction.fluent.models.AzureTrafficCollectorInner; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollector; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollectors; + +public final class AzureTrafficCollectorsImpl implements AzureTrafficCollectors { + private static final ClientLogger LOGGER = new ClientLogger(AzureTrafficCollectorsImpl.class); + + private final AzureTrafficCollectorsClient innerClient; + + private final com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager; + + public AzureTrafficCollectorsImpl( + AzureTrafficCollectorsClient innerClient, + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public AzureTrafficCollector getByResourceGroup(String resourceGroupName, String azureTrafficCollectorName) { + AzureTrafficCollectorInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, azureTrafficCollectorName); + if (inner != null) { + return new AzureTrafficCollectorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String azureTrafficCollectorName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, azureTrafficCollectorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AzureTrafficCollectorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String azureTrafficCollectorName) { + this.serviceClient().delete(resourceGroupName, azureTrafficCollectorName); + } + + public void delete(String resourceGroupName, String azureTrafficCollectorName, Context context) { + this.serviceClient().delete(resourceGroupName, azureTrafficCollectorName, context); + } + + public AzureTrafficCollector 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 azureTrafficCollectorName = Utils.getValueFromIdByName(id, "azureTrafficCollectors"); + if (azureTrafficCollectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureTrafficCollectors'.", + id))); + } + return this + .getByResourceGroupWithResponse(resourceGroupName, azureTrafficCollectorName, 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 azureTrafficCollectorName = Utils.getValueFromIdByName(id, "azureTrafficCollectors"); + if (azureTrafficCollectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureTrafficCollectors'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, azureTrafficCollectorName, 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 azureTrafficCollectorName = Utils.getValueFromIdByName(id, "azureTrafficCollectors"); + if (azureTrafficCollectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureTrafficCollectors'.", + id))); + } + this.delete(resourceGroupName, azureTrafficCollectorName, Context.NONE); + } + + public void 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 azureTrafficCollectorName = Utils.getValueFromIdByName(id, "azureTrafficCollectors"); + if (azureTrafficCollectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureTrafficCollectors'.", + id))); + } + this.delete(resourceGroupName, azureTrafficCollectorName, context); + } + + private AzureTrafficCollectorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager() { + return this.serviceManager; + } + + public AzureTrafficCollectorImpl define(String name) { + return new AzureTrafficCollectorImpl(name, this.manager()); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/CollectorPoliciesClientImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/CollectorPoliciesClientImpl.java new file mode 100644 index 000000000000..477423558889 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/CollectorPoliciesClientImpl.java @@ -0,0 +1,1177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.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.networkfunction.fluent.CollectorPoliciesClient; +import com.azure.resourcemanager.networkfunction.fluent.models.CollectorPolicyInner; +import com.azure.resourcemanager.networkfunction.models.CollectorPolicyListResult; +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 CollectorPoliciesClient. */ +public final class CollectorPoliciesClientImpl implements CollectorPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final CollectorPoliciesService service; + + /** The service client containing this operation class. */ + private final AzureTrafficCollectorManagementClientImpl client; + + /** + * Initializes an instance of CollectorPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectorPoliciesClientImpl(AzureTrafficCollectorManagementClientImpl client) { + this.service = + RestProxy.create(CollectorPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureTrafficCollectorManagementClientCollectorPolicies to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureTrafficCollecto") + private interface CollectorPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction" + + "/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("azureTrafficCollectorName") String azureTrafficCollectorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction" + + "/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies/{collectorPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("azureTrafficCollectorName") String azureTrafficCollectorName, + @PathParam("collectorPolicyName") String collectorPolicyName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction" + + "/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies/{collectorPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("azureTrafficCollectorName") String azureTrafficCollectorName, + @PathParam("collectorPolicyName") String collectorPolicyName, + @BodyParam("application/json") CollectorPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction" + + "/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies/{collectorPolicyName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("azureTrafficCollectorName") String azureTrafficCollectorName, + @PathParam("collectorPolicyName") String collectorPolicyName, + @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); + } + + /** + * Return list of Collector policies in a Azure Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 response for the ListCollectorPolicies API service call along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String azureTrafficCollectorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + 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())); + } + + /** + * Return list of Collector policies in a Azure Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 response for the ListCollectorPolicies API service call along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String azureTrafficCollectorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Return list of Collector policies in a Azure Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 response for the ListCollectorPolicies API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String azureTrafficCollectorName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, azureTrafficCollectorName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Return list of Collector policies in a Azure Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 response for the ListCollectorPolicies API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String azureTrafficCollectorName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, azureTrafficCollectorName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Return list of Collector policies in a Azure Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 response for the ListCollectorPolicies API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String azureTrafficCollectorName) { + return new PagedIterable<>(listAsync(resourceGroupName, azureTrafficCollectorName)); + } + + /** + * Return list of Collector policies in a Azure Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 response for the ListCollectorPolicies API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String azureTrafficCollectorName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, azureTrafficCollectorName, context)); + } + + /** + * Gets the collector policy in a specified Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 collector policy in a specified Traffic Collector along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + if (collectorPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter collectorPolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + collectorPolicyName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the collector policy in a specified Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 collector policy in a specified Traffic Collector along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + if (collectorPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter collectorPolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + collectorPolicyName, + accept, + context); + } + + /** + * Gets the collector policy in a specified Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 collector policy in a specified Traffic Collector on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName) { + return getWithResponseAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the collector policy in a specified Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 collector policy in a specified Traffic Collector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectorPolicyInner get( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName) { + return getAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName).block(); + } + + /** + * Gets the collector policy in a specified Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 collector policy in a specified Traffic Collector along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, context).block(); + } + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + if (collectorPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter collectorPolicyName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + collectorPolicyName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + if (collectorPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter collectorPolicyName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + collectorPolicyName, + parameters, + accept, + context); + } + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CollectorPolicyInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, azureTrafficCollectorName, collectorPolicyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CollectorPolicyInner.class, + CollectorPolicyInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CollectorPolicyInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, azureTrafficCollectorName, collectorPolicyName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CollectorPolicyInner.class, CollectorPolicyInner.class, context); + } + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CollectorPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CollectorPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, azureTrafficCollectorName, collectorPolicyName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, azureTrafficCollectorName, collectorPolicyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectorPolicyInner createOrUpdate( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, parameters) + .block(); + } + + /** + * Creates or updates a Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @param parameters The parameters to provide for the created Collector Policy. + * @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 collector policy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectorPolicyInner createOrUpdate( + String resourceGroupName, + String azureTrafficCollectorName, + String collectorPolicyName, + CollectorPolicyInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, azureTrafficCollectorName, collectorPolicyName, parameters, context) + .block(); + } + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 azureTrafficCollectorName, String collectorPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + if (collectorPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter collectorPolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + collectorPolicyName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 azureTrafficCollectorName, String collectorPolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (azureTrafficCollectorName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureTrafficCollectorName is required and cannot be null.")); + } + if (collectorPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter collectorPolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + azureTrafficCollectorName, + collectorPolicyName, + accept, + context); + } + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName) { + return beginDeleteAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName).getSyncPoller(); + } + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName, Context context) { + return beginDeleteAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, context) + .getSyncPoller(); + } + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 azureTrafficCollectorName, String collectorPolicyName) { + return beginDeleteAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName, Context context) { + return beginDeleteAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 azureTrafficCollectorName, String collectorPolicyName) { + deleteAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName).block(); + } + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName, Context context) { + deleteAsync(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 response for the ListCollectorPolicies API service call 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 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 response for the ListCollectorPolicies API service call 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/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/CollectorPoliciesImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/CollectorPoliciesImpl.java new file mode 100644 index 000000000000..003aed806f27 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/CollectorPoliciesImpl.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.networkfunction.fluent.CollectorPoliciesClient; +import com.azure.resourcemanager.networkfunction.fluent.models.CollectorPolicyInner; +import com.azure.resourcemanager.networkfunction.models.CollectorPolicies; +import com.azure.resourcemanager.networkfunction.models.CollectorPolicy; + +public final class CollectorPoliciesImpl implements CollectorPolicies { + private static final ClientLogger LOGGER = new ClientLogger(CollectorPoliciesImpl.class); + + private final CollectorPoliciesClient innerClient; + + private final com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager; + + public CollectorPoliciesImpl( + CollectorPoliciesClient innerClient, + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String azureTrafficCollectorName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, azureTrafficCollectorName); + return Utils.mapPage(inner, inner1 -> new CollectorPolicyImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String azureTrafficCollectorName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, azureTrafficCollectorName, context); + return Utils.mapPage(inner, inner1 -> new CollectorPolicyImpl(inner1, this.manager())); + } + + public CollectorPolicy get(String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName) { + CollectorPolicyInner inner = + this.serviceClient().get(resourceGroupName, azureTrafficCollectorName, collectorPolicyName); + if (inner != null) { + return new CollectorPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CollectorPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName) { + this.serviceClient().delete(resourceGroupName, azureTrafficCollectorName, collectorPolicyName); + } + + public void delete( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName, Context context) { + this.serviceClient().delete(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, context); + } + + public CollectorPolicy 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 azureTrafficCollectorName = Utils.getValueFromIdByName(id, "azureTrafficCollectors"); + if (azureTrafficCollectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureTrafficCollectors'.", + id))); + } + String collectorPolicyName = Utils.getValueFromIdByName(id, "collectorPolicies"); + if (collectorPolicyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'collectorPolicies'.", id))); + } + return this + .getWithResponse(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, 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 azureTrafficCollectorName = Utils.getValueFromIdByName(id, "azureTrafficCollectors"); + if (azureTrafficCollectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureTrafficCollectors'.", + id))); + } + String collectorPolicyName = Utils.getValueFromIdByName(id, "collectorPolicies"); + if (collectorPolicyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'collectorPolicies'.", id))); + } + return this.getWithResponse(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, 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 azureTrafficCollectorName = Utils.getValueFromIdByName(id, "azureTrafficCollectors"); + if (azureTrafficCollectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureTrafficCollectors'.", + id))); + } + String collectorPolicyName = Utils.getValueFromIdByName(id, "collectorPolicies"); + if (collectorPolicyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'collectorPolicies'.", id))); + } + this.delete(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, Context.NONE); + } + + public void 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 azureTrafficCollectorName = Utils.getValueFromIdByName(id, "azureTrafficCollectors"); + if (azureTrafficCollectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureTrafficCollectors'.", + id))); + } + String collectorPolicyName = Utils.getValueFromIdByName(id, "collectorPolicies"); + if (collectorPolicyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'collectorPolicies'.", id))); + } + this.delete(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, context); + } + + private CollectorPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager() { + return this.serviceManager; + } + + public CollectorPolicyImpl define(String name) { + return new CollectorPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/CollectorPolicyImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/CollectorPolicyImpl.java new file mode 100644 index 000000000000..001187f89a03 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/CollectorPolicyImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.networkfunction.fluent.models.CollectorPolicyInner; +import com.azure.resourcemanager.networkfunction.models.CollectorPolicy; +import com.azure.resourcemanager.networkfunction.models.EmissionPoliciesPropertiesFormat; +import com.azure.resourcemanager.networkfunction.models.IngestionPolicyPropertiesFormat; +import com.azure.resourcemanager.networkfunction.models.ProvisioningState; +import java.util.Collections; +import java.util.List; + +public final class CollectorPolicyImpl implements CollectorPolicy, CollectorPolicy.Definition, CollectorPolicy.Update { + private CollectorPolicyInner innerObject; + + private final com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public IngestionPolicyPropertiesFormat ingestionPolicy() { + return this.innerModel().ingestionPolicy(); + } + + public List emissionPolicies() { + List inner = this.innerModel().emissionPolicies(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public CollectorPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String azureTrafficCollectorName; + + private String collectorPolicyName; + + public CollectorPolicyImpl withExistingAzureTrafficCollector( + String resourceGroupName, String azureTrafficCollectorName) { + this.resourceGroupName = resourceGroupName; + this.azureTrafficCollectorName = azureTrafficCollectorName; + return this; + } + + public CollectorPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getCollectorPolicies() + .createOrUpdate( + resourceGroupName, azureTrafficCollectorName, collectorPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public CollectorPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCollectorPolicies() + .createOrUpdate( + resourceGroupName, azureTrafficCollectorName, collectorPolicyName, this.innerModel(), context); + return this; + } + + CollectorPolicyImpl( + String name, com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager) { + this.innerObject = new CollectorPolicyInner(); + this.serviceManager = serviceManager; + this.collectorPolicyName = name; + } + + public CollectorPolicyImpl update() { + return this; + } + + public CollectorPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCollectorPolicies() + .createOrUpdate( + resourceGroupName, azureTrafficCollectorName, collectorPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public CollectorPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCollectorPolicies() + .createOrUpdate( + resourceGroupName, azureTrafficCollectorName, collectorPolicyName, this.innerModel(), context); + return this; + } + + CollectorPolicyImpl( + CollectorPolicyInner innerObject, + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.azureTrafficCollectorName = Utils.getValueFromIdByName(innerObject.id(), "azureTrafficCollectors"); + this.collectorPolicyName = Utils.getValueFromIdByName(innerObject.id(), "collectorPolicies"); + } + + public CollectorPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCollectorPolicies() + .getWithResponse(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, Context.NONE) + .getValue(); + return this; + } + + public CollectorPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCollectorPolicies() + .getWithResponse(resourceGroupName, azureTrafficCollectorName, collectorPolicyName, context) + .getValue(); + return this; + } + + public CollectorPolicyImpl withIngestionPolicy(IngestionPolicyPropertiesFormat ingestionPolicy) { + this.innerModel().withIngestionPolicy(ingestionPolicy); + return this; + } + + public CollectorPolicyImpl withEmissionPolicies(List emissionPolicies) { + this.innerModel().withEmissionPolicies(emissionPolicies); + return this; + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/NetworkFunctionsClientImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/NetworkFunctionsClientImpl.java new file mode 100644 index 000000000000..9fb54979539f --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/NetworkFunctionsClientImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.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.networkfunction.fluent.NetworkFunctionsClient; +import com.azure.resourcemanager.networkfunction.fluent.models.OperationInner; +import com.azure.resourcemanager.networkfunction.models.OperationListResult; +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 AzureTrafficCollectorManagementClientImpl client; + + /** + * Initializes an instance of NetworkFunctionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NetworkFunctionsClientImpl(AzureTrafficCollectorManagementClientImpl client) { + this.service = + RestProxy.create(NetworkFunctionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureTrafficCollectorManagementClientNetworkFunctions to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureTrafficCollecto") + private interface NetworkFunctionsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.NetworkFunction/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listOperations( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available NetworkFunction Rest API operations. + * + * @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 result of the request to list Azure Traffic Collector operations along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsSinglePageAsync() { + 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.listOperations(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available NetworkFunction Rest API operations. + * + * @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 result of the request to list Azure Traffic Collector operations along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsSinglePageAsync(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 + .listOperations(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists all of the available NetworkFunction Rest API operations. + * + * @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 result of the request to list Azure Traffic Collector operations as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOperationsAsync() { + return new PagedFlux<>(() -> listOperationsSinglePageAsync()); + } + + /** + * Lists all of the available NetworkFunction Rest API operations. + * + * @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 result of the request to list Azure Traffic Collector operations as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOperationsAsync(Context context) { + return new PagedFlux<>(() -> listOperationsSinglePageAsync(context)); + } + + /** + * Lists all of the available NetworkFunction Rest API operations. + * + * @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 result of the request to list Azure Traffic Collector operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperations() { + return new PagedIterable<>(listOperationsAsync()); + } + + /** + * Lists all of the available NetworkFunction Rest API operations. + * + * @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 result of the request to list Azure Traffic Collector operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperations(Context context) { + return new PagedIterable<>(listOperationsAsync(context)); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/NetworkFunctionsImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/NetworkFunctionsImpl.java new file mode 100644 index 000000000000..977ff8ef9488 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/NetworkFunctionsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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.networkfunction.fluent.NetworkFunctionsClient; +import com.azure.resourcemanager.networkfunction.fluent.models.OperationInner; +import com.azure.resourcemanager.networkfunction.models.NetworkFunctions; +import com.azure.resourcemanager.networkfunction.models.Operation; + +public final class NetworkFunctionsImpl implements NetworkFunctions { + private static final ClientLogger LOGGER = new ClientLogger(NetworkFunctionsImpl.class); + + private final NetworkFunctionsClient innerClient; + + private final com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager; + + public NetworkFunctionsImpl( + NetworkFunctionsClient innerClient, + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listOperations() { + PagedIterable inner = this.serviceClient().listOperations(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable listOperations(Context context) { + PagedIterable inner = this.serviceClient().listOperations(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private NetworkFunctionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/OperationImpl.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/OperationImpl.java new file mode 100644 index 000000000000..6f7e1b68b390 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/OperationImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.implementation; + +import com.azure.resourcemanager.networkfunction.fluent.models.OperationInner; +import com.azure.resourcemanager.networkfunction.models.Operation; +import com.azure.resourcemanager.networkfunction.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager serviceManager; + + OperationImpl( + OperationInner innerObject, + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager 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 String origin() { + return this.innerModel().origin(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/Utils.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/Utils.java new file mode 100644 index 000000000000..7f76784e29f0 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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 { + 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.size() > 0 && 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, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + 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/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/package-info.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/package-info.java new file mode 100644 index 000000000000..363e0900cd77 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/package-info.java @@ -0,0 +1,8 @@ +// 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 AzureTrafficCollectorManagementClient. Azure Traffic Collector service. + */ +package com.azure.resourcemanager.networkfunction.implementation; diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollector.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollector.java new file mode 100644 index 000000000000..3c7077d73903 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollector.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.networkfunction.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.networkfunction.fluent.models.AzureTrafficCollectorInner; +import com.azure.resourcemanager.networkfunction.fluent.models.CollectorPolicyInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of AzureTrafficCollector. */ +public interface AzureTrafficCollector { + /** + * 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 etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the collectorPolicies property: Collector Policies for Azure Traffic Collector. + * + * @return the collectorPolicies value. + */ + List collectorPolicies(); + + /** + * Gets the virtualHub property: The virtualHub to which the Azure Traffic Collector belongs. + * + * @return the virtualHub value. + */ + ResourceReference virtualHub(); + + /** + * Gets the provisioningState property: The provisioning state of the application rule collection resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * 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 inner com.azure.resourcemanager.networkfunction.fluent.models.AzureTrafficCollectorInner object. + * + * @return the inner object. + */ + AzureTrafficCollectorInner innerModel(); + + /** The entirety of the AzureTrafficCollector definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The AzureTrafficCollector definition stages. */ + interface DefinitionStages { + /** The first stage of the AzureTrafficCollector definition. */ + interface Blank extends WithLocation { + } + /** The stage of the AzureTrafficCollector 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 AzureTrafficCollector definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the AzureTrafficCollector 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.WithCollectorPolicies, DefinitionStages.WithVirtualHub { + /** + * Executes the create request. + * + * @return the created resource. + */ + AzureTrafficCollector create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AzureTrafficCollector create(Context context); + } + /** The stage of the AzureTrafficCollector 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 AzureTrafficCollector definition allowing to specify collectorPolicies. */ + interface WithCollectorPolicies { + /** + * Specifies the collectorPolicies property: Collector Policies for Azure Traffic Collector.. + * + * @param collectorPolicies Collector Policies for Azure Traffic Collector. + * @return the next definition stage. + */ + WithCreate withCollectorPolicies(List collectorPolicies); + } + /** The stage of the AzureTrafficCollector definition allowing to specify virtualHub. */ + interface WithVirtualHub { + /** + * Specifies the virtualHub property: The virtualHub to which the Azure Traffic Collector belongs.. + * + * @param virtualHub The virtualHub to which the Azure Traffic Collector belongs. + * @return the next definition stage. + */ + WithCreate withVirtualHub(ResourceReference virtualHub); + } + } + /** + * Begins update for the AzureTrafficCollector resource. + * + * @return the stage of resource update. + */ + AzureTrafficCollector.Update update(); + + /** The template for AzureTrafficCollector update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AzureTrafficCollector apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AzureTrafficCollector apply(Context context); + } + /** The AzureTrafficCollector update stages. */ + interface UpdateStages { + /** The stage of the AzureTrafficCollector 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. + */ + AzureTrafficCollector refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AzureTrafficCollector refresh(Context context); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollectorListResult.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollectorListResult.java new file mode 100644 index 000000000000..b7f7cfcbd3f9 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollectorListResult.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.networkfunction.fluent.models.AzureTrafficCollectorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response for the ListTrafficCollectors API service call. */ +@Fluent +public final class AzureTrafficCollectorListResult { + /* + * A list of Traffic Collector resources. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to get the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: A list of Traffic Collector resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of Traffic Collector resources. + * + * @param value the value value to set. + * @return the AzureTrafficCollectorListResult object itself. + */ + public AzureTrafficCollectorListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to get the next set of results. + * + * @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/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollectors.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollectors.java new file mode 100644 index 000000000000..83db78da94ad --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollectors.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AzureTrafficCollectors. */ +public interface AzureTrafficCollectors { + /** + * Gets the specified Azure Traffic Collector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 specified Azure Traffic Collector in a specified resource group. + */ + AzureTrafficCollector getByResourceGroup(String resourceGroupName, String azureTrafficCollectorName); + + /** + * Gets the specified Azure Traffic Collector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 specified Azure Traffic Collector in a specified resource group along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String azureTrafficCollectorName, Context context); + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 azureTrafficCollectorName); + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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. + */ + void delete(String resourceGroupName, String azureTrafficCollectorName, Context context); + + /** + * Gets the specified Azure Traffic Collector in a specified resource group. + * + * @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 the specified Azure Traffic Collector in a specified resource group along with {@link Response}. + */ + AzureTrafficCollector getById(String id); + + /** + * Gets the specified Azure Traffic Collector in a specified resource group. + * + * @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 specified Azure Traffic Collector in a specified resource group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @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); + + /** + * Deletes a specified Azure Traffic Collector resource. + * + * @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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AzureTrafficCollector resource. + * + * @param name resource name. + * @return the first stage of the new AzureTrafficCollector definition. + */ + AzureTrafficCollector.DefinitionStages.Blank define(String name); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollectorsByResourceGroups.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollectorsByResourceGroups.java new file mode 100644 index 000000000000..a11e8953e0f7 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollectorsByResourceGroups.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of AzureTrafficCollectorsByResourceGroups. */ +public interface AzureTrafficCollectorsByResourceGroups { + /** + * Return list of Azure Traffic Collectors in a Resource Group. + * + * @param resourceGroupName The name of the resource group. + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Return list of Azure Traffic Collectors in a Resource Group. + * + * @param resourceGroupName The name of the resource group. + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollectorsBySubscriptions.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollectorsBySubscriptions.java new file mode 100644 index 000000000000..3d7c0a0f0ce6 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/AzureTrafficCollectorsBySubscriptions.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of AzureTrafficCollectorsBySubscriptions. */ +public interface AzureTrafficCollectorsBySubscriptions { + /** + * Return list of Azure Traffic Collectors in a subscription. + * + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Return list of Azure Traffic Collectors in a subscription. + * + * @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 response for the ListTrafficCollectors API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/CollectorPolicies.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/CollectorPolicies.java new file mode 100644 index 000000000000..43df4379a745 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/CollectorPolicies.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.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 CollectorPolicies. */ +public interface CollectorPolicies { + /** + * Return list of Collector policies in a Azure Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 response for the ListCollectorPolicies API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String azureTrafficCollectorName); + + /** + * Return list of Collector policies in a Azure Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @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 response for the ListCollectorPolicies API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String azureTrafficCollectorName, Context context); + + /** + * Gets the collector policy in a specified Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 collector policy in a specified Traffic Collector. + */ + CollectorPolicy get(String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName); + + /** + * Gets the collector policy in a specified Traffic Collector. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 collector policy in a specified Traffic Collector along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName, Context context); + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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 delete(String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName); + + /** + * Deletes a specified Collector Policy resource. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @param collectorPolicyName Collector Policy Name. + * @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. + */ + void delete( + String resourceGroupName, String azureTrafficCollectorName, String collectorPolicyName, Context context); + + /** + * Gets the collector policy in a specified Traffic Collector. + * + * @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 the collector policy in a specified Traffic Collector along with {@link Response}. + */ + CollectorPolicy getById(String id); + + /** + * Gets the collector policy in a specified Traffic Collector. + * + * @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 collector policy in a specified Traffic Collector along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a specified Collector Policy resource. + * + * @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); + + /** + * Deletes a specified Collector Policy resource. + * + * @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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CollectorPolicy resource. + * + * @param name resource name. + * @return the first stage of the new CollectorPolicy definition. + */ + CollectorPolicy.DefinitionStages.Blank define(String name); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/CollectorPolicy.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/CollectorPolicy.java new file mode 100644 index 000000000000..6895e6c7081a --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/CollectorPolicy.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.networkfunction.fluent.models.CollectorPolicyInner; +import java.util.List; + +/** An immutable client-side representation of CollectorPolicy. */ +public interface CollectorPolicy { + /** + * 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 etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the ingestionPolicy property: Ingestion policies. + * + * @return the ingestionPolicy value. + */ + IngestionPolicyPropertiesFormat ingestionPolicy(); + + /** + * Gets the emissionPolicies property: Emission policies. + * + * @return the emissionPolicies value. + */ + List emissionPolicies(); + + /** + * Gets the provisioningState property: The provisioning state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.networkfunction.fluent.models.CollectorPolicyInner object. + * + * @return the inner object. + */ + CollectorPolicyInner innerModel(); + + /** The entirety of the CollectorPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The CollectorPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the CollectorPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the CollectorPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, azureTrafficCollectorName. + * + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name. + * @return the next definition stage. + */ + WithCreate withExistingAzureTrafficCollector(String resourceGroupName, String azureTrafficCollectorName); + } + /** + * The stage of the CollectorPolicy 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.WithIngestionPolicy, DefinitionStages.WithEmissionPolicies { + /** + * Executes the create request. + * + * @return the created resource. + */ + CollectorPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CollectorPolicy create(Context context); + } + /** The stage of the CollectorPolicy definition allowing to specify ingestionPolicy. */ + interface WithIngestionPolicy { + /** + * Specifies the ingestionPolicy property: Ingestion policies.. + * + * @param ingestionPolicy Ingestion policies. + * @return the next definition stage. + */ + WithCreate withIngestionPolicy(IngestionPolicyPropertiesFormat ingestionPolicy); + } + /** The stage of the CollectorPolicy definition allowing to specify emissionPolicies. */ + interface WithEmissionPolicies { + /** + * Specifies the emissionPolicies property: Emission policies.. + * + * @param emissionPolicies Emission policies. + * @return the next definition stage. + */ + WithCreate withEmissionPolicies(List emissionPolicies); + } + } + /** + * Begins update for the CollectorPolicy resource. + * + * @return the stage of resource update. + */ + CollectorPolicy.Update update(); + + /** The template for CollectorPolicy update. */ + interface Update extends UpdateStages.WithIngestionPolicy, UpdateStages.WithEmissionPolicies { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CollectorPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CollectorPolicy apply(Context context); + } + /** The CollectorPolicy update stages. */ + interface UpdateStages { + /** The stage of the CollectorPolicy update allowing to specify ingestionPolicy. */ + interface WithIngestionPolicy { + /** + * Specifies the ingestionPolicy property: Ingestion policies.. + * + * @param ingestionPolicy Ingestion policies. + * @return the next definition stage. + */ + Update withIngestionPolicy(IngestionPolicyPropertiesFormat ingestionPolicy); + } + /** The stage of the CollectorPolicy update allowing to specify emissionPolicies. */ + interface WithEmissionPolicies { + /** + * Specifies the emissionPolicies property: Emission policies.. + * + * @param emissionPolicies Emission policies. + * @return the next definition stage. + */ + Update withEmissionPolicies(List emissionPolicies); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CollectorPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CollectorPolicy refresh(Context context); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/CollectorPolicyListResult.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/CollectorPolicyListResult.java new file mode 100644 index 000000000000..e172754cce45 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/CollectorPolicyListResult.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.networkfunction.fluent.models.CollectorPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response for the ListCollectorPolicies API service call. */ +@Fluent +public final class CollectorPolicyListResult { + /* + * A list of collection policies. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to get the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: A list of collection policies. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of collection policies. + * + * @param value the value value to set. + * @return the CollectorPolicyListResult object itself. + */ + public CollectorPolicyListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to get the next set of results. + * + * @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/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/DestinationType.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/DestinationType.java new file mode 100644 index 000000000000..5b05d2afb323 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/DestinationType.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.networkfunction.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DestinationType. */ +public final class DestinationType extends ExpandableStringEnum { + /** Static value AzureMonitor for DestinationType. */ + public static final DestinationType AZURE_MONITOR = fromString("AzureMonitor"); + + /** + * Creates or finds a DestinationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DestinationType. + */ + @JsonCreator + public static DestinationType fromString(String name) { + return fromString(name, DestinationType.class); + } + + /** + * Gets known DestinationType values. + * + * @return known DestinationType values. + */ + public static Collection values() { + return values(DestinationType.class); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/EmissionPoliciesPropertiesFormat.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/EmissionPoliciesPropertiesFormat.java new file mode 100644 index 000000000000..8d79d2407ef6 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/EmissionPoliciesPropertiesFormat.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Emission policy properties. */ +@Fluent +public final class EmissionPoliciesPropertiesFormat { + /* + * Emission format type. + */ + @JsonProperty(value = "emissionType") + private EmissionType emissionType; + + /* + * Emission policy destinations. + */ + @JsonProperty(value = "emissionDestinations") + private List emissionDestinations; + + /** + * Get the emissionType property: Emission format type. + * + * @return the emissionType value. + */ + public EmissionType emissionType() { + return this.emissionType; + } + + /** + * Set the emissionType property: Emission format type. + * + * @param emissionType the emissionType value to set. + * @return the EmissionPoliciesPropertiesFormat object itself. + */ + public EmissionPoliciesPropertiesFormat withEmissionType(EmissionType emissionType) { + this.emissionType = emissionType; + return this; + } + + /** + * Get the emissionDestinations property: Emission policy destinations. + * + * @return the emissionDestinations value. + */ + public List emissionDestinations() { + return this.emissionDestinations; + } + + /** + * Set the emissionDestinations property: Emission policy destinations. + * + * @param emissionDestinations the emissionDestinations value to set. + * @return the EmissionPoliciesPropertiesFormat object itself. + */ + public EmissionPoliciesPropertiesFormat withEmissionDestinations( + List emissionDestinations) { + this.emissionDestinations = emissionDestinations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (emissionDestinations() != null) { + emissionDestinations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/EmissionPolicyDestination.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/EmissionPolicyDestination.java new file mode 100644 index 000000000000..3da75a7838fc --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/EmissionPolicyDestination.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Emission policy destination properties. */ +@Fluent +public final class EmissionPolicyDestination { + /* + * Emission destination type. + */ + @JsonProperty(value = "destinationType") + private DestinationType destinationType; + + /** + * Get the destinationType property: Emission destination type. + * + * @return the destinationType value. + */ + public DestinationType destinationType() { + return this.destinationType; + } + + /** + * Set the destinationType property: Emission destination type. + * + * @param destinationType the destinationType value to set. + * @return the EmissionPolicyDestination object itself. + */ + public EmissionPolicyDestination withDestinationType(DestinationType destinationType) { + this.destinationType = destinationType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/EmissionType.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/EmissionType.java new file mode 100644 index 000000000000..e447c41d24b8 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/EmissionType.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.networkfunction.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EmissionType. */ +public final class EmissionType extends ExpandableStringEnum { + /** Static value IPFIX for EmissionType. */ + public static final EmissionType IPFIX = fromString("IPFIX"); + + /** + * Creates or finds a EmissionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EmissionType. + */ + @JsonCreator + public static EmissionType fromString(String name) { + return fromString(name, EmissionType.class); + } + + /** + * Gets known EmissionType values. + * + * @return known EmissionType values. + */ + public static Collection values() { + return values(EmissionType.class); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/IngestionPolicyPropertiesFormat.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/IngestionPolicyPropertiesFormat.java new file mode 100644 index 000000000000..04e8758c75cc --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/IngestionPolicyPropertiesFormat.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Ingestion Policy properties. */ +@Fluent +public final class IngestionPolicyPropertiesFormat { + /* + * The ingestion type. + */ + @JsonProperty(value = "ingestionType") + private IngestionType ingestionType; + + /* + * Ingestion Sources. + */ + @JsonProperty(value = "ingestionSources") + private List ingestionSources; + + /** + * Get the ingestionType property: The ingestion type. + * + * @return the ingestionType value. + */ + public IngestionType ingestionType() { + return this.ingestionType; + } + + /** + * Set the ingestionType property: The ingestion type. + * + * @param ingestionType the ingestionType value to set. + * @return the IngestionPolicyPropertiesFormat object itself. + */ + public IngestionPolicyPropertiesFormat withIngestionType(IngestionType ingestionType) { + this.ingestionType = ingestionType; + return this; + } + + /** + * Get the ingestionSources property: Ingestion Sources. + * + * @return the ingestionSources value. + */ + public List ingestionSources() { + return this.ingestionSources; + } + + /** + * Set the ingestionSources property: Ingestion Sources. + * + * @param ingestionSources the ingestionSources value to set. + * @return the IngestionPolicyPropertiesFormat object itself. + */ + public IngestionPolicyPropertiesFormat withIngestionSources( + List ingestionSources) { + this.ingestionSources = ingestionSources; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ingestionSources() != null) { + ingestionSources().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/IngestionSourcesPropertiesFormat.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/IngestionSourcesPropertiesFormat.java new file mode 100644 index 000000000000..fe78cf32135f --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/IngestionSourcesPropertiesFormat.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Ingestion policy properties. */ +@Fluent +public final class IngestionSourcesPropertiesFormat { + /* + * Ingestion source type. + */ + @JsonProperty(value = "sourceType") + private SourceType sourceType; + + /* + * Resource ID. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * Get the sourceType property: Ingestion source type. + * + * @return the sourceType value. + */ + public SourceType sourceType() { + return this.sourceType; + } + + /** + * Set the sourceType property: Ingestion source type. + * + * @param sourceType the sourceType value to set. + * @return the IngestionSourcesPropertiesFormat object itself. + */ + public IngestionSourcesPropertiesFormat withSourceType(SourceType sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Get the resourceId property: Resource ID. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Resource ID. + * + * @param resourceId the resourceId value to set. + * @return the IngestionSourcesPropertiesFormat object itself. + */ + public IngestionSourcesPropertiesFormat withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/IngestionType.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/IngestionType.java new file mode 100644 index 000000000000..904adde5c738 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/IngestionType.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.networkfunction.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IngestionType. */ +public final class IngestionType extends ExpandableStringEnum { + /** Static value IPFIX for IngestionType. */ + public static final IngestionType IPFIX = fromString("IPFIX"); + + /** + * Creates or finds a IngestionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding IngestionType. + */ + @JsonCreator + public static IngestionType fromString(String name) { + return fromString(name, IngestionType.class); + } + + /** + * Gets known IngestionType values. + * + * @return known IngestionType values. + */ + public static Collection values() { + return values(IngestionType.class); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/NetworkFunctions.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/NetworkFunctions.java new file mode 100644 index 000000000000..f1691948308b --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/NetworkFunctions.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of NetworkFunctions. */ +public interface NetworkFunctions { + /** + * Lists all of the available NetworkFunction Rest API operations. + * + * @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 result of the request to list Azure Traffic Collector operations as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listOperations(); + + /** + * Lists all of the available NetworkFunction Rest API operations. + * + * @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 result of the request to list Azure Traffic Collector operations as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listOperations(Context context); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/Operation.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/Operation.java new file mode 100644 index 000000000000..1ba78b59da93 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/Operation.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.networkfunction.models; + +import com.azure.resourcemanager.networkfunction.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: Origin of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the inner com.azure.resourcemanager.networkfunction.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/OperationDisplay.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/OperationDisplay.java new file mode 100644 index 000000000000..28cf58f8c6be --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/OperationDisplay.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Fluent +public final class OperationDisplay { + /* + * Service provider: Microsoft NetworkFunction. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource on which the operation is performed etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Type of operation: get, read, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Service provider: Microsoft NetworkFunction. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider: Microsoft NetworkFunction. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed etc. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed etc. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Type of operation: get, read, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Type of operation: get, read, delete, etc. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the operation. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/OperationListResult.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/OperationListResult.java new file mode 100644 index 000000000000..034bffee3f5e --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/OperationListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.networkfunction.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list Azure Traffic Collector operations. It contains a list of operations and a URL link to + * get the next set of results. + */ +@Fluent +public final class OperationListResult { + /* + * List of operations supported by the Azure Traffic Collector resource + * provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of operations supported by the Azure Traffic Collector resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by the Azure Traffic Collector resource provider. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * 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; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult 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) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/ProvisioningState.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/ProvisioningState.java new file mode 100644 index 000000000000..4c2880303825 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/ProvisioningState.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** 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 Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * 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/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/ResourceReference.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/ResourceReference.java new file mode 100644 index 000000000000..7cb7edb4221e --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/ResourceReference.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.networkfunction.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource reference properties. */ +@Immutable +public final class ResourceReference { + /* + * Resource ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get the id property: Resource ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/SourceType.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/SourceType.java new file mode 100644 index 000000000000..99b730664438 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/SourceType.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.networkfunction.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SourceType. */ +public final class SourceType extends ExpandableStringEnum { + /** Static value Resource for SourceType. */ + public static final SourceType RESOURCE = fromString("Resource"); + + /** + * Creates or finds a SourceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SourceType. + */ + @JsonCreator + public static SourceType fromString(String name) { + return fromString(name, SourceType.class); + } + + /** + * Gets known SourceType values. + * + * @return known SourceType values. + */ + public static Collection values() { + return values(SourceType.class); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/TagsObject.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/TagsObject.java new file mode 100644 index 000000000000..31a0ee2c41db --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/TagsObject.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Tags object for patch operations. */ +@Fluent +public final class TagsObject { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * 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 TagsObject object itself. + */ + public TagsObject 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/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/package-info.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/package-info.java new file mode 100644 index 000000000000..958a8f13ec3a --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/models/package-info.java @@ -0,0 +1,6 @@ +// 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 AzureTrafficCollectorManagementClient. Azure Traffic Collector service. */ +package com.azure.resourcemanager.networkfunction.models; diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/package-info.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/package-info.java new file mode 100644 index 000000000000..f04da510b88c --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/package-info.java @@ -0,0 +1,6 @@ +// 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 AzureTrafficCollectorManagementClient. Azure Traffic Collector service. */ +package com.azure.resourcemanager.networkfunction; diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/module-info.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/module-info.java new file mode 100644 index 000000000000..ad45169d897e --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.networkfunction { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.networkfunction; + exports com.azure.resourcemanager.networkfunction.fluent; + exports com.azure.resourcemanager.networkfunction.fluent.models; + exports com.azure.resourcemanager.networkfunction.models; + + opens com.azure.resourcemanager.networkfunction.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.networkfunction.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsByResourceGroupListByResourceGroupSamples.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsByResourceGroupListByResourceGroupSamples.java new file mode 100644 index 000000000000..a6a38c070c94 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsByResourceGroupListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.generated; + +import com.azure.core.util.Context; + +/** Samples for AzureTrafficCollectorsByResourceGroup ListByResourceGroup. */ +public final class AzureTrafficCollectorsByResourceGroupListByResourceGroupSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorsByResourceGroupList.json + */ + /** + * Sample code: List of Traffic Collectors by ResourceGroup. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void listOfTrafficCollectorsByResourceGroup( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.azureTrafficCollectorsByResourceGroups().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsBySubscriptionListSamples.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsBySubscriptionListSamples.java new file mode 100644 index 000000000000..42b35a567938 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsBySubscriptionListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.generated; + +import com.azure.core.util.Context; + +/** Samples for AzureTrafficCollectorsBySubscription List. */ +public final class AzureTrafficCollectorsBySubscriptionListSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorsBySubscriptionList.json + */ + /** + * Sample code: List of Traffic Collectors by Subscription. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void listOfTrafficCollectorsBySubscription( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.azureTrafficCollectorsBySubscriptions().list(Context.NONE); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsCreateOrUpdateSamples.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..dc0dcff0d82e --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsCreateOrUpdateSamples.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.networkfunction.generated; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AzureTrafficCollectors CreateOrUpdate. */ +public final class AzureTrafficCollectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorCreate.json + */ + /** + * Sample code: Create a traffic collector. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void createATrafficCollector( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager + .azureTrafficCollectors() + .define("atc") + .withRegion("West US") + .withExistingResourceGroup("rg1") + .withTags(mapOf("key1", "value1")) + .withCollectorPolicies(Arrays.asList()) + .create(); + } + + @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/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsDeleteSamples.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsDeleteSamples.java new file mode 100644 index 000000000000..42f06e34f344 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.generated; + +import com.azure.core.util.Context; + +/** Samples for AzureTrafficCollectors Delete. */ +public final class AzureTrafficCollectorsDeleteSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorDelete.json + */ + /** + * Sample code: Delete Traffic Collector. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void deleteTrafficCollector( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.azureTrafficCollectors().delete("rg1", "atc", Context.NONE); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsGetByResourceGroupSamples.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..c9246189c9e0 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.generated; + +import com.azure.core.util.Context; + +/** Samples for AzureTrafficCollectors GetByResourceGroup. */ +public final class AzureTrafficCollectorsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorGet.json + */ + /** + * Sample code: Get Traffic Collector. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void getTrafficCollector( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.azureTrafficCollectors().getByResourceGroupWithResponse("rg1", "atc", Context.NONE); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsUpdateTagsSamples.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsUpdateTagsSamples.java new file mode 100644 index 000000000000..57052a47460d --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/AzureTrafficCollectorsUpdateTagsSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.networkfunction.models.AzureTrafficCollector; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AzureTrafficCollectors UpdateTags. */ +public final class AzureTrafficCollectorsUpdateTagsSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/AzureTrafficCollectorUpdateTags.json + */ + /** + * Sample code: Update Traffic Collector tags. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void updateTrafficCollectorTags( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + AzureTrafficCollector resource = + manager.azureTrafficCollectors().getByResourceGroupWithResponse("rg1", "atc", Context.NONE).getValue(); + resource.update().withTags(mapOf("key1", "value1", "key2", "value2")).apply(); + } + + @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/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/CollectorPoliciesCreateOrUpdateSamples.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/CollectorPoliciesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..9bbb75a421e9 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/CollectorPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.generated; + +import com.azure.resourcemanager.networkfunction.models.DestinationType; +import com.azure.resourcemanager.networkfunction.models.EmissionPoliciesPropertiesFormat; +import com.azure.resourcemanager.networkfunction.models.EmissionPolicyDestination; +import com.azure.resourcemanager.networkfunction.models.EmissionType; +import com.azure.resourcemanager.networkfunction.models.IngestionPolicyPropertiesFormat; +import com.azure.resourcemanager.networkfunction.models.IngestionSourcesPropertiesFormat; +import com.azure.resourcemanager.networkfunction.models.IngestionType; +import com.azure.resourcemanager.networkfunction.models.SourceType; +import java.util.Arrays; + +/** Samples for CollectorPolicies CreateOrUpdate. */ +public final class CollectorPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/CollectorPolicyCreate.json + */ + /** + * Sample code: Create a collection policy. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void createACollectionPolicy( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager + .collectorPolicies() + .define("cp1") + .withExistingAzureTrafficCollector("rg1", "atc") + .withIngestionPolicy( + new IngestionPolicyPropertiesFormat() + .withIngestionType(IngestionType.IPFIX) + .withIngestionSources( + Arrays + .asList( + new IngestionSourcesPropertiesFormat() + .withSourceType(SourceType.RESOURCE) + .withResourceId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName")))) + .withEmissionPolicies( + Arrays + .asList( + new EmissionPoliciesPropertiesFormat() + .withEmissionType(EmissionType.IPFIX) + .withEmissionDestinations( + Arrays + .asList( + new EmissionPolicyDestination() + .withDestinationType(DestinationType.AZURE_MONITOR))))) + .create(); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/CollectorPoliciesDeleteSamples.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/CollectorPoliciesDeleteSamples.java new file mode 100644 index 000000000000..c9c27bbd46e5 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/CollectorPoliciesDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.generated; + +import com.azure.core.util.Context; + +/** Samples for CollectorPolicies Delete. */ +public final class CollectorPoliciesDeleteSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/CollectorPolicyDelete.json + */ + /** + * Sample code: Delete Collection Policy. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void deleteCollectionPolicy( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.collectorPolicies().delete("rg1", "atc", "cp1", Context.NONE); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/CollectorPoliciesGetSamples.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/CollectorPoliciesGetSamples.java new file mode 100644 index 000000000000..3490267b9a1f --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/CollectorPoliciesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.generated; + +import com.azure.core.util.Context; + +/** Samples for CollectorPolicies Get. */ +public final class CollectorPoliciesGetSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/CollectorPolicyGet.json + */ + /** + * Sample code: Get Collection Policy. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void getCollectionPolicy( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.collectorPolicies().getWithResponse("rg1", "atc", "cp1", Context.NONE); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/CollectorPoliciesListSamples.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/CollectorPoliciesListSamples.java new file mode 100644 index 000000000000..25bb0f08bdb2 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/CollectorPoliciesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.generated; + +import com.azure.core.util.Context; + +/** Samples for CollectorPolicies List. */ +public final class CollectorPoliciesListSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/CollectorPoliciesList.json + */ + /** + * Sample code: List of Collection Policies. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void listOfCollectionPolicies( + com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.collectorPolicies().list("rg1", "atc", Context.NONE); + } +} diff --git a/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/NetworkFunctionListOperationsSamples.java b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/NetworkFunctionListOperationsSamples.java new file mode 100644 index 000000000000..5cfba2430de7 --- /dev/null +++ b/sdk/networkfunction/azure-resourcemanager-networkfunction/src/samples/java/com/azure/resourcemanager/networkfunction/generated/NetworkFunctionListOperationsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.networkfunction.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkFunction ListOperations. */ +public final class NetworkFunctionListOperationsSamples { + /* + * x-ms-original-file: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-05-01/examples/OperationsList.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to AzureTrafficCollectorManager. + */ + public static void operationsList(com.azure.resourcemanager.networkfunction.AzureTrafficCollectorManager manager) { + manager.networkFunctions().listOperations(Context.NONE); + } +} diff --git a/sdk/networkfunction/ci.yml b/sdk/networkfunction/ci.yml new file mode 100644 index 000000000000..72c365a92d69 --- /dev/null +++ b/sdk/networkfunction/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/networkfunction/ci.yml + - sdk/networkfunction/azure-resourcemanager-networkfunction/ + exclude: + - sdk/networkfunction/pom.xml + - sdk/networkfunction/azure-resourcemanager-networkfunction/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/networkfunction/ci.yml + - sdk/networkfunction/azure-resourcemanager-networkfunction/ + exclude: + - sdk/networkfunction/pom.xml + - sdk/networkfunction/azure-resourcemanager-networkfunction/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: networkfunction + Artifacts: + - name: azure-resourcemanager-networkfunction + groupId: com.azure.resourcemanager + safeName: azureresourcemanagernetworkfunction diff --git a/sdk/networkfunction/pom.xml b/sdk/networkfunction/pom.xml new file mode 100644 index 000000000000..abd6e81ef109 --- /dev/null +++ b/sdk/networkfunction/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-networkfunction-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-networkfunction + + + +