diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b04d701dd93c..3b58b972ebec 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -477,6 +477,7 @@ com.azure.resourcemanager:azure-resourcemanager-carbonoptimization;1.0.0-beta.1; com.azure.resourcemanager:azure-resourcemanager-dependencymap;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-portalservicescopilot;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-lambdatesthyperexecute;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-dfp;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.1;2.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 59226c65adf6..7fa94d8e916c 100644 --- a/pom.xml +++ b/pom.xml @@ -86,6 +86,7 @@ sdk/devopsinfrastructure sdk/devspaces sdk/devtestlabs + sdk/dfp sdk/digitaltwins sdk/dnsresolver sdk/documentintelligence diff --git a/sdk/dfp/azure-resourcemanager-dfp/CHANGELOG.md b/sdk/dfp/azure-resourcemanager-dfp/CHANGELOG.md new file mode 100644 index 000000000000..9485e510f1c8 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-04-30) + +- Azure Resource Manager Dfp client library for Java. This package contains Microsoft Azure SDK for Dfp Management SDK. DFP Web API provides a RESTful set of web services that enables users to create, retrieve, update, and delete DFP instances. Package tag package-2021-02-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-dfp Java SDK. diff --git a/sdk/dfp/azure-resourcemanager-dfp/README.md b/sdk/dfp/azure-resourcemanager-dfp/README.md new file mode 100644 index 000000000000..095eddce1a80 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Dfp client library for Java + +Azure Resource Manager Dfp client library for Java. + +This package contains Microsoft Azure SDK for Dfp Management SDK. DFP Web API provides a RESTful set of web services that enables users to create, retrieve, update, and delete DFP instances. Package tag package-2021-02-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-dfp;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-dfp + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +DfpManager manager = DfpManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` 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/dfp/azure-resourcemanager-dfp/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/dfp/azure-resourcemanager-dfp/SAMPLE.md b/sdk/dfp/azure-resourcemanager-dfp/SAMPLE.md new file mode 100644 index 000000000000..82247a5f77a5 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/SAMPLE.md @@ -0,0 +1,256 @@ +# Code snippets and samples + + +## Instances + +- [CheckNameAvailability](#instances_checknameavailability) +- [Create](#instances_create) +- [Delete](#instances_delete) +- [GetByResourceGroup](#instances_getbyresourcegroup) +- [List](#instances_list) +- [ListByResourceGroup](#instances_listbyresourcegroup) +- [Update](#instances_update) + +## ResourceProvider + +- [ListOperations](#resourceprovider_listoperations) +### Instances_CheckNameAvailability + +```java +/** + * Samples for Instances List. + */ +public final class InstancesListSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * listInstancesInSubscription.json + */ + /** + * Sample code: Get details of a instance. + * + * @param manager Entry point to DfpManager. + */ + public static void getDetailsOfAInstance(com.azure.resourcemanager.dfp.DfpManager manager) { + manager.instances().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Instances_Create + +```java +import com.azure.resourcemanager.dfp.models.DfpInstanceAdministrators; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Instances Create. + */ +public final class InstancesCreateSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * createInstance.json + */ + /** + * Sample code: Create instance. + * + * @param manager Entry point to DfpManager. + */ + public static void createInstance(com.azure.resourcemanager.dfp.DfpManager manager) { + manager.instances() + .define("azsdktest") + .withRegion("West US") + .withExistingResourceGroup("TestRG") + .withTags(mapOf("testKey", "fakeTokenPlaceholder")) + .withAdministration(new DfpInstanceAdministrators() + .withMembers(Arrays.asList("azsdktest@microsoft.com", "azsdktest2@microsoft.com"))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Instances_Delete + +```java +/** + * Samples for Instances GetByResourceGroup. + */ +public final class InstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * getInstance.json + */ + /** + * Sample code: Get details of an instance. + * + * @param manager Entry point to DfpManager. + */ + public static void getDetailsOfAnInstance(com.azure.resourcemanager.dfp.DfpManager manager) { + manager.instances().getByResourceGroupWithResponse("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} +``` + +### Instances_GetByResourceGroup + +```java +import com.azure.resourcemanager.dfp.models.CheckInstanceNameAvailabilityParameters; + +/** + * Samples for Instances CheckNameAvailability. + */ +public final class InstancesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * checkNameAvailability.json + */ + /** + * Sample code: Check name availability of an instance. + * + * @param manager Entry point to DfpManager. + */ + public static void checkNameAvailabilityOfAnInstance(com.azure.resourcemanager.dfp.DfpManager manager) { + manager.instances() + .checkNameAvailabilityWithResponse("West US", + new CheckInstanceNameAvailabilityParameters().withName("azsdktest") + .withType("Microsoft.Dynamics365Fraudprotection/instances"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Instances_List + +```java +/** + * Samples for Instances Delete. + */ +public final class InstancesDeleteSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * deleteInstance.json + */ + /** + * Sample code: Get details of an instance. + * + * @param manager Entry point to DfpManager. + */ + public static void getDetailsOfAnInstance(com.azure.resourcemanager.dfp.DfpManager manager) { + manager.instances().delete("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} +``` + +### Instances_ListByResourceGroup + +```java +/** + * Samples for ResourceProvider ListOperations. + */ +public final class ResourceProviderListOperationsSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * ListOperations.json + */ + /** + * Sample code: Get a list of operations supported by Microsoft.Dynamics365FraudProtection resource provider. + * + * @param manager Entry point to DfpManager. + */ + public static void getAListOfOperationsSupportedByMicrosoftDynamics365FraudProtectionResourceProvider( + com.azure.resourcemanager.dfp.DfpManager manager) { + manager.resourceProviders().listOperations(com.azure.core.util.Context.NONE); + } +} +``` + +### Instances_Update + +```java +/** + * Samples for Instances ListByResourceGroup. + */ +public final class InstancesListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * listInstancesInResourceGroup.json + */ + /** + * Sample code: List DFP instances in resource group. + * + * @param manager Entry point to DfpManager. + */ + public static void listDFPInstancesInResourceGroup(com.azure.resourcemanager.dfp.DfpManager manager) { + manager.instances().listByResourceGroup("TestRG", com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_ListOperations + +```java +import com.azure.resourcemanager.dfp.models.DfpInstance; +import com.azure.resourcemanager.dfp.models.DfpInstanceAdministrators; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Instances Update. + */ +public final class InstancesUpdateSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * updateInstance.json + */ + /** + * Sample code: Update instance parameters. + * + * @param manager Entry point to DfpManager. + */ + public static void updateInstanceParameters(com.azure.resourcemanager.dfp.DfpManager manager) { + DfpInstance resource = manager.instances() + .getByResourceGroupWithResponse("TestRG", "azsdktest", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testKey", "fakeTokenPlaceholder")) + .withAdministration(new DfpInstanceAdministrators() + .withMembers(Arrays.asList("azsdktest@microsoft.com", "azsdktest2@microsoft.com"))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + diff --git a/sdk/dfp/azure-resourcemanager-dfp/pom.xml b/sdk/dfp/azure-resourcemanager-dfp/pom.xml new file mode 100644 index 000000000000..f8cff7658ff8 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-dfp + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Dfp Management + This package contains Microsoft Azure SDK for Dfp Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. DFP Web API provides a RESTful set of web services that enables users to create, retrieve, update, and delete DFP instances. Package tag package-2021-02-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/DfpManager.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/DfpManager.java new file mode 100644 index 000000000000..29fb2df2ba66 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/DfpManager.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp; + +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.BearerTokenAuthenticationPolicy; +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.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.dfp.fluent.Dfp; +import com.azure.resourcemanager.dfp.implementation.DfpBuilder; +import com.azure.resourcemanager.dfp.implementation.InstancesImpl; +import com.azure.resourcemanager.dfp.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.dfp.models.Instances; +import com.azure.resourcemanager.dfp.models.ResourceProviders; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to DfpManager. + * DFP Web API provides a RESTful set of web services that enables users to create, retrieve, update, and delete DFP + * instances. + */ +public final class DfpManager { + private Instances instances; + + private ResourceProviders resourceProviders; + + private final Dfp clientObject; + + private DfpManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new DfpBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Dfp service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Dfp service API instance. + */ + public static DfpManager 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 Dfp service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Dfp service API instance. + */ + public static DfpManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new DfpManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create DfpManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new DfpManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-dfp.properties"); + + 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 Dfp service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Dfp service API instance. + */ + public DfpManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.dfp") + .append("/") + .append(clientVersion); + 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 BearerTokenAuthenticationPolicy(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 DfpManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Instances. It manages DfpInstance. + * + * @return Resource collection API of Instances. + */ + public Instances instances() { + if (this.instances == null) { + this.instances = new InstancesImpl(clientObject.getInstances(), this); + } + return instances; + } + + /** + * Gets the resource collection API of ResourceProviders. + * + * @return Resource collection API of ResourceProviders. + */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** + * Gets wrapped service client Dfp providing direct access to the underlying auto-generated API implementation, + * based on Azure REST API. + * + * @return Wrapped service client Dfp. + */ + public Dfp serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/Dfp.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/Dfp.java new file mode 100644 index 000000000000..f37e6a9bc779 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/Dfp.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for Dfp class. + */ +public interface Dfp { + /** + * Gets A unique identifier for a Microsoft Azure subscription. The subscription ID forms part of the URI for every + * service call. + * + * @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 InstancesClient object to access its operations. + * + * @return the InstancesClient object. + */ + InstancesClient getInstances(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/InstancesClient.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/InstancesClient.java new file mode 100644 index 000000000000..1e4c1ea0814e --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/InstancesClient.java @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.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.dfp.fluent.models.CheckInstanceNameAvailabilityResultInner; +import com.azure.resourcemanager.dfp.fluent.models.DfpInstanceInner; +import com.azure.resourcemanager.dfp.models.CheckInstanceNameAvailabilityParameters; +import com.azure.resourcemanager.dfp.models.DfpInstanceUpdateParameters; + +/** + * An instance of this class provides access to all the operations defined in InstancesClient. + */ +public interface InstancesClient { + /** + * Gets details about the specified instances. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the instance. It must be a minimum of 3 characters, and a maximum of 63. + * @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 details about the specified instances along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String instanceName, + Context context); + + /** + * Gets details about the specified instances. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the instance. It must be a minimum of 3 characters, and a maximum of 63. + * @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 details about the specified instances. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DfpInstanceInner getByResourceGroup(String resourceGroupName, String instanceName); + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DfpInstanceInner> beginCreate(String resourceGroupName, + String instanceName, DfpInstanceInner instanceParameters); + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DfpInstanceInner> beginCreate(String resourceGroupName, + String instanceName, DfpInstanceInner instanceParameters, Context context); + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DfpInstanceInner create(String resourceGroupName, String instanceName, DfpInstanceInner instanceParameters); + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DfpInstanceInner create(String resourceGroupName, String instanceName, DfpInstanceInner instanceParameters, + Context context); + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName); + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName, Context context); + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName); + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName, Context context); + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DfpInstanceInner> beginUpdate(String resourceGroupName, + String instanceName, DfpInstanceUpdateParameters instanceUpdateParameters); + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DfpInstanceInner> beginUpdate(String resourceGroupName, + String instanceName, DfpInstanceUpdateParameters instanceUpdateParameters, Context context); + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DfpInstanceInner update(String resourceGroupName, String instanceName, + DfpInstanceUpdateParameters instanceUpdateParameters); + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DfpInstanceInner update(String resourceGroupName, String instanceName, + DfpInstanceUpdateParameters instanceUpdateParameters, Context context); + + /** + * Gets all the Dedicated instance for the given resource group. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @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 all the Dedicated instance for the given resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all the Dedicated instance for the given resource group. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @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 all the Dedicated instance for the given resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the Dedicated instances for the given 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 an array of DFP instance resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the Dedicated instances for the given 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 an array of DFP instance resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Check the name availability in the target location. + * + * @param location The region name which the operation will lookup into. + * @param instanceParameters The name of the instance. + * @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 checking result of DFP instance name availability along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse(String location, + CheckInstanceNameAvailabilityParameters instanceParameters, Context context); + + /** + * Check the name availability in the target location. + * + * @param location The region name which the operation will lookup into. + * @param instanceParameters The name of the instance. + * @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 checking result of DFP instance name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckInstanceNameAvailabilityResultInner checkNameAvailability(String location, + CheckInstanceNameAvailabilityParameters instanceParameters); +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/ResourceProvidersClient.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/ResourceProvidersClient.java new file mode 100644 index 000000000000..f69da355835e --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/ResourceProvidersClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.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.dfp.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in ResourceProvidersClient. + */ +public interface ResourceProvidersClient { + /** + * Lists all of the available DFP 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOperations(); + + /** + * Lists all of the available DFP 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOperations(Context context); +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/CheckInstanceNameAvailabilityResultInner.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/CheckInstanceNameAvailabilityResultInner.java new file mode 100644 index 000000000000..ed5776b434d3 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/CheckInstanceNameAvailabilityResultInner.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The checking result of DFP instance name availability. + */ +@Fluent +public final class CheckInstanceNameAvailabilityResultInner + implements JsonSerializable { + /* + * Indicator of availability of the DFP instance name. + */ + private Boolean nameAvailable; + + /* + * The reason of unavailability. + */ + private String reason; + + /* + * The detailed message of the request unavailability. + */ + private String message; + + /** + * Creates an instance of CheckInstanceNameAvailabilityResultInner class. + */ + public CheckInstanceNameAvailabilityResultInner() { + } + + /** + * Get the nameAvailable property: Indicator of availability of the DFP instance name. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Indicator of availability of the DFP instance name. + * + * @param nameAvailable the nameAvailable value to set. + * @return the CheckInstanceNameAvailabilityResultInner object itself. + */ + public CheckInstanceNameAvailabilityResultInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: The reason of unavailability. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason of unavailability. + * + * @param reason the reason value to set. + * @return the CheckInstanceNameAvailabilityResultInner object itself. + */ + public CheckInstanceNameAvailabilityResultInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: The detailed message of the request unavailability. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The detailed message of the request unavailability. + * + * @param message the message value to set. + * @return the CheckInstanceNameAvailabilityResultInner object itself. + */ + public CheckInstanceNameAvailabilityResultInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("nameAvailable", this.nameAvailable); + jsonWriter.writeStringField("reason", this.reason); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckInstanceNameAvailabilityResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckInstanceNameAvailabilityResultInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CheckInstanceNameAvailabilityResultInner. + */ + public static CheckInstanceNameAvailabilityResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckInstanceNameAvailabilityResultInner deserializedCheckInstanceNameAvailabilityResultInner + = new CheckInstanceNameAvailabilityResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nameAvailable".equals(fieldName)) { + deserializedCheckInstanceNameAvailabilityResultInner.nameAvailable + = reader.getNullable(JsonReader::getBoolean); + } else if ("reason".equals(fieldName)) { + deserializedCheckInstanceNameAvailabilityResultInner.reason = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedCheckInstanceNameAvailabilityResultInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckInstanceNameAvailabilityResultInner; + }); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/DfpInstanceInner.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/DfpInstanceInner.java new file mode 100644 index 000000000000..692cfce6bf0e --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/DfpInstanceInner.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.dfp.models.DfpInstanceAdministrators; +import com.azure.resourcemanager.dfp.models.ProvisioningState; +import java.io.IOException; +import java.util.Map; + +/** + * Represents an instance of a DFP instance resource. + */ +@Fluent +public final class DfpInstanceInner extends ProxyResource { + /* + * Properties of the provision operation request. + */ + private DfpInstanceProperties innerProperties; + + /* + * Location of the DFP resource. + */ + private String location; + + /* + * Key-value pairs of additional resource provisioning properties. + */ + private Map tags; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DfpInstanceInner class. + */ + public DfpInstanceInner() { + } + + /** + * Get the innerProperties property: Properties of the provision operation request. + * + * @return the innerProperties value. + */ + private DfpInstanceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the location property: Location of the DFP resource. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location of the DFP resource. + * + * @param location the location value to set. + * @return the DfpInstanceInner object itself. + */ + public DfpInstanceInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Key-value pairs of additional resource provisioning properties. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Key-value pairs of additional resource provisioning properties. + * + * @param tags the tags value to set. + * @return the DfpInstanceInner object itself. + */ + public DfpInstanceInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * 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 type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the provisioningState property: The current deployment state of DFP resource. The provisioningState is to + * indicate states for resource provisioning. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the administration property: A collection of DFP instance administrators. + * + * @return the administration value. + */ + public DfpInstanceAdministrators administration() { + return this.innerProperties() == null ? null : this.innerProperties().administration(); + } + + /** + * Set the administration property: A collection of DFP instance administrators. + * + * @param administration the administration value to set. + * @return the DfpInstanceInner object itself. + */ + public DfpInstanceInner withAdministration(DfpInstanceAdministrators administration) { + if (this.innerProperties() == null) { + this.innerProperties = new DfpInstanceProperties(); + } + this.innerProperties().withAdministration(administration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (location() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property location in model DfpInstanceInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DfpInstanceInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DfpInstanceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DfpInstanceInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DfpInstanceInner. + */ + public static DfpInstanceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DfpInstanceInner deserializedDfpInstanceInner = new DfpInstanceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDfpInstanceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDfpInstanceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDfpInstanceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDfpInstanceInner.location = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDfpInstanceInner.innerProperties = DfpInstanceProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDfpInstanceInner.tags = tags; + } else if ("systemData".equals(fieldName)) { + deserializedDfpInstanceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDfpInstanceInner; + }); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/DfpInstanceMutableProperties.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/DfpInstanceMutableProperties.java new file mode 100644 index 000000000000..c87009733edf --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/DfpInstanceMutableProperties.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.dfp.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.dfp.models.DfpInstanceAdministrators; +import java.io.IOException; + +/** + * An object that represents a set of mutable DFP resource properties. + */ +@Fluent +public class DfpInstanceMutableProperties implements JsonSerializable { + /* + * A collection of DFP instance administrators + */ + private DfpInstanceAdministrators administration; + + /** + * Creates an instance of DfpInstanceMutableProperties class. + */ + public DfpInstanceMutableProperties() { + } + + /** + * Get the administration property: A collection of DFP instance administrators. + * + * @return the administration value. + */ + public DfpInstanceAdministrators administration() { + return this.administration; + } + + /** + * Set the administration property: A collection of DFP instance administrators. + * + * @param administration the administration value to set. + * @return the DfpInstanceMutableProperties object itself. + */ + public DfpInstanceMutableProperties withAdministration(DfpInstanceAdministrators administration) { + this.administration = administration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (administration() != null) { + administration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("administration", this.administration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DfpInstanceMutableProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DfpInstanceMutableProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DfpInstanceMutableProperties. + */ + public static DfpInstanceMutableProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DfpInstanceMutableProperties deserializedDfpInstanceMutableProperties = new DfpInstanceMutableProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("administration".equals(fieldName)) { + deserializedDfpInstanceMutableProperties.administration + = DfpInstanceAdministrators.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDfpInstanceMutableProperties; + }); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/DfpInstanceProperties.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/DfpInstanceProperties.java new file mode 100644 index 000000000000..5335c0284ccf --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/DfpInstanceProperties.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.dfp.models.DfpInstanceAdministrators; +import com.azure.resourcemanager.dfp.models.ProvisioningState; +import java.io.IOException; + +/** + * Properties of DFP resource. + */ +@Fluent +public final class DfpInstanceProperties extends DfpInstanceMutableProperties { + /* + * The current deployment state of DFP resource. The provisioningState is to indicate states for resource + * provisioning. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of DfpInstanceProperties class. + */ + public DfpInstanceProperties() { + } + + /** + * Get the provisioningState property: The current deployment state of DFP resource. The provisioningState is to + * indicate states for resource provisioning. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public DfpInstanceProperties withAdministration(DfpInstanceAdministrators administration) { + super.withAdministration(administration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (administration() != null) { + administration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("administration", administration()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DfpInstanceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DfpInstanceProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DfpInstanceProperties. + */ + public static DfpInstanceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DfpInstanceProperties deserializedDfpInstanceProperties = new DfpInstanceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("administration".equals(fieldName)) { + deserializedDfpInstanceProperties.withAdministration(DfpInstanceAdministrators.fromJson(reader)); + } else if ("provisioningState".equals(fieldName)) { + deserializedDfpInstanceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDfpInstanceProperties; + }); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/OperationInner.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/OperationInner.java new file mode 100644 index 000000000000..4612572ae427 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/OperationInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.dfp.models.ActionType; +import com.azure.resourcemanager.dfp.models.OperationDisplay; +import com.azure.resourcemanager.dfp.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/package-info.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/package-info.java new file mode 100644 index 000000000000..4d868d755cec --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/package-info.java @@ -0,0 +1,10 @@ +// 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 Dfp. + * DFP Web API provides a RESTful set of web services that enables users to create, retrieve, update, and delete DFP + * instances. + */ +package com.azure.resourcemanager.dfp.fluent.models; diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/package-info.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/package-info.java new file mode 100644 index 000000000000..9d84f0b1095a --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/package-info.java @@ -0,0 +1,10 @@ +// 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 Dfp. + * DFP Web API provides a RESTful set of web services that enables users to create, retrieve, update, and delete DFP + * instances. + */ +package com.azure.resourcemanager.dfp.fluent; diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/CheckInstanceNameAvailabilityResultImpl.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/CheckInstanceNameAvailabilityResultImpl.java new file mode 100644 index 000000000000..34bb98c1c963 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/CheckInstanceNameAvailabilityResultImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.implementation; + +import com.azure.resourcemanager.dfp.fluent.models.CheckInstanceNameAvailabilityResultInner; +import com.azure.resourcemanager.dfp.models.CheckInstanceNameAvailabilityResult; + +public final class CheckInstanceNameAvailabilityResultImpl implements CheckInstanceNameAvailabilityResult { + private CheckInstanceNameAvailabilityResultInner innerObject; + + private final com.azure.resourcemanager.dfp.DfpManager serviceManager; + + CheckInstanceNameAvailabilityResultImpl(CheckInstanceNameAvailabilityResultInner innerObject, + com.azure.resourcemanager.dfp.DfpManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckInstanceNameAvailabilityResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dfp.DfpManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/DfpBuilder.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/DfpBuilder.java new file mode 100644 index 000000000000..79add4353f11 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/DfpBuilder.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.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 DfpImpl type. + */ +@ServiceClientBuilder(serviceClients = { DfpImpl.class }) +public final class DfpBuilder { + /* + * A unique identifier for a Microsoft Azure subscription. The subscription ID forms part of the URI for every + * service call. + */ + private String subscriptionId; + + /** + * Sets A unique identifier for a Microsoft Azure subscription. The subscription ID forms part of the URI for every + * service call. + * + * @param subscriptionId the subscriptionId value. + * @return the DfpBuilder. + */ + public DfpBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the DfpBuilder. + */ + public DfpBuilder 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 DfpBuilder. + */ + public DfpBuilder 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 DfpBuilder. + */ + public DfpBuilder 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 DfpBuilder. + */ + public DfpBuilder 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 DfpBuilder. + */ + public DfpBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of DfpImpl with the provided parameters. + * + * @return an instance of DfpImpl. + */ + public DfpImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + DfpImpl client = new DfpImpl(localPipeline, localSerializerAdapter, localDefaultPollInterval, localEnvironment, + this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/DfpImpl.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/DfpImpl.java new file mode 100644 index 000000000000..fcd9be6f8eb0 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/DfpImpl.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.dfp.fluent.Dfp; +import com.azure.resourcemanager.dfp.fluent.InstancesClient; +import com.azure.resourcemanager.dfp.fluent.ResourceProvidersClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the DfpImpl type. + */ +@ServiceClient(builder = DfpBuilder.class) +public final class DfpImpl implements Dfp { + /** + * A unique identifier for a Microsoft Azure subscription. The subscription ID forms part of the URI for every + * service call. + */ + private final String subscriptionId; + + /** + * Gets A unique identifier for a Microsoft Azure subscription. The subscription ID forms part of the URI for every + * service call. + * + * @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 InstancesClient object to access its operations. + */ + private final InstancesClient instances; + + /** + * Gets the InstancesClient object to access its operations. + * + * @return the InstancesClient object. + */ + public InstancesClient getInstances() { + return this.instances; + } + + /** + * The ResourceProvidersClient object to access its operations. + */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** + * Initializes an instance of Dfp 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 A unique identifier for a Microsoft Azure subscription. The subscription ID forms part of + * the URI for every service call. + * @param endpoint server parameter. + */ + DfpImpl(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 = "2021-02-01-preview"; + this.instances = new InstancesClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(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(DfpImpl.class); +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/DfpInstanceImpl.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/DfpInstanceImpl.java new file mode 100644 index 000000000000..ef44dfb2e094 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/DfpInstanceImpl.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dfp.fluent.models.DfpInstanceInner; +import com.azure.resourcemanager.dfp.models.DfpInstance; +import com.azure.resourcemanager.dfp.models.DfpInstanceAdministrators; +import com.azure.resourcemanager.dfp.models.DfpInstanceUpdateParameters; +import com.azure.resourcemanager.dfp.models.ProvisioningState; +import java.util.Collections; +import java.util.Map; + +public final class DfpInstanceImpl implements DfpInstance, DfpInstance.Definition, DfpInstance.Update { + private DfpInstanceInner innerObject; + + private final com.azure.resourcemanager.dfp.DfpManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public DfpInstanceAdministrators administration() { + return this.innerModel().administration(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DfpInstanceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dfp.DfpManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String instanceName; + + private DfpInstanceUpdateParameters updateInstanceUpdateParameters; + + public DfpInstanceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DfpInstance create() { + this.innerObject = serviceManager.serviceClient() + .getInstances() + .create(resourceGroupName, instanceName, this.innerModel(), Context.NONE); + return this; + } + + public DfpInstance create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getInstances() + .create(resourceGroupName, instanceName, this.innerModel(), context); + return this; + } + + DfpInstanceImpl(String name, com.azure.resourcemanager.dfp.DfpManager serviceManager) { + this.innerObject = new DfpInstanceInner(); + this.serviceManager = serviceManager; + this.instanceName = name; + } + + public DfpInstanceImpl update() { + this.updateInstanceUpdateParameters = new DfpInstanceUpdateParameters(); + return this; + } + + public DfpInstance apply() { + this.innerObject = serviceManager.serviceClient() + .getInstances() + .update(resourceGroupName, instanceName, updateInstanceUpdateParameters, Context.NONE); + return this; + } + + public DfpInstance apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getInstances() + .update(resourceGroupName, instanceName, updateInstanceUpdateParameters, context); + return this; + } + + DfpInstanceImpl(DfpInstanceInner innerObject, com.azure.resourcemanager.dfp.DfpManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.instanceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "instances"); + } + + public DfpInstance refresh() { + this.innerObject = serviceManager.serviceClient() + .getInstances() + .getByResourceGroupWithResponse(resourceGroupName, instanceName, Context.NONE) + .getValue(); + return this; + } + + public DfpInstance refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getInstances() + .getByResourceGroupWithResponse(resourceGroupName, instanceName, context) + .getValue(); + return this; + } + + public DfpInstanceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DfpInstanceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DfpInstanceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateInstanceUpdateParameters.withTags(tags); + return this; + } + } + + public DfpInstanceImpl withAdministration(DfpInstanceAdministrators administration) { + if (isInCreateMode()) { + this.innerModel().withAdministration(administration); + return this; + } else { + this.updateInstanceUpdateParameters.withAdministration(administration); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/InstancesClientImpl.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/InstancesClientImpl.java new file mode 100644 index 000000000000..cc32a68d2da1 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/InstancesClientImpl.java @@ -0,0 +1,1479 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.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.Post; +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.dfp.fluent.InstancesClient; +import com.azure.resourcemanager.dfp.fluent.models.CheckInstanceNameAvailabilityResultInner; +import com.azure.resourcemanager.dfp.fluent.models.DfpInstanceInner; +import com.azure.resourcemanager.dfp.models.CheckInstanceNameAvailabilityParameters; +import com.azure.resourcemanager.dfp.models.DfpInstanceUpdateParameters; +import com.azure.resourcemanager.dfp.models.DfpInstances; +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 InstancesClient. + */ +public final class InstancesClientImpl implements InstancesClient { + /** + * The proxy service used to perform REST calls. + */ + private final InstancesService service; + + /** + * The service client containing this operation class. + */ + private final DfpImpl client; + + /** + * Initializes an instance of InstancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InstancesClientImpl(DfpImpl client) { + this.service + = RestProxy.create(InstancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DfpInstances to be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DfpInstances") + public interface InstancesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dynamics365FraudProtection/instances/{instanceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("instanceName") String instanceName, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dynamics365FraudProtection/instances/{instanceName}") + @ExpectedResponses({ 200, 201, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("instanceName") String instanceName, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") DfpInstanceInner instanceParameters, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dynamics365FraudProtection/instances/{instanceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("instanceName") String instanceName, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dynamics365FraudProtection/instances/{instanceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("instanceName") String instanceName, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") DfpInstanceUpdateParameters instanceUpdateParameters, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dynamics365FraudProtection/instances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Dynamics365FraudProtection/instances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Dynamics365FraudProtection/locations/{location}/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CheckInstanceNameAvailabilityParameters instanceParameters, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @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); + } + + /** + * Gets details about the specified instances. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the instance. It must be a minimum of 3 characters, and a maximum of 63. + * @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 details about the specified instances along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String instanceName) { + 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 (instanceName == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceName 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.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, + instanceName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets details about the specified instances. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the instance. It must be a minimum of 3 characters, and a maximum of 63. + * @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 details about the specified instances along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String instanceName, 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 (instanceName == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceName 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.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, instanceName, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + } + + /** + * Gets details about the specified instances. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the instance. It must be a minimum of 3 characters, and a maximum of 63. + * @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 details about the specified instances on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String instanceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, instanceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets details about the specified instances. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the instance. It must be a minimum of 3 characters, and a maximum of 63. + * @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 details about the specified instances along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String instanceName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, instanceName, context).block(); + } + + /** + * Gets details about the specified instances. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the instance. It must be a minimum of 3 characters, and a maximum of 63. + * @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 details about the specified instances. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DfpInstanceInner getByResourceGroup(String resourceGroupName, String instanceName) { + return getByResourceGroupWithResponse(resourceGroupName, instanceName, Context.NONE).getValue(); + } + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String instanceName, + DfpInstanceInner instanceParameters) { + 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 (instanceName == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceName 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 (instanceParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter instanceParameters is required and cannot be null.")); + } else { + instanceParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), resourceGroupName, instanceName, + this.client.getApiVersion(), this.client.getSubscriptionId(), instanceParameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String instanceName, + DfpInstanceInner instanceParameters, 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 (instanceName == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceName 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 (instanceParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter instanceParameters is required and cannot be null.")); + } else { + instanceParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), resourceGroupName, instanceName, this.client.getApiVersion(), + this.client.getSubscriptionId(), instanceParameters, accept, context); + } + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DfpInstanceInner> beginCreateAsync(String resourceGroupName, + String instanceName, DfpInstanceInner instanceParameters) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, instanceName, instanceParameters); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + DfpInstanceInner.class, DfpInstanceInner.class, this.client.getContext()); + } + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DfpInstanceInner> beginCreateAsync(String resourceGroupName, + String instanceName, DfpInstanceInner instanceParameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createWithResponseAsync(resourceGroupName, instanceName, instanceParameters, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + DfpInstanceInner.class, DfpInstanceInner.class, context); + } + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DfpInstanceInner> beginCreate(String resourceGroupName, + String instanceName, DfpInstanceInner instanceParameters) { + return this.beginCreateAsync(resourceGroupName, instanceName, instanceParameters).getSyncPoller(); + } + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DfpInstanceInner> beginCreate(String resourceGroupName, + String instanceName, DfpInstanceInner instanceParameters, Context context) { + return this.beginCreateAsync(resourceGroupName, instanceName, instanceParameters, context).getSyncPoller(); + } + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String instanceName, + DfpInstanceInner instanceParameters) { + return beginCreateAsync(resourceGroupName, instanceName, instanceParameters).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String instanceName, + DfpInstanceInner instanceParameters, Context context) { + return beginCreateAsync(resourceGroupName, instanceName, instanceParameters, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DfpInstanceInner create(String resourceGroupName, String instanceName, DfpInstanceInner instanceParameters) { + return createAsync(resourceGroupName, instanceName, instanceParameters).block(); + } + + /** + * Provisions the specified DFP instance based on the configuration specified in the request. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instances. It must be a minimum of 3 characters, and a maximum of 63. + * @param instanceParameters Contains the information used to provision the DFP instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DfpInstanceInner create(String resourceGroupName, String instanceName, DfpInstanceInner instanceParameters, + Context context) { + return createAsync(resourceGroupName, instanceName, instanceParameters, context).block(); + } + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName) { + 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 (instanceName == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceName 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.delete(this.client.getEndpoint(), resourceGroupName, instanceName, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName, + 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 (instanceName == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceName 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.delete(this.client.getEndpoint(), resourceGroupName, instanceName, this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + } + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, instanceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, instanceName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName) { + return this.beginDeleteAsync(resourceGroupName, instanceName).getSyncPoller(); + } + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, instanceName, context).getSyncPoller(); + } + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName) { + return beginDeleteAsync(resourceGroupName, instanceName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName, Context context) { + return beginDeleteAsync(resourceGroupName, instanceName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName) { + deleteAsync(resourceGroupName, instanceName).block(); + } + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName, Context context) { + deleteAsync(resourceGroupName, instanceName, context).block(); + } + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String instanceName, + DfpInstanceUpdateParameters instanceUpdateParameters) { + 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 (instanceName == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceName 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 (instanceUpdateParameters == null) { + return Mono.error( + new IllegalArgumentException("Parameter instanceUpdateParameters is required and cannot be null.")); + } else { + instanceUpdateParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), resourceGroupName, instanceName, + this.client.getApiVersion(), this.client.getSubscriptionId(), instanceUpdateParameters, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String instanceName, + DfpInstanceUpdateParameters instanceUpdateParameters, 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 (instanceName == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceName 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 (instanceUpdateParameters == null) { + return Mono.error( + new IllegalArgumentException("Parameter instanceUpdateParameters is required and cannot be null.")); + } else { + instanceUpdateParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), resourceGroupName, instanceName, this.client.getApiVersion(), + this.client.getSubscriptionId(), instanceUpdateParameters, accept, context); + } + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DfpInstanceInner> beginUpdateAsync(String resourceGroupName, + String instanceName, DfpInstanceUpdateParameters instanceUpdateParameters) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, instanceName, instanceUpdateParameters); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + DfpInstanceInner.class, DfpInstanceInner.class, this.client.getContext()); + } + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DfpInstanceInner> beginUpdateAsync(String resourceGroupName, + String instanceName, DfpInstanceUpdateParameters instanceUpdateParameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, instanceName, instanceUpdateParameters, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + DfpInstanceInner.class, DfpInstanceInner.class, context); + } + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DfpInstanceInner> beginUpdate(String resourceGroupName, + String instanceName, DfpInstanceUpdateParameters instanceUpdateParameters) { + return this.beginUpdateAsync(resourceGroupName, instanceName, instanceUpdateParameters).getSyncPoller(); + } + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DfpInstanceInner> beginUpdate(String resourceGroupName, + String instanceName, DfpInstanceUpdateParameters instanceUpdateParameters, Context context) { + return this.beginUpdateAsync(resourceGroupName, instanceName, instanceUpdateParameters, context) + .getSyncPoller(); + } + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String instanceName, + DfpInstanceUpdateParameters instanceUpdateParameters) { + return beginUpdateAsync(resourceGroupName, instanceName, instanceUpdateParameters).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String instanceName, + DfpInstanceUpdateParameters instanceUpdateParameters, Context context) { + return beginUpdateAsync(resourceGroupName, instanceName, instanceUpdateParameters, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DfpInstanceInner update(String resourceGroupName, String instanceName, + DfpInstanceUpdateParameters instanceUpdateParameters) { + return updateAsync(resourceGroupName, instanceName, instanceUpdateParameters).block(); + } + + /** + * Updates the current state of the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @param instanceUpdateParameters Request object that contains the updated information for the instance. + * @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 represents an instance of a DFP instance resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DfpInstanceInner update(String resourceGroupName, String instanceName, + DfpInstanceUpdateParameters instanceUpdateParameters, Context context) { + return updateAsync(resourceGroupName, instanceName, instanceUpdateParameters, context).block(); + } + + /** + * Gets all the Dedicated instance for the given resource group. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @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 all the Dedicated instance for the given resource group 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.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all the Dedicated instance for the given resource group. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @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 all the Dedicated instance for the given resource group 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.getApiVersion(), + this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all the Dedicated instance for the given resource group. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @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 all the Dedicated instance for the given resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the Dedicated instance for the given resource group. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @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 all the Dedicated instance for the given resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all the Dedicated instance for the given resource group. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @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 all the Dedicated instance for the given resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets all the Dedicated instance for the given resource group. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @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 all the Dedicated instance for the given resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all the Dedicated instances for the given 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 an array of DFP instance resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the Dedicated instances for the given 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 an array of DFP instance resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists all the Dedicated instances for the given 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 an array of DFP instance resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the Dedicated instances for the given 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 an array of DFP instance resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the Dedicated instances for the given 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 an array of DFP instance resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the Dedicated instances for the given 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 an array of DFP instance resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Check the name availability in the target location. + * + * @param location The region name which the operation will lookup into. + * @param instanceParameters The name of the instance. + * @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 checking result of DFP instance name availability along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + String location, CheckInstanceNameAvailabilityParameters instanceParameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 (instanceParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter instanceParameters is required and cannot be null.")); + } else { + instanceParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.checkNameAvailability(this.client.getEndpoint(), location, + this.client.getApiVersion(), this.client.getSubscriptionId(), instanceParameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check the name availability in the target location. + * + * @param location The region name which the operation will lookup into. + * @param instanceParameters The name of the instance. + * @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 checking result of DFP instance name availability along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + String location, CheckInstanceNameAvailabilityParameters instanceParameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 (instanceParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter instanceParameters is required and cannot be null.")); + } else { + instanceParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.checkNameAvailability(this.client.getEndpoint(), location, this.client.getApiVersion(), + this.client.getSubscriptionId(), instanceParameters, accept, context); + } + + /** + * Check the name availability in the target location. + * + * @param location The region name which the operation will lookup into. + * @param instanceParameters The name of the instance. + * @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 checking result of DFP instance name availability on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync(String location, + CheckInstanceNameAvailabilityParameters instanceParameters) { + return checkNameAvailabilityWithResponseAsync(location, instanceParameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Check the name availability in the target location. + * + * @param location The region name which the operation will lookup into. + * @param instanceParameters The name of the instance. + * @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 checking result of DFP instance name availability along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse(String location, + CheckInstanceNameAvailabilityParameters instanceParameters, Context context) { + return checkNameAvailabilityWithResponseAsync(location, instanceParameters, context).block(); + } + + /** + * Check the name availability in the target location. + * + * @param location The region name which the operation will lookup into. + * @param instanceParameters The name of the instance. + * @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 checking result of DFP instance name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckInstanceNameAvailabilityResultInner checkNameAvailability(String location, + CheckInstanceNameAvailabilityParameters instanceParameters) { + return checkNameAvailabilityWithResponse(location, instanceParameters, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 an array of DFP instance resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 an array of DFP instance resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 an array of DFP instance resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 an array of DFP instance resources 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/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/InstancesImpl.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/InstancesImpl.java new file mode 100644 index 000000000000..20c543c7c02d --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/InstancesImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.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.dfp.fluent.InstancesClient; +import com.azure.resourcemanager.dfp.fluent.models.CheckInstanceNameAvailabilityResultInner; +import com.azure.resourcemanager.dfp.fluent.models.DfpInstanceInner; +import com.azure.resourcemanager.dfp.models.CheckInstanceNameAvailabilityParameters; +import com.azure.resourcemanager.dfp.models.CheckInstanceNameAvailabilityResult; +import com.azure.resourcemanager.dfp.models.DfpInstance; +import com.azure.resourcemanager.dfp.models.Instances; + +public final class InstancesImpl implements Instances { + private static final ClientLogger LOGGER = new ClientLogger(InstancesImpl.class); + + private final InstancesClient innerClient; + + private final com.azure.resourcemanager.dfp.DfpManager serviceManager; + + public InstancesImpl(InstancesClient innerClient, com.azure.resourcemanager.dfp.DfpManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String instanceName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, instanceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DfpInstanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DfpInstance getByResourceGroup(String resourceGroupName, String instanceName) { + DfpInstanceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, instanceName); + if (inner != null) { + return new DfpInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String instanceName) { + this.serviceClient().delete(resourceGroupName, instanceName); + } + + public void delete(String resourceGroupName, String instanceName, Context context) { + this.serviceClient().delete(resourceGroupName, instanceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DfpInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DfpInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DfpInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DfpInstanceImpl(inner1, this.manager())); + } + + public Response checkNameAvailabilityWithResponse(String location, + CheckInstanceNameAvailabilityParameters instanceParameters, Context context) { + Response inner + = this.serviceClient().checkNameAvailabilityWithResponse(location, instanceParameters, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckInstanceNameAvailabilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckInstanceNameAvailabilityResult checkNameAvailability(String location, + CheckInstanceNameAvailabilityParameters instanceParameters) { + CheckInstanceNameAvailabilityResultInner inner + = this.serviceClient().checkNameAvailability(location, instanceParameters); + if (inner != null) { + return new CheckInstanceNameAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public DfpInstance getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 instanceName = ResourceManagerUtils.getValueFromIdByName(id, "instances"); + if (instanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'instances'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, instanceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 instanceName = ResourceManagerUtils.getValueFromIdByName(id, "instances"); + if (instanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'instances'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, instanceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 instanceName = ResourceManagerUtils.getValueFromIdByName(id, "instances"); + if (instanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'instances'.", id))); + } + this.delete(resourceGroupName, instanceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 instanceName = ResourceManagerUtils.getValueFromIdByName(id, "instances"); + if (instanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'instances'.", id))); + } + this.delete(resourceGroupName, instanceName, context); + } + + private InstancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dfp.DfpManager manager() { + return this.serviceManager; + } + + public DfpInstanceImpl define(String name) { + return new DfpInstanceImpl(name, this.manager()); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/OperationImpl.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/OperationImpl.java new file mode 100644 index 000000000000..890b04a349d0 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.implementation; + +import com.azure.resourcemanager.dfp.fluent.models.OperationInner; +import com.azure.resourcemanager.dfp.models.ActionType; +import com.azure.resourcemanager.dfp.models.Operation; +import com.azure.resourcemanager.dfp.models.OperationDisplay; +import com.azure.resourcemanager.dfp.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.dfp.DfpManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.dfp.DfpManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dfp.DfpManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/ResourceManagerUtils.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..5acc876de5d6 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.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 ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/ResourceProvidersClientImpl.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 000000000000..e6b51f7c144b --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.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.dfp.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.dfp.fluent.models.OperationInner; +import com.azure.resourcemanager.dfp.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ResourceProvidersClient. + */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + /** + * The proxy service used to perform REST calls. + */ + private final ResourceProvidersService service; + + /** + * The service client containing this operation class. + */ + private final DfpImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(DfpImpl client) { + this.service + = RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DfpResourceProviders to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DfpResourceProviders") + public interface ResourceProvidersService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Dynamics365FraudProtection/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listOperations(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listOperationsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Lists all of the available DFP 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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> 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(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available DFP 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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> 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(), res.getValue().nextLink(), null)); + } + + /** + * Lists all of the available DFP 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOperationsAsync() { + return new PagedFlux<>(() -> listOperationsSinglePageAsync(), + nextLink -> listOperationsNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available DFP 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOperationsAsync(Context context) { + return new PagedFlux<>(() -> listOperationsSinglePageAsync(context), + nextLink -> listOperationsNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available DFP 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperations() { + return new PagedIterable<>(listOperationsAsync()); + } + + /** + * Lists all of the available DFP 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperations(Context context) { + return new PagedIterable<>(listOperationsAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsNextSinglePageAsync(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.listOperationsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsNextSinglePageAsync(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.listOperationsNext(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/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/ResourceProvidersImpl.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/ResourceProvidersImpl.java new file mode 100644 index 000000000000..a9c3b9edcf10 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/ResourceProvidersImpl.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.dfp.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.dfp.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.dfp.fluent.models.OperationInner; +import com.azure.resourcemanager.dfp.models.Operation; +import com.azure.resourcemanager.dfp.models.ResourceProviders; + +public final class ResourceProvidersImpl implements ResourceProviders { + private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.dfp.DfpManager serviceManager; + + public ResourceProvidersImpl(ResourceProvidersClient innerClient, + com.azure.resourcemanager.dfp.DfpManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listOperations() { + PagedIterable inner = this.serviceClient().listOperations(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable listOperations(Context context) { + PagedIterable inner = this.serviceClient().listOperations(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dfp.DfpManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/package-info.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/package-info.java new file mode 100644 index 000000000000..6e73d5fdfa08 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/package-info.java @@ -0,0 +1,10 @@ +// 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 Dfp. + * DFP Web API provides a RESTful set of web services that enables users to create, retrieve, update, and delete DFP + * instances. + */ +package com.azure.resourcemanager.dfp.implementation; diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/ActionType.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/ActionType.java new file mode 100644 index 000000000000..59183ca54836 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/ActionType.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.dfp.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/CheckInstanceNameAvailabilityParameters.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/CheckInstanceNameAvailabilityParameters.java new file mode 100644 index 000000000000..e390f6be1e91 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/CheckInstanceNameAvailabilityParameters.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Details of DFP instance name request body. + */ +@Fluent +public final class CheckInstanceNameAvailabilityParameters + implements JsonSerializable { + /* + * Name for checking availability. + */ + private String name; + + /* + * The resource type of DFP instance. + */ + private String type; + + /** + * Creates an instance of CheckInstanceNameAvailabilityParameters class. + */ + public CheckInstanceNameAvailabilityParameters() { + } + + /** + * Get the name property: Name for checking availability. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name for checking availability. + * + * @param name the name value to set. + * @return the CheckInstanceNameAvailabilityParameters object itself. + */ + public CheckInstanceNameAvailabilityParameters withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The resource type of DFP instance. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type of DFP instance. + * + * @param type the type value to set. + * @return the CheckInstanceNameAvailabilityParameters object itself. + */ + public CheckInstanceNameAvailabilityParameters withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckInstanceNameAvailabilityParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckInstanceNameAvailabilityParameters if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CheckInstanceNameAvailabilityParameters. + */ + public static CheckInstanceNameAvailabilityParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckInstanceNameAvailabilityParameters deserializedCheckInstanceNameAvailabilityParameters + = new CheckInstanceNameAvailabilityParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCheckInstanceNameAvailabilityParameters.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCheckInstanceNameAvailabilityParameters.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckInstanceNameAvailabilityParameters; + }); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/CheckInstanceNameAvailabilityResult.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/CheckInstanceNameAvailabilityResult.java new file mode 100644 index 000000000000..75aec5010da1 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/CheckInstanceNameAvailabilityResult.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.resourcemanager.dfp.fluent.models.CheckInstanceNameAvailabilityResultInner; + +/** + * An immutable client-side representation of CheckInstanceNameAvailabilityResult. + */ +public interface CheckInstanceNameAvailabilityResult { + /** + * Gets the nameAvailable property: Indicator of availability of the DFP instance name. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason of unavailability. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the message property: The detailed message of the request unavailability. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.dfp.fluent.models.CheckInstanceNameAvailabilityResultInner object. + * + * @return the inner object. + */ + CheckInstanceNameAvailabilityResultInner innerModel(); +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstance.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstance.java new file mode 100644 index 000000000000..de7aaa9b1706 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstance.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dfp.fluent.models.DfpInstanceInner; +import java.util.Map; + +/** + * An immutable client-side representation of DfpInstance. + */ +public interface DfpInstance { + /** + * 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: Location of the DFP resource. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Key-value pairs of additional resource provisioning properties. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The current deployment state of DFP resource. The provisioningState is to + * indicate states for resource provisioning. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the administration property: A collection of DFP instance administrators. + * + * @return the administration value. + */ + DfpInstanceAdministrators administration(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.dfp.fluent.models.DfpInstanceInner object. + * + * @return the inner object. + */ + DfpInstanceInner innerModel(); + + /** + * The entirety of the DfpInstance definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The DfpInstance definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the DfpInstance definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the DfpInstance definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location Location of the DFP resource. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location Location of the DFP resource. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the DfpInstance definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This + * name must be at least 1 character in length, and no more than 90. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the DfpInstance 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.WithAdministration { + /** + * Executes the create request. + * + * @return the created resource. + */ + DfpInstance create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DfpInstance create(Context context); + } + + /** + * The stage of the DfpInstance definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Key-value pairs of additional resource provisioning properties.. + * + * @param tags Key-value pairs of additional resource provisioning properties. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the DfpInstance definition allowing to specify administration. + */ + interface WithAdministration { + /** + * Specifies the administration property: A collection of DFP instance administrators. + * + * @param administration A collection of DFP instance administrators. + * @return the next definition stage. + */ + WithCreate withAdministration(DfpInstanceAdministrators administration); + } + } + + /** + * Begins update for the DfpInstance resource. + * + * @return the stage of resource update. + */ + DfpInstance.Update update(); + + /** + * The template for DfpInstance update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithAdministration { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DfpInstance apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DfpInstance apply(Context context); + } + + /** + * The DfpInstance update stages. + */ + interface UpdateStages { + /** + * The stage of the DfpInstance update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Key-value pairs of additional provisioning properties.. + * + * @param tags Key-value pairs of additional provisioning properties. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the DfpInstance update allowing to specify administration. + */ + interface WithAdministration { + /** + * Specifies the administration property: A collection of DFP instance administrators. + * + * @param administration A collection of DFP instance administrators. + * @return the next definition stage. + */ + Update withAdministration(DfpInstanceAdministrators administration); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DfpInstance refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DfpInstance refresh(Context context); +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstanceAdministrators.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstanceAdministrators.java new file mode 100644 index 000000000000..011d6ff11262 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstanceAdministrators.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * An array of administrator user identities. + */ +@Fluent +public final class DfpInstanceAdministrators implements JsonSerializable { + /* + * An array of administrator user identities. + */ + private List members; + + /** + * Creates an instance of DfpInstanceAdministrators class. + */ + public DfpInstanceAdministrators() { + } + + /** + * Get the members property: An array of administrator user identities. + * + * @return the members value. + */ + public List members() { + return this.members; + } + + /** + * Set the members property: An array of administrator user identities. + * + * @param members the members value to set. + * @return the DfpInstanceAdministrators object itself. + */ + public DfpInstanceAdministrators withMembers(List members) { + this.members = members; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("members", this.members, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DfpInstanceAdministrators from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DfpInstanceAdministrators if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DfpInstanceAdministrators. + */ + public static DfpInstanceAdministrators fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DfpInstanceAdministrators deserializedDfpInstanceAdministrators = new DfpInstanceAdministrators(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("members".equals(fieldName)) { + List members = reader.readArray(reader1 -> reader1.getString()); + deserializedDfpInstanceAdministrators.members = members; + } else { + reader.skipChildren(); + } + } + + return deserializedDfpInstanceAdministrators; + }); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstanceUpdateParameters.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstanceUpdateParameters.java new file mode 100644 index 000000000000..d6c125f1c821 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstanceUpdateParameters.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.dfp.fluent.models.DfpInstanceMutableProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Provision request specification. + */ +@Fluent +public final class DfpInstanceUpdateParameters implements JsonSerializable { + /* + * Key-value pairs of additional provisioning properties. + */ + private Map tags; + + /* + * Properties of the provision operation request + */ + private DfpInstanceMutableProperties innerProperties; + + /** + * Creates an instance of DfpInstanceUpdateParameters class. + */ + public DfpInstanceUpdateParameters() { + } + + /** + * Get the tags property: Key-value pairs of additional provisioning properties. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Key-value pairs of additional provisioning properties. + * + * @param tags the tags value to set. + * @return the DfpInstanceUpdateParameters object itself. + */ + public DfpInstanceUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: Properties of the provision operation request. + * + * @return the innerProperties value. + */ + private DfpInstanceMutableProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the administration property: A collection of DFP instance administrators. + * + * @return the administration value. + */ + public DfpInstanceAdministrators administration() { + return this.innerProperties() == null ? null : this.innerProperties().administration(); + } + + /** + * Set the administration property: A collection of DFP instance administrators. + * + * @param administration the administration value to set. + * @return the DfpInstanceUpdateParameters object itself. + */ + public DfpInstanceUpdateParameters withAdministration(DfpInstanceAdministrators administration) { + if (this.innerProperties() == null) { + this.innerProperties = new DfpInstanceMutableProperties(); + } + this.innerProperties().withAdministration(administration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DfpInstanceUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DfpInstanceUpdateParameters if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DfpInstanceUpdateParameters. + */ + public static DfpInstanceUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DfpInstanceUpdateParameters deserializedDfpInstanceUpdateParameters = new DfpInstanceUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDfpInstanceUpdateParameters.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedDfpInstanceUpdateParameters.innerProperties + = DfpInstanceMutableProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDfpInstanceUpdateParameters; + }); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstances.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstances.java new file mode 100644 index 000000000000..921e41d2057f --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstances.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.dfp.fluent.models.DfpInstanceInner; +import java.io.IOException; +import java.util.List; + +/** + * An array of DFP instance resources. + */ +@Fluent +public final class DfpInstances implements JsonSerializable { + /* + * An array of DFP instance resources. + */ + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + private String nextLink; + + /** + * Creates an instance of DfpInstances class. + */ + public DfpInstances() { + } + + /** + * Get the value property: An array of DFP instance resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: An array of DFP instance resources. + * + * @param value the value value to set. + * @return the DfpInstances object itself. + */ + public DfpInstances 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model DfpInstances")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DfpInstances.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DfpInstances from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DfpInstances if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DfpInstances. + */ + public static DfpInstances fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DfpInstances deserializedDfpInstances = new DfpInstances(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> DfpInstanceInner.fromJson(reader1)); + deserializedDfpInstances.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDfpInstances.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDfpInstances; + }); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/Instances.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/Instances.java new file mode 100644 index 000000000000..e860722435e2 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/Instances.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.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 Instances. + */ +public interface Instances { + /** + * Gets details about the specified instances. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the instance. It must be a minimum of 3 characters, and a maximum of 63. + * @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 details about the specified instances along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String instanceName, + Context context); + + /** + * Gets details about the specified instances. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the instance. It must be a minimum of 3 characters, and a maximum of 63. + * @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 details about the specified instances. + */ + DfpInstance getByResourceGroup(String resourceGroupName, String instanceName); + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName); + + /** + * Deletes the specified DFP instance. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @param instanceName The name of the DFP instance. It must be at least 3 characters in length, and no more than + * 63. + * @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 instanceName, Context context); + + /** + * Gets all the Dedicated instance for the given resource group. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @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 all the Dedicated instance for the given resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all the Dedicated instance for the given resource group. + * + * @param resourceGroupName The name of the Azure Resource group of which a given DFP instance is part. This name + * must be at least 1 character in length, and no more than 90. + * @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 all the Dedicated instance for the given resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the Dedicated instances for the given 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 an array of DFP instance resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all the Dedicated instances for the given 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 an array of DFP instance resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Check the name availability in the target location. + * + * @param location The region name which the operation will lookup into. + * @param instanceParameters The name of the instance. + * @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 checking result of DFP instance name availability along with {@link Response}. + */ + Response checkNameAvailabilityWithResponse(String location, + CheckInstanceNameAvailabilityParameters instanceParameters, Context context); + + /** + * Check the name availability in the target location. + * + * @param location The region name which the operation will lookup into. + * @param instanceParameters The name of the instance. + * @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 checking result of DFP instance name availability. + */ + CheckInstanceNameAvailabilityResult checkNameAvailability(String location, + CheckInstanceNameAvailabilityParameters instanceParameters); + + /** + * Gets details about the specified instances. + * + * @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 details about the specified instances along with {@link Response}. + */ + DfpInstance getById(String id); + + /** + * Gets details about the specified instances. + * + * @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 details about the specified instances along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified DFP instance. + * + * @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 the specified DFP instance. + * + * @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 DfpInstance resource. + * + * @param name resource name. + * @return the first stage of the new DfpInstance definition. + */ + DfpInstance.DefinitionStages.Blank define(String name); +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/Operation.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/Operation.java new file mode 100644 index 000000000000..81c64cf288aa --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.resourcemanager.dfp.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.dfp.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/OperationDisplay.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/OperationDisplay.java new file mode 100644 index 000000000000..522e383f6874 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/OperationListResult.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/OperationListResult.java new file mode 100644 index 000000000000..7202a5cec688 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/OperationListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.dfp.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * List of operations supported by the resource provider + */ + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/Origin.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/Origin.java new file mode 100644 index 000000000000..872543574971 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Static value user for Origin. + */ + public static final Origin USER = fromString("user"); + + /** + * Static value system for Origin. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Static value user,system for Origin. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/ProvisioningState.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/ProvisioningState.java new file mode 100644 index 000000000000..d9056a6cda44 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/ProvisioningState.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The current deployment state of DFP resource. The provisioningState is to indicate states for resource provisioning. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Paused for ProvisioningState. + */ + public static final ProvisioningState PAUSED = fromString("Paused"); + + /** + * Static value Suspended for ProvisioningState. + */ + public static final ProvisioningState SUSPENDED = fromString("Suspended"); + + /** + * Static value Provisioning for ProvisioningState. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Static value Updating for ProvisioningState. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Suspending for ProvisioningState. + */ + public static final ProvisioningState SUSPENDING = fromString("Suspending"); + + /** + * Static value Pausing for ProvisioningState. + */ + public static final ProvisioningState PAUSING = fromString("Pausing"); + + /** + * Static value Resuming for ProvisioningState. + */ + public static final ProvisioningState RESUMING = fromString("Resuming"); + + /** + * Static value Preparing for ProvisioningState. + */ + public static final ProvisioningState PREPARING = fromString("Preparing"); + + /** + * Static value Scaling for ProvisioningState. + */ + public static final ProvisioningState SCALING = fromString("Scaling"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + 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/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/ResourceProviders.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/ResourceProviders.java new file mode 100644 index 000000000000..e2c0b5030bc0 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/ResourceProviders.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.dfp.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of ResourceProviders. + */ +public interface ResourceProviders { + /** + * Lists all of the available DFP 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listOperations(); + + /** + * Lists all of the available DFP 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listOperations(Context context); +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/package-info.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/package-info.java new file mode 100644 index 000000000000..47bc8ec13766 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/package-info.java @@ -0,0 +1,10 @@ +// 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 Dfp. + * DFP Web API provides a RESTful set of web services that enables users to create, retrieve, update, and delete DFP + * instances. + */ +package com.azure.resourcemanager.dfp.models; diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/package-info.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/package-info.java new file mode 100644 index 000000000000..0edfe4518074 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/package-info.java @@ -0,0 +1,10 @@ +// 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 Dfp. + * DFP Web API provides a RESTful set of web services that enables users to create, retrieve, update, and delete DFP + * instances. + */ +package com.azure.resourcemanager.dfp; diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/java/module-info.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/module-info.java new file mode 100644 index 000000000000..669e61715df5 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/module-info.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.dfp { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.dfp; + exports com.azure.resourcemanager.dfp.fluent; + exports com.azure.resourcemanager.dfp.fluent.models; + exports com.azure.resourcemanager.dfp.models; + + opens com.azure.resourcemanager.dfp.fluent.models to com.azure.core; + opens com.azure.resourcemanager.dfp.models to com.azure.core; +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-dfp/proxy-config.json b/sdk/dfp/azure-resourcemanager-dfp/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-dfp/proxy-config.json new file mode 100644 index 000000000000..fb5abaaa6e36 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-dfp/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.dfp.implementation.InstancesClientImpl$InstancesService"],["com.azure.resourcemanager.dfp.implementation.ResourceProvidersClientImpl$ResourceProvidersService"]] \ No newline at end of file diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-dfp/reflect-config.json b/sdk/dfp/azure-resourcemanager-dfp/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-dfp/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-dfp/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/main/resources/azure-resourcemanager-dfp.properties b/sdk/dfp/azure-resourcemanager-dfp/src/main/resources/azure-resourcemanager-dfp.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/resources/azure-resourcemanager-dfp.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesCheckNameAvailabilitySamples.java b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesCheckNameAvailabilitySamples.java new file mode 100644 index 000000000000..d8a76a7b14f5 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesCheckNameAvailabilitySamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.generated; + +import com.azure.resourcemanager.dfp.models.CheckInstanceNameAvailabilityParameters; + +/** + * Samples for Instances CheckNameAvailability. + */ +public final class InstancesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * checkNameAvailability.json + */ + /** + * Sample code: Check name availability of an instance. + * + * @param manager Entry point to DfpManager. + */ + public static void checkNameAvailabilityOfAnInstance(com.azure.resourcemanager.dfp.DfpManager manager) { + manager.instances() + .checkNameAvailabilityWithResponse("West US", + new CheckInstanceNameAvailabilityParameters().withName("azsdktest") + .withType("Microsoft.Dynamics365Fraudprotection/instances"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesCreateSamples.java b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesCreateSamples.java new file mode 100644 index 000000000000..d918b4850028 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesCreateSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.generated; + +import com.azure.resourcemanager.dfp.models.DfpInstanceAdministrators; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Instances Create. + */ +public final class InstancesCreateSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * createInstance.json + */ + /** + * Sample code: Create instance. + * + * @param manager Entry point to DfpManager. + */ + public static void createInstance(com.azure.resourcemanager.dfp.DfpManager manager) { + manager.instances() + .define("azsdktest") + .withRegion("West US") + .withExistingResourceGroup("TestRG") + .withTags(mapOf("testKey", "fakeTokenPlaceholder")) + .withAdministration(new DfpInstanceAdministrators() + .withMembers(Arrays.asList("azsdktest@microsoft.com", "azsdktest2@microsoft.com"))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesDeleteSamples.java b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesDeleteSamples.java new file mode 100644 index 000000000000..76673153fce5 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.generated; + +/** + * Samples for Instances Delete. + */ +public final class InstancesDeleteSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * deleteInstance.json + */ + /** + * Sample code: Get details of an instance. + * + * @param manager Entry point to DfpManager. + */ + public static void getDetailsOfAnInstance(com.azure.resourcemanager.dfp.DfpManager manager) { + manager.instances().delete("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesGetByResourceGroupSamples.java b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..f119df0d02f3 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.generated; + +/** + * Samples for Instances GetByResourceGroup. + */ +public final class InstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * getInstance.json + */ + /** + * Sample code: Get details of an instance. + * + * @param manager Entry point to DfpManager. + */ + public static void getDetailsOfAnInstance(com.azure.resourcemanager.dfp.DfpManager manager) { + manager.instances().getByResourceGroupWithResponse("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesListByResourceGroupSamples.java b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesListByResourceGroupSamples.java new file mode 100644 index 000000000000..0941019fc7e2 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesListByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.generated; + +/** + * Samples for Instances ListByResourceGroup. + */ +public final class InstancesListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * listInstancesInResourceGroup.json + */ + /** + * Sample code: List DFP instances in resource group. + * + * @param manager Entry point to DfpManager. + */ + public static void listDFPInstancesInResourceGroup(com.azure.resourcemanager.dfp.DfpManager manager) { + manager.instances().listByResourceGroup("TestRG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesListSamples.java b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesListSamples.java new file mode 100644 index 000000000000..f6ec76511945 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.generated; + +/** + * Samples for Instances List. + */ +public final class InstancesListSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * listInstancesInSubscription.json + */ + /** + * Sample code: Get details of a instance. + * + * @param manager Entry point to DfpManager. + */ + public static void getDetailsOfAInstance(com.azure.resourcemanager.dfp.DfpManager manager) { + manager.instances().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesUpdateSamples.java b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesUpdateSamples.java new file mode 100644 index 000000000000..bc3d535dc85d --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesUpdateSamples.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.dfp.generated; + +import com.azure.resourcemanager.dfp.models.DfpInstance; +import com.azure.resourcemanager.dfp.models.DfpInstanceAdministrators; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Instances Update. + */ +public final class InstancesUpdateSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * updateInstance.json + */ + /** + * Sample code: Update instance parameters. + * + * @param manager Entry point to DfpManager. + */ + public static void updateInstanceParameters(com.azure.resourcemanager.dfp.DfpManager manager) { + DfpInstance resource = manager.instances() + .getByResourceGroupWithResponse("TestRG", "azsdktest", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testKey", "fakeTokenPlaceholder")) + .withAdministration(new DfpInstanceAdministrators() + .withMembers(Arrays.asList("azsdktest@microsoft.com", "azsdktest2@microsoft.com"))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/ResourceProviderListOperationsSamples.java b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/ResourceProviderListOperationsSamples.java new file mode 100644 index 000000000000..20482200e291 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/ResourceProviderListOperationsSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.generated; + +/** + * Samples for ResourceProvider ListOperations. + */ +public final class ResourceProviderListOperationsSamples { + /* + * x-ms-original-file: + * specification/dfp/resource-manager/Microsoft.Dynamics365Fraudprotection/preview/2021-02-01-preview/examples/ + * ListOperations.json + */ + /** + * Sample code: Get a list of operations supported by Microsoft.Dynamics365FraudProtection resource provider. + * + * @param manager Entry point to DfpManager. + */ + public static void getAListOfOperationsSupportedByMicrosoftDynamics365FraudProtectionResourceProvider( + com.azure.resourcemanager.dfp.DfpManager manager) { + manager.resourceProviders().listOperations(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dfp/ci.yml b/sdk/dfp/ci.yml new file mode 100644 index 000000000000..f5880ffae98d --- /dev/null +++ b/sdk/dfp/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/dfp/ci.yml + - sdk/dfp/azure-resourcemanager-dfp/ + exclude: + - sdk/dfp/pom.xml + - sdk/dfp/azure-resourcemanager-dfp/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dfp/ci.yml + - sdk/dfp/azure-resourcemanager-dfp/ + exclude: + - sdk/dfp/pom.xml + - sdk/dfp/azure-resourcemanager-dfp/pom.xml + +parameters: + - name: release_azureresourcemanagerdfp + displayName: azure-resourcemanager-dfp + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: dfp + Artifacts: + - name: azure-resourcemanager-dfp + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdfp + releaseInBatch: ${{ parameters.release_azureresourcemanagerdfp }} diff --git a/sdk/dfp/pom.xml b/sdk/dfp/pom.xml new file mode 100644 index 000000000000..4b339bb899ef --- /dev/null +++ b/sdk/dfp/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-dfp-service + pom + 1.0.0 + + + azure-resourcemanager-dfp + +