diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 053d18426c3e..c81b61cc1c7f 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -340,6 +340,7 @@ com.azure.resourcemanager:azure-resourcemanager-securityinsights;1.0.0-beta.2;1. com.azure.resourcemanager:azure-resourcemanager-oep;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-dnsresolver;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-mobilenetwork;1.0.0-beta.1;1.0.0-beta.2 +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.0.0 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index f3ba561857a5..27ce7c45f19d 100644 --- a/pom.xml +++ b/pom.xml @@ -888,6 +888,7 @@ sdk/deviceupdate sdk/devspaces sdk/devtestlabs + sdk/dfp sdk/digitaltwins sdk/dnsresolver sdk/edgeorder diff --git a/sdk/dfp/azure-resourcemanager-dfp/CHANGELOG.md b/sdk/dfp/azure-resourcemanager-dfp/CHANGELOG.md new file mode 100644 index 000000000000..de24d4b15aaf --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-03-24) + +- 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). diff --git a/sdk/dfp/azure-resourcemanager-dfp/README.md b/sdk/dfp/azure-resourcemanager-dfp/README.md new file mode 100644 index 000000000000..6421c1d39d92 --- /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] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +DfpManager manager = DfpManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/dfp/azure-resourcemanager-dfp/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/dfp/azure-resourcemanager-dfp/SAMPLE.md b/sdk/dfp/azure-resourcemanager-dfp/SAMPLE.md new file mode 100644 index 000000000000..c20f272f2258 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/SAMPLE.md @@ -0,0 +1,240 @@ +# 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 +import com.azure.core.util.Context; +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"), + 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", "testValue")) + .withAdministration( + new DfpInstanceAdministrators() + .withMembers(Arrays.asList("azsdktest@microsoft.com", "azsdktest2@microsoft.com"))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Instances_Delete + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### Instances_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### Instances_List + +```java +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} +``` + +### Instances_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### Instances_Update + +```java +import com.azure.core.util.Context; +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", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("testKey", "testValue")) + .withAdministration( + new DfpInstanceAdministrators() + .withMembers(Arrays.asList("azsdktest@microsoft.com", "azsdktest2@microsoft.com"))) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ResourceProvider_ListOperations + +```java +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} +``` + diff --git a/sdk/dfp/azure-resourcemanager-dfp/pom.xml b/sdk/dfp/azure-resourcemanager-dfp/pom.xml new file mode 100644 index 000000000000..689395edd472 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-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 + true + + + + com.azure + azure-core + 1.26.0 + + + com.azure + azure-core-management + 1.5.3 + + + 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..2360ddc390f3 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/DfpManager.java @@ -0,0 +1,259 @@ +// 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.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.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.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.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); + } + + /** + * 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 HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + 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 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."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.dfp") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new DfpManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Instances. */ + public Instances instances() { + if (this.instances == null) { + this.instances = new InstancesImpl(clientObject.getInstances(), this); + } + return instances; + } + + /** @return Resource collection API of ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** + * @return Wrapped service client Dfp providing direct access to the underlying auto-generated API implementation, + * based on Azure REST API. + */ + 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..5a3c47b68f5e --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/Dfp.java @@ -0,0 +1,61 @@ +// 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..2c4abc6cea96 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/InstancesClient.java @@ -0,0 +1,329 @@ +// 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. + * @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); + + /** + * 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); + + /** + * 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. + * @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); + + /** + * 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); +} 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..88f3cab26ca1 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/ResourceProvidersClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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..ac93bcb2daa2 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/CheckInstanceNameAvailabilityResultInner.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.fasterxml.jackson.annotation.JsonProperty; + +/** The checking result of DFP instance name availability. */ +@Fluent +public final class CheckInstanceNameAvailabilityResultInner { + /* + * Indicator of availability of the DFP instance name. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * The reason of unavailability. + */ + @JsonProperty(value = "reason") + private String reason; + + /* + * The detailed message of the request unavailability. + */ + @JsonProperty(value = "message") + private String message; + + /** + * 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() { + } +} 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..4f58d1a4363c --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/DfpInstanceInner.java @@ -0,0 +1,153 @@ +// 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.resourcemanager.dfp.models.DfpInstanceAdministrators; +import com.azure.resourcemanager.dfp.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ + @JsonProperty(value = "properties") + private DfpInstanceProperties innerProperties; + + /* + * Location of the DFP resource. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * Key-value pairs of additional resource provisioning properties. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Properties of the 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 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 + .logExceptionAsError( + new IllegalArgumentException("Missing required property location in model DfpInstanceInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DfpInstanceInner.class); +} 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..4520e56e2037 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/DfpInstanceMutableProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.dfp.models.DfpInstanceAdministrators; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An object that represents a set of mutable DFP resource properties. */ +@Fluent +public class DfpInstanceMutableProperties { + /* + * A collection of DFP instance administrators + */ + @JsonProperty(value = "administration") + private DfpInstanceAdministrators administration; + + /** + * 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(); + } + } +} 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..a590ab501fbf --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/DfpInstanceProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.dfp.models.DfpInstanceAdministrators; +import com.azure.resourcemanager.dfp.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** 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. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * 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() { + super.validate(); + } +} 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..30e2081566a6 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/OperationInner.java @@ -0,0 +1,121 @@ +// 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.resourcemanager.dfp.models.ActionType; +import com.azure.resourcemanager.dfp.models.OperationDisplay; +import com.azure.resourcemanager.dfp.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** REST API Operation Details of a REST API operation, returned from the Resource Provider Operations API. */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). + * Examples: "Microsoft.Compute/virtualMachines/write", + * "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for + * data-plane operations and "false" for ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access + * Control (RBAC) and audit logs UX. Default value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/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..b8f8bed5abed --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for 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..7f55dcf1ed98 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for 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..8ec5c6447d1a --- /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..d9d231b01f67 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/DfpBuilder.java @@ -0,0 +1,147 @@ +// 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.CookiePolicy; +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 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 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 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() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + DfpImpl client = + new DfpImpl(pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + 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..96aa92f40989 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/DfpImpl.java @@ -0,0 +1,312 @@ +// 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.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.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 java.util.Map; +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) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(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..f84f654c3785 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/DfpInstanceImpl.java @@ -0,0 +1,194 @@ +// 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 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.instanceName = Utils.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..60914cb782dd --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/InstancesClientImpl.java @@ -0,0 +1,1802 @@ +// 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") + private 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getByResourceGroupAsync(resourceGroupName, instanceName).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. + * @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(); + } + + /** + * 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 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 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 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 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 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 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 checkNameAvailabilityAsync(location, instanceParameters).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. + * @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(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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..6f177c960696 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/InstancesImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 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 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 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 Utils.mapPage(inner, inner1 -> new DfpInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new DfpInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DfpInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DfpInstanceImpl(inner1, this.manager())); + } + + 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 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 DfpInstance getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String instanceName = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String instanceName = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String instanceName = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String instanceName = Utils.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/ResourceProvidersClientImpl.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 000000000000..6b8bb2d62782 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,277 @@ +// 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") + private 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 nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> 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..f9fcf00bee54 --- /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 Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable listOperations(Context context) { + PagedIterable inner = this.serviceClient().listOperations(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private 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/Utils.java b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/Utils.java new file mode 100644 index 000000000000..076e9310a835 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/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..1fe81d4525a6 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for 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..c115b3c79ac1 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/ActionType.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ActionType. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** @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..e061fb0d4e3f --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/CheckInstanceNameAvailabilityParameters.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of DFP instance name request body. */ +@Fluent +public final class CheckInstanceNameAvailabilityParameters { + /* + * Name for checking availability. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The resource type of DFP instance. + */ + @JsonProperty(value = "type") + private String type; + + /** + * 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() { + } +} 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..b39f54176001 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/CheckInstanceNameAvailabilityResult.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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..52fb6b68f92b --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstance.java @@ -0,0 +1,236 @@ +// 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 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..0029b5a690b5 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstanceAdministrators.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** An array of administrator user identities. */ +@Fluent +public final class DfpInstanceAdministrators { + /* + * An array of administrator user identities. + */ + @JsonProperty(value = "members") + private List members; + + /** + * 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() { + } +} 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..9065ed71ae06 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstanceUpdateParameters.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.dfp.fluent.models.DfpInstanceMutableProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Provision request specification. */ +@Fluent +public final class DfpInstanceUpdateParameters { + /* + * Key-value pairs of additional provisioning properties. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Properties of the provision operation request + */ + @JsonProperty(value = "properties") + private DfpInstanceMutableProperties innerProperties; + + /** + * 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(); + } + } +} 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..babf645e6163 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/DfpInstances.java @@ -0,0 +1,73 @@ +// 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.resourcemanager.dfp.fluent.models.DfpInstanceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** An array of DFP instance resources. */ +@Fluent +public final class DfpInstances { + /* + * An array of DFP instance resources. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * 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 + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model DfpInstances")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DfpInstances.class); +} 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..48fe72cf4152 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/Instances.java @@ -0,0 +1,191 @@ +// 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. + * @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); + + /** + * 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); + + /** + * 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. + * @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); + + /** + * 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); + + /** + * 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..6b4b4c602a71 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/Operation.java @@ -0,0 +1,56 @@ +// 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..c9bba939ab61 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/OperationDisplay.java @@ -0,0 +1,89 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. + * "Microsoft Monitoring Insights" or "Microsoft Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this + * operation. E.g. "Virtual Machines" or "Job Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for + * dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual + * Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for + * tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/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..49196128a250 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/OperationListResult.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.core.annotation.Immutable; +import com.azure.resourcemanager.dfp.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/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..758b2ac66f6f --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/Origin.java @@ -0,0 +1,37 @@ +// 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 com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Origin. */ +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 or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** @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..12c2fe003318 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/ProvisioningState.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value 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 or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @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..8b051dacba2b --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/ResourceProviders.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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..856ff825b8b5 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for 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..f92fd7cb0e2c --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/com/azure/resourcemanager/dfp/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for 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..9f47a555be1e --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.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, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.dfp.models to + com.azure.core, + com.fasterxml.jackson.databind; +} 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..ec114aa1360d --- /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.core.util.Context; +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"), + 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..96ab83ab97e3 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesCreateSamples.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.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", "testValue")) + .withAdministration( + new DfpInstanceAdministrators() + .withMembers(Arrays.asList("azsdktest@microsoft.com", "azsdktest2@microsoft.com"))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/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..040b3148e20d --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.generated; + +import com.azure.core.util.Context; + +/** 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", 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..0c1a523e079f --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.generated; + +import com.azure.core.util.Context; + +/** 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", 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..49a41ef9bc62 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.generated; + +import com.azure.core.util.Context; + +/** 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", 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..975c4d54d42a --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.generated; + +import com.azure.core.util.Context; + +/** 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(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..dfb3ea7bfc74 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/InstancesUpdateSamples.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.generated; + +import com.azure.core.util.Context; +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", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("testKey", "testValue")) + .withAdministration( + new DfpInstanceAdministrators() + .withMembers(Arrays.asList("azsdktest@microsoft.com", "azsdktest2@microsoft.com"))) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/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..a1ae6ce17a47 --- /dev/null +++ b/sdk/dfp/azure-resourcemanager-dfp/src/samples/java/com/azure/resourcemanager/dfp/generated/ResourceProviderListOperationsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.dfp.generated; + +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} diff --git a/sdk/dfp/ci.yml b/sdk/dfp/ci.yml new file mode 100644 index 000000000000..b3cc4940fb73 --- /dev/null +++ b/sdk/dfp/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/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 + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: dfp + Artifacts: + - name: azure-resourcemanager-dfp + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdfp diff --git a/sdk/dfp/pom.xml b/sdk/dfp/pom.xml new file mode 100644 index 000000000000..39ea7dad63d1 --- /dev/null +++ b/sdk/dfp/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-dfp-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-dfp + + + +