diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 7f1506e5dae80..7240179ef9747 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -339,6 +339,7 @@ com.azure.resourcemanager:azure-resourcemanager-securityinsights;1.0.0-beta.1;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-servicelinker;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.1 diff --git a/pom.xml b/pom.xml index 0ce586ceb6e74..8bb0ccc7a5ccb 100644 --- a/pom.xml +++ b/pom.xml @@ -957,6 +957,7 @@ sdk/securityinsights sdk/servicebus sdk/servicefabric + sdk/servicelinker sdk/signalr sdk/spring sdk/sqlvirtualmachine diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/CHANGELOG.md b/sdk/servicelinker/azure-resourcemanager-servicelinker/CHANGELOG.md new file mode 100644 index 0000000000000..e48ca993cbcca --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-03-14) + +- Azure Resource Manager servicelinker client library for Java. This package contains Microsoft Azure SDK for servicelinker Management SDK. Microsoft.ServiceLinker provider. Package tag package-2022-01-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/servicelinker/azure-resourcemanager-servicelinker/README.md b/sdk/servicelinker/azure-resourcemanager-servicelinker/README.md new file mode 100644 index 0000000000000..94096a8321ad9 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager servicelinker client library for Java + +Azure Resource Manager servicelinker client library for Java. + +This package contains Microsoft Azure SDK for servicelinker Management SDK. Microsoft.ServiceLinker provider. Package tag package-2022-01-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-servicelinker;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-servicelinker + 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(); +ServicelinkerManager manager = ServicelinkerManager + .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/servicelinker/azure-resourcemanager-servicelinker/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/servicelinker/azure-resourcemanager-servicelinker/SAMPLE.md b/sdk/servicelinker/azure-resourcemanager-servicelinker/SAMPLE.md new file mode 100644 index 0000000000000..ddb35cfcd0e1d --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/SAMPLE.md @@ -0,0 +1,269 @@ +# Code snippets and samples + + +## Linker + +- [CreateOrUpdate](#linker_createorupdate) +- [Delete](#linker_delete) +- [Get](#linker_get) +- [List](#linker_list) +- [ListConfigurations](#linker_listconfigurations) +- [Update](#linker_update) +- [Validate](#linker_validate) + +## Operations + +- [List](#operations_list) +### Linker_CreateOrUpdate + +```java +import com.azure.resourcemanager.servicelinker.models.AzureResource; +import com.azure.resourcemanager.servicelinker.models.SecretAuthInfo; +import com.azure.resourcemanager.servicelinker.models.SecretStore; +import com.azure.resourcemanager.servicelinker.models.VNetSolution; +import com.azure.resourcemanager.servicelinker.models.VNetSolutionType; + +/** Samples for Linker CreateOrUpdate. */ +public final class LinkerCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/PutLinkWithServiceEndpoint.json + */ + /** + * Sample code: PutLinkWithServiceEndpoint. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void putLinkWithServiceEndpoint( + com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .define("linkName") + .withExistingResourceUri( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app") + .withTargetService( + new AzureResource() + .withId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db")) + .withAuthInfo(new SecretAuthInfo().withName("name").withSecret("secret")) + .withVNetSolution(new VNetSolution().withType(VNetSolutionType.SERVICE_ENDPOINT)) + .withSecretStore( + new SecretStore() + .withKeyVaultId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.KeyVault/vaults/test-kv")) + .create(); + } + + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/PutLink.json + */ + /** + * Sample code: PutLink. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void putLink(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .define("linkName") + .withExistingResourceUri( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app") + .withTargetService( + new AzureResource() + .withId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db")) + .withAuthInfo(new SecretAuthInfo().withName("name").withSecret("secret")) + .create(); + } +} +``` + +### Linker_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Linker Delete. */ +public final class LinkerDeleteSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/DeleteLink.json + */ + /** + * Sample code: DeleteLink. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void deleteLink(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .delete( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + "linkName", + Context.NONE); + } +} +``` + +### Linker_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Linker Get. */ +public final class LinkerGetSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/Link.json + */ + /** + * Sample code: Link. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void link(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .getWithResponse( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + "linkName", + Context.NONE); + } +} +``` + +### Linker_List + +```java +import com.azure.core.util.Context; + +/** Samples for Linker List. */ +public final class LinkerListSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/LinkList.json + */ + /** + * Sample code: LinkList. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void linkList(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + Context.NONE); + } +} +``` + +### Linker_ListConfigurations + +```java +import com.azure.core.util.Context; + +/** Samples for Linker ListConfigurations. */ +public final class LinkerListConfigurationsSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/GetConfigurations.json + */ + /** + * Sample code: GetConfiguration. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void getConfiguration(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .listConfigurationsWithResponse( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + "linkName", + Context.NONE); + } +} +``` + +### Linker_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicelinker.models.AzureResource; +import com.azure.resourcemanager.servicelinker.models.LinkerResource; +import com.azure.resourcemanager.servicelinker.models.ServicePrincipalSecretAuthInfo; + +/** Samples for Linker Update. */ +public final class LinkerUpdateSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/PatchLink.json + */ + /** + * Sample code: PatchLink. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void patchLink(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + LinkerResource resource = + manager + .linkers() + .getWithResponse( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + "linkName", + Context.NONE) + .getValue(); + resource + .update() + .withTargetService( + new AzureResource() + .withId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db")) + .withAuthInfo( + new ServicePrincipalSecretAuthInfo().withClientId("name").withPrincipalId("id").withSecret("secret")) + .apply(); + } +} +``` + +### Linker_Validate + +```java +import com.azure.core.util.Context; + +/** Samples for Linker Validate. */ +public final class LinkerValidateSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/ValidateLinkSuccess.json + */ + /** + * Sample code: ValidateLinkSuccess. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void validateLinkSuccess(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .validate( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + "linkName", + Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/OperationsList.json + */ + /** + * Sample code: GetConfiguration. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void getConfiguration(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/pom.xml b/sdk/servicelinker/azure-resourcemanager-servicelinker/pom.xml new file mode 100644 index 0000000000000..a7bebfe9c4acf --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/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-servicelinker + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for servicelinker Management + This package contains Microsoft Azure SDK for servicelinker Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft.ServiceLinker provider. Package tag package-2022-01-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/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/ServicelinkerManager.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/ServicelinkerManager.java new file mode 100644 index 0000000000000..a66579dd998e7 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/ServicelinkerManager.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker; + +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.servicelinker.fluent.MicrosoftServiceLinker; +import com.azure.resourcemanager.servicelinker.implementation.LinkersImpl; +import com.azure.resourcemanager.servicelinker.implementation.MicrosoftServiceLinkerBuilder; +import com.azure.resourcemanager.servicelinker.implementation.OperationsImpl; +import com.azure.resourcemanager.servicelinker.models.Linkers; +import com.azure.resourcemanager.servicelinker.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to ServicelinkerManager. Microsoft.ServiceLinker provider. */ +public final class ServicelinkerManager { + private Linkers linkers; + + private Operations operations; + + private final MicrosoftServiceLinker clientObject; + + private ServicelinkerManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new MicrosoftServiceLinkerBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of servicelinker service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the servicelinker service API instance. + */ + public static ServicelinkerManager 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 ServicelinkerManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ServicelinkerManager.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 servicelinker service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the servicelinker service API instance. + */ + public ServicelinkerManager 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.servicelinker") + .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 ServicelinkerManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Linkers. */ + public Linkers linkers() { + if (this.linkers == null) { + this.linkers = new LinkersImpl(clientObject.getLinkers(), this); + } + return linkers; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * @return Wrapped service client MicrosoftServiceLinker providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + public MicrosoftServiceLinker serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/LinkersClient.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/LinkersClient.java new file mode 100644 index 0000000000000..9b5b2e97cd6d8 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/LinkersClient.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.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.servicelinker.fluent.models.LinkerResourceInner; +import com.azure.resourcemanager.servicelinker.fluent.models.SourceConfigurationResultInner; +import com.azure.resourcemanager.servicelinker.fluent.models.ValidateResultInner; +import com.azure.resourcemanager.servicelinker.models.LinkerPatch; + +/** An instance of this class provides access to all the operations defined in LinkersClient. */ +public interface LinkersClient { + /** + * Returns list of Linkers which connects to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @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 list of Linker as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * Returns list of Linkers which connects to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @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 list of Linker as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, Context context); + + /** + * Returns Linker resource for a given name. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkerResourceInner get(String resourceUri, String linkerName); + + /** + * Returns Linker resource for a given name. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 linker of source and target resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String linkerName, Context context); + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LinkerResourceInner> beginCreateOrUpdate( + String resourceUri, String linkerName, LinkerResourceInner parameters); + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LinkerResourceInner> beginCreateOrUpdate( + String resourceUri, String linkerName, LinkerResourceInner parameters, Context context); + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkerResourceInner createOrUpdate(String resourceUri, String linkerName, LinkerResourceInner parameters); + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkerResourceInner createOrUpdate( + String resourceUri, String linkerName, LinkerResourceInner parameters, Context context); + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName); + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName, Context context); + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName); + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName, Context context); + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LinkerResourceInner> beginUpdate( + String resourceUri, String linkerName, LinkerPatch parameters); + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LinkerResourceInner> beginUpdate( + String resourceUri, String linkerName, LinkerPatch parameters, Context context); + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkerResourceInner update(String resourceUri, String linkerName, LinkerPatch parameters); + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkerResourceInner update(String resourceUri, String linkerName, LinkerPatch parameters, Context context); + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 the validation result for a linker. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ValidateResultInner> beginValidate( + String resourceUri, String linkerName); + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 the validation result for a linker. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ValidateResultInner> beginValidate( + String resourceUri, String linkerName, Context context); + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 validation result for a linker. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ValidateResultInner validate(String resourceUri, String linkerName); + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 validation result for a linker. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ValidateResultInner validate(String resourceUri, String linkerName, Context context); + + /** + * list source configurations for a linker. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 configurations for source resource, include appSettings, connectionString and serviceBindings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SourceConfigurationResultInner listConfigurations(String resourceUri, String linkerName); + + /** + * list source configurations for a linker. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 configurations for source resource, include appSettings, connectionString and serviceBindings along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listConfigurationsWithResponse( + String resourceUri, String linkerName, Context context); +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/MicrosoftServiceLinker.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/MicrosoftServiceLinker.java new file mode 100644 index 0000000000000..4d6d24de48feb --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/MicrosoftServiceLinker.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for MicrosoftServiceLinker class. */ +public interface MicrosoftServiceLinker { + /** + * 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 LinkersClient object to access its operations. + * + * @return the LinkersClient object. + */ + LinkersClient getLinkers(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/OperationsClient.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/OperationsClient.java new file mode 100644 index 0000000000000..3ab76039aba2e --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/OperationsClient.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.servicelinker.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.servicelinker.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists the available ServiceLinker 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 list(); + + /** + * Lists the available ServiceLinker 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 list(Context context); +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/LinkerProperties.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/LinkerProperties.java new file mode 100644 index 0000000000000..44ef47e9ee44d --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/LinkerProperties.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicelinker.models.AuthInfoBase; +import com.azure.resourcemanager.servicelinker.models.ClientType; +import com.azure.resourcemanager.servicelinker.models.SecretStore; +import com.azure.resourcemanager.servicelinker.models.TargetServiceBase; +import com.azure.resourcemanager.servicelinker.models.VNetSolution; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the linker. */ +@Fluent +public final class LinkerProperties { + /* + * The target service properties + */ + @JsonProperty(value = "targetService") + private TargetServiceBase targetService; + + /* + * The authentication type. + */ + @JsonProperty(value = "authInfo") + private AuthInfoBase authInfo; + + /* + * The application client type + */ + @JsonProperty(value = "clientType") + private ClientType clientType; + + /* + * The provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The VNet solution. + */ + @JsonProperty(value = "vNetSolution") + private VNetSolution vNetSolution; + + /* + * An option to store secret value in secure place + */ + @JsonProperty(value = "secretStore") + private SecretStore secretStore; + + /* + * connection scope in source service. + */ + @JsonProperty(value = "scope") + private String scope; + + /** + * Get the targetService property: The target service properties. + * + * @return the targetService value. + */ + public TargetServiceBase targetService() { + return this.targetService; + } + + /** + * Set the targetService property: The target service properties. + * + * @param targetService the targetService value to set. + * @return the LinkerProperties object itself. + */ + public LinkerProperties withTargetService(TargetServiceBase targetService) { + this.targetService = targetService; + return this; + } + + /** + * Get the authInfo property: The authentication type. + * + * @return the authInfo value. + */ + public AuthInfoBase authInfo() { + return this.authInfo; + } + + /** + * Set the authInfo property: The authentication type. + * + * @param authInfo the authInfo value to set. + * @return the LinkerProperties object itself. + */ + public LinkerProperties withAuthInfo(AuthInfoBase authInfo) { + this.authInfo = authInfo; + return this; + } + + /** + * Get the clientType property: The application client type. + * + * @return the clientType value. + */ + public ClientType clientType() { + return this.clientType; + } + + /** + * Set the clientType property: The application client type. + * + * @param clientType the clientType value to set. + * @return the LinkerProperties object itself. + */ + public LinkerProperties withClientType(ClientType clientType) { + this.clientType = clientType; + return this; + } + + /** + * Get the provisioningState property: The provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the vNetSolution property: The VNet solution. + * + * @return the vNetSolution value. + */ + public VNetSolution vNetSolution() { + return this.vNetSolution; + } + + /** + * Set the vNetSolution property: The VNet solution. + * + * @param vNetSolution the vNetSolution value to set. + * @return the LinkerProperties object itself. + */ + public LinkerProperties withVNetSolution(VNetSolution vNetSolution) { + this.vNetSolution = vNetSolution; + return this; + } + + /** + * Get the secretStore property: An option to store secret value in secure place. + * + * @return the secretStore value. + */ + public SecretStore secretStore() { + return this.secretStore; + } + + /** + * Set the secretStore property: An option to store secret value in secure place. + * + * @param secretStore the secretStore value to set. + * @return the LinkerProperties object itself. + */ + public LinkerProperties withSecretStore(SecretStore secretStore) { + this.secretStore = secretStore; + return this; + } + + /** + * Get the scope property: connection scope in source service. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: connection scope in source service. + * + * @param scope the scope value to set. + * @return the LinkerProperties object itself. + */ + public LinkerProperties withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetService() != null) { + targetService().validate(); + } + if (authInfo() != null) { + authInfo().validate(); + } + if (vNetSolution() != null) { + vNetSolution().validate(); + } + if (secretStore() != null) { + secretStore().validate(); + } + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/LinkerResourceInner.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/LinkerResourceInner.java new file mode 100644 index 0000000000000..44f17614df63e --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/LinkerResourceInner.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.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.servicelinker.models.AuthInfoBase; +import com.azure.resourcemanager.servicelinker.models.ClientType; +import com.azure.resourcemanager.servicelinker.models.SecretStore; +import com.azure.resourcemanager.servicelinker.models.TargetServiceBase; +import com.azure.resourcemanager.servicelinker.models.VNetSolution; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Linker of source and target resource. */ +@Fluent +public final class LinkerResourceInner extends ProxyResource { + /* + * The properties of the linker. + */ + @JsonProperty(value = "properties", required = true) + private LinkerProperties innerProperties = new LinkerProperties(); + + /* + * The system data. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: The properties of the linker. + * + * @return the innerProperties value. + */ + private LinkerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the targetService property: The target service properties. + * + * @return the targetService value. + */ + public TargetServiceBase targetService() { + return this.innerProperties() == null ? null : this.innerProperties().targetService(); + } + + /** + * Set the targetService property: The target service properties. + * + * @param targetService the targetService value to set. + * @return the LinkerResourceInner object itself. + */ + public LinkerResourceInner withTargetService(TargetServiceBase targetService) { + if (this.innerProperties() == null) { + this.innerProperties = new LinkerProperties(); + } + this.innerProperties().withTargetService(targetService); + return this; + } + + /** + * Get the authInfo property: The authentication type. + * + * @return the authInfo value. + */ + public AuthInfoBase authInfo() { + return this.innerProperties() == null ? null : this.innerProperties().authInfo(); + } + + /** + * Set the authInfo property: The authentication type. + * + * @param authInfo the authInfo value to set. + * @return the LinkerResourceInner object itself. + */ + public LinkerResourceInner withAuthInfo(AuthInfoBase authInfo) { + if (this.innerProperties() == null) { + this.innerProperties = new LinkerProperties(); + } + this.innerProperties().withAuthInfo(authInfo); + return this; + } + + /** + * Get the clientType property: The application client type. + * + * @return the clientType value. + */ + public ClientType clientType() { + return this.innerProperties() == null ? null : this.innerProperties().clientType(); + } + + /** + * Set the clientType property: The application client type. + * + * @param clientType the clientType value to set. + * @return the LinkerResourceInner object itself. + */ + public LinkerResourceInner withClientType(ClientType clientType) { + if (this.innerProperties() == null) { + this.innerProperties = new LinkerProperties(); + } + this.innerProperties().withClientType(clientType); + return this; + } + + /** + * Get the provisioningState property: The provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the vNetSolution property: The VNet solution. + * + * @return the vNetSolution value. + */ + public VNetSolution vNetSolution() { + return this.innerProperties() == null ? null : this.innerProperties().vNetSolution(); + } + + /** + * Set the vNetSolution property: The VNet solution. + * + * @param vNetSolution the vNetSolution value to set. + * @return the LinkerResourceInner object itself. + */ + public LinkerResourceInner withVNetSolution(VNetSolution vNetSolution) { + if (this.innerProperties() == null) { + this.innerProperties = new LinkerProperties(); + } + this.innerProperties().withVNetSolution(vNetSolution); + return this; + } + + /** + * Get the secretStore property: An option to store secret value in secure place. + * + * @return the secretStore value. + */ + public SecretStore secretStore() { + return this.innerProperties() == null ? null : this.innerProperties().secretStore(); + } + + /** + * Set the secretStore property: An option to store secret value in secure place. + * + * @param secretStore the secretStore value to set. + * @return the LinkerResourceInner object itself. + */ + public LinkerResourceInner withSecretStore(SecretStore secretStore) { + if (this.innerProperties() == null) { + this.innerProperties = new LinkerProperties(); + } + this.innerProperties().withSecretStore(secretStore); + return this; + } + + /** + * Get the scope property: connection scope in source service. + * + * @return the scope value. + */ + public String scope() { + return this.innerProperties() == null ? null : this.innerProperties().scope(); + } + + /** + * Set the scope property: connection scope in source service. + * + * @param scope the scope value to set. + * @return the LinkerResourceInner object itself. + */ + public LinkerResourceInner withScope(String scope) { + if (this.innerProperties() == null) { + this.innerProperties = new LinkerProperties(); + } + this.innerProperties().withScope(scope); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model LinkerResourceInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LinkerResourceInner.class); +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/OperationInner.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..3d520cb77233f --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/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.servicelinker.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicelinker.models.ActionType; +import com.azure.resourcemanager.servicelinker.models.OperationDisplay; +import com.azure.resourcemanager.servicelinker.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/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/SourceConfigurationResultInner.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/SourceConfigurationResultInner.java new file mode 100644 index 0000000000000..aa517497546a6 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/SourceConfigurationResultInner.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicelinker.models.SourceConfiguration; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Configurations for source resource, include appSettings, connectionString and serviceBindings. */ +@Fluent +public final class SourceConfigurationResultInner { + /* + * The configuration properties for source resource. + */ + @JsonProperty(value = "configurations") + private List configurations; + + /** + * Get the configurations property: The configuration properties for source resource. + * + * @return the configurations value. + */ + public List configurations() { + return this.configurations; + } + + /** + * Set the configurations property: The configuration properties for source resource. + * + * @param configurations the configurations value to set. + * @return the SourceConfigurationResultInner object itself. + */ + public SourceConfigurationResultInner withConfigurations(List configurations) { + this.configurations = configurations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (configurations() != null) { + configurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/ValidateResultInner.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/ValidateResultInner.java new file mode 100644 index 0000000000000..608ee2d746039 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/ValidateResultInner.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicelinker.models.AuthType; +import com.azure.resourcemanager.servicelinker.models.ValidationResultItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The validation result for a linker. */ +@Fluent +public final class ValidateResultInner { + /* + * The linker name. + */ + @JsonProperty(value = "linkerName") + private String linkerName; + + /* + * A boolean value indicating whether the connection is available or not + */ + @JsonProperty(value = "isConnectionAvailable") + private Boolean isConnectionAvailable; + + /* + * The start time of the validation report. + */ + @JsonProperty(value = "reportStartTimeUtc") + private OffsetDateTime reportStartTimeUtc; + + /* + * The end time of the validation report. + */ + @JsonProperty(value = "reportEndTimeUtc") + private OffsetDateTime reportEndTimeUtc; + + /* + * The resource id of the linker source application. + */ + @JsonProperty(value = "sourceId") + private String sourceId; + + /* + * The resource Id of target service. + */ + @JsonProperty(value = "targetId") + private String targetId; + + /* + * The authentication type. + */ + @JsonProperty(value = "authType") + private AuthType authType; + + /* + * The detail of validation result + */ + @JsonProperty(value = "validationDetail") + private List validationDetail; + + /** + * Get the linkerName property: The linker name. + * + * @return the linkerName value. + */ + public String linkerName() { + return this.linkerName; + } + + /** + * Set the linkerName property: The linker name. + * + * @param linkerName the linkerName value to set. + * @return the ValidateResultInner object itself. + */ + public ValidateResultInner withLinkerName(String linkerName) { + this.linkerName = linkerName; + return this; + } + + /** + * Get the isConnectionAvailable property: A boolean value indicating whether the connection is available or not. + * + * @return the isConnectionAvailable value. + */ + public Boolean isConnectionAvailable() { + return this.isConnectionAvailable; + } + + /** + * Set the isConnectionAvailable property: A boolean value indicating whether the connection is available or not. + * + * @param isConnectionAvailable the isConnectionAvailable value to set. + * @return the ValidateResultInner object itself. + */ + public ValidateResultInner withIsConnectionAvailable(Boolean isConnectionAvailable) { + this.isConnectionAvailable = isConnectionAvailable; + return this; + } + + /** + * Get the reportStartTimeUtc property: The start time of the validation report. + * + * @return the reportStartTimeUtc value. + */ + public OffsetDateTime reportStartTimeUtc() { + return this.reportStartTimeUtc; + } + + /** + * Set the reportStartTimeUtc property: The start time of the validation report. + * + * @param reportStartTimeUtc the reportStartTimeUtc value to set. + * @return the ValidateResultInner object itself. + */ + public ValidateResultInner withReportStartTimeUtc(OffsetDateTime reportStartTimeUtc) { + this.reportStartTimeUtc = reportStartTimeUtc; + return this; + } + + /** + * Get the reportEndTimeUtc property: The end time of the validation report. + * + * @return the reportEndTimeUtc value. + */ + public OffsetDateTime reportEndTimeUtc() { + return this.reportEndTimeUtc; + } + + /** + * Set the reportEndTimeUtc property: The end time of the validation report. + * + * @param reportEndTimeUtc the reportEndTimeUtc value to set. + * @return the ValidateResultInner object itself. + */ + public ValidateResultInner withReportEndTimeUtc(OffsetDateTime reportEndTimeUtc) { + this.reportEndTimeUtc = reportEndTimeUtc; + return this; + } + + /** + * Get the sourceId property: The resource id of the linker source application. + * + * @return the sourceId value. + */ + public String sourceId() { + return this.sourceId; + } + + /** + * Set the sourceId property: The resource id of the linker source application. + * + * @param sourceId the sourceId value to set. + * @return the ValidateResultInner object itself. + */ + public ValidateResultInner withSourceId(String sourceId) { + this.sourceId = sourceId; + return this; + } + + /** + * Get the targetId property: The resource Id of target service. + * + * @return the targetId value. + */ + public String targetId() { + return this.targetId; + } + + /** + * Set the targetId property: The resource Id of target service. + * + * @param targetId the targetId value to set. + * @return the ValidateResultInner object itself. + */ + public ValidateResultInner withTargetId(String targetId) { + this.targetId = targetId; + return this; + } + + /** + * Get the authType property: The authentication type. + * + * @return the authType value. + */ + public AuthType authType() { + return this.authType; + } + + /** + * Set the authType property: The authentication type. + * + * @param authType the authType value to set. + * @return the ValidateResultInner object itself. + */ + public ValidateResultInner withAuthType(AuthType authType) { + this.authType = authType; + return this; + } + + /** + * Get the validationDetail property: The detail of validation result. + * + * @return the validationDetail value. + */ + public List validationDetail() { + return this.validationDetail; + } + + /** + * Set the validationDetail property: The detail of validation result. + * + * @param validationDetail the validationDetail value to set. + * @return the ValidateResultInner object itself. + */ + public ValidateResultInner withValidationDetail(List validationDetail) { + this.validationDetail = validationDetail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (validationDetail() != null) { + validationDetail().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/package-info.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/package-info.java new file mode 100644 index 0000000000000..090e6c401c63c --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for MicrosoftServiceLinker. Microsoft.ServiceLinker provider. */ +package com.azure.resourcemanager.servicelinker.fluent.models; diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/package-info.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/package-info.java new file mode 100644 index 0000000000000..f9fa8019b5cd2 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for MicrosoftServiceLinker. Microsoft.ServiceLinker provider. */ +package com.azure.resourcemanager.servicelinker.fluent; diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/LinkerResourceImpl.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/LinkerResourceImpl.java new file mode 100644 index 0000000000000..a90ad16451b50 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/LinkerResourceImpl.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicelinker.fluent.models.LinkerResourceInner; +import com.azure.resourcemanager.servicelinker.models.AuthInfoBase; +import com.azure.resourcemanager.servicelinker.models.ClientType; +import com.azure.resourcemanager.servicelinker.models.LinkerPatch; +import com.azure.resourcemanager.servicelinker.models.LinkerResource; +import com.azure.resourcemanager.servicelinker.models.SecretStore; +import com.azure.resourcemanager.servicelinker.models.SourceConfigurationResult; +import com.azure.resourcemanager.servicelinker.models.TargetServiceBase; +import com.azure.resourcemanager.servicelinker.models.VNetSolution; +import com.azure.resourcemanager.servicelinker.models.ValidateResult; + +public final class LinkerResourceImpl implements LinkerResource, LinkerResource.Definition, LinkerResource.Update { + private LinkerResourceInner innerObject; + + private final com.azure.resourcemanager.servicelinker.ServicelinkerManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public TargetServiceBase targetService() { + return this.innerModel().targetService(); + } + + public AuthInfoBase authInfo() { + return this.innerModel().authInfo(); + } + + public ClientType clientType() { + return this.innerModel().clientType(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public VNetSolution vNetSolution() { + return this.innerModel().vNetSolution(); + } + + public SecretStore secretStore() { + return this.innerModel().secretStore(); + } + + public String scope() { + return this.innerModel().scope(); + } + + public LinkerResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicelinker.ServicelinkerManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String linkerName; + + private LinkerPatch updateParameters; + + public LinkerResourceImpl withExistingResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + public LinkerResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getLinkers() + .createOrUpdate(resourceUri, linkerName, this.innerModel(), Context.NONE); + return this; + } + + public LinkerResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLinkers() + .createOrUpdate(resourceUri, linkerName, this.innerModel(), context); + return this; + } + + LinkerResourceImpl(String name, com.azure.resourcemanager.servicelinker.ServicelinkerManager serviceManager) { + this.innerObject = new LinkerResourceInner(); + this.serviceManager = serviceManager; + this.linkerName = name; + } + + public LinkerResourceImpl update() { + this.updateParameters = new LinkerPatch(); + return this; + } + + public LinkerResource apply() { + this.innerObject = + serviceManager.serviceClient().getLinkers().update(resourceUri, linkerName, updateParameters, Context.NONE); + return this; + } + + public LinkerResource apply(Context context) { + this.innerObject = + serviceManager.serviceClient().getLinkers().update(resourceUri, linkerName, updateParameters, context); + return this; + } + + LinkerResourceImpl( + LinkerResourceInner innerObject, com.azure.resourcemanager.servicelinker.ServicelinkerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceUri = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}", + "resourceUri"); + this.linkerName = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}", + "linkerName"); + } + + public LinkerResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getLinkers() + .getWithResponse(resourceUri, linkerName, Context.NONE) + .getValue(); + return this; + } + + public LinkerResource refresh(Context context) { + this.innerObject = + serviceManager.serviceClient().getLinkers().getWithResponse(resourceUri, linkerName, context).getValue(); + return this; + } + + public ValidateResult validate() { + return serviceManager.linkers().validate(resourceUri, linkerName); + } + + public ValidateResult validate(Context context) { + return serviceManager.linkers().validate(resourceUri, linkerName, context); + } + + public SourceConfigurationResult listConfigurations() { + return serviceManager.linkers().listConfigurations(resourceUri, linkerName); + } + + public Response listConfigurationsWithResponse(Context context) { + return serviceManager.linkers().listConfigurationsWithResponse(resourceUri, linkerName, context); + } + + public LinkerResourceImpl withTargetService(TargetServiceBase targetService) { + if (isInCreateMode()) { + this.innerModel().withTargetService(targetService); + return this; + } else { + this.updateParameters.withTargetService(targetService); + return this; + } + } + + public LinkerResourceImpl withAuthInfo(AuthInfoBase authInfo) { + if (isInCreateMode()) { + this.innerModel().withAuthInfo(authInfo); + return this; + } else { + this.updateParameters.withAuthInfo(authInfo); + return this; + } + } + + public LinkerResourceImpl withClientType(ClientType clientType) { + if (isInCreateMode()) { + this.innerModel().withClientType(clientType); + return this; + } else { + this.updateParameters.withClientType(clientType); + return this; + } + } + + public LinkerResourceImpl withVNetSolution(VNetSolution vNetSolution) { + if (isInCreateMode()) { + this.innerModel().withVNetSolution(vNetSolution); + return this; + } else { + this.updateParameters.withVNetSolution(vNetSolution); + return this; + } + } + + public LinkerResourceImpl withSecretStore(SecretStore secretStore) { + if (isInCreateMode()) { + this.innerModel().withSecretStore(secretStore); + return this; + } else { + this.updateParameters.withSecretStore(secretStore); + return this; + } + } + + public LinkerResourceImpl withScope(String scope) { + if (isInCreateMode()) { + this.innerModel().withScope(scope); + return this; + } else { + this.updateParameters.withScope(scope); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/LinkersClientImpl.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/LinkersClientImpl.java new file mode 100644 index 0000000000000..433adc6d99ed3 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/LinkersClientImpl.java @@ -0,0 +1,1543 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.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.servicelinker.fluent.LinkersClient; +import com.azure.resourcemanager.servicelinker.fluent.models.LinkerResourceInner; +import com.azure.resourcemanager.servicelinker.fluent.models.SourceConfigurationResultInner; +import com.azure.resourcemanager.servicelinker.fluent.models.ValidateResultInner; +import com.azure.resourcemanager.servicelinker.models.LinkerList; +import com.azure.resourcemanager.servicelinker.models.LinkerPatch; +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 LinkersClient. */ +public final class LinkersClientImpl implements LinkersClient { + /** The proxy service used to perform REST calls. */ + private final LinkersService service; + + /** The service client containing this operation class. */ + private final MicrosoftServiceLinkerImpl client; + + /** + * Initializes an instance of LinkersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LinkersClientImpl(MicrosoftServiceLinkerImpl client) { + this.service = RestProxy.create(LinkersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftServiceLinkerLinkers to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftServiceLink") + private interface LinkersService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.ServiceLinker/linkers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @PathParam("linkerName") String linkerName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @PathParam("linkerName") String linkerName, + @BodyParam("application/json") LinkerResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @PathParam("linkerName") String linkerName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @PathParam("linkerName") String linkerName, + @BodyParam("application/json") LinkerPatch parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> validate( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @PathParam("linkerName") String linkerName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/listConfigurations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listConfigurations( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @PathParam("linkerName") String linkerName, + @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); + } + + /** + * Returns list of Linkers which connects to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @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 list of Linker along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.list(this.client.getEndpoint(), resourceUri, 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())); + } + + /** + * Returns list of Linkers which connects to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @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 list of Linker along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns list of Linkers which connects to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @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 list of Linker as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns list of Linkers which connects to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @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 list of Linker as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns list of Linkers which connects to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @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 list of Linker as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + return new PagedIterable<>(listAsync(resourceUri)); + } + + /** + * Returns list of Linkers which connects to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @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 list of Linker as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri, Context context) { + return new PagedIterable<>(listAsync(resourceUri, context)); + } + + /** + * Returns Linker resource for a given name. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 linker of source and target resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String linkerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (linkerName == null) { + return Mono.error(new IllegalArgumentException("Parameter linkerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + linkerName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns Linker resource for a given name. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 linker of source and target resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceUri, String linkerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (linkerName == null) { + return Mono.error(new IllegalArgumentException("Parameter linkerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), linkerName, accept, context); + } + + /** + * Returns Linker resource for a given name. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 linker of source and target resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String linkerName) { + return getWithResponseAsync(resourceUri, linkerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns Linker resource for a given name. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LinkerResourceInner get(String resourceUri, String linkerName) { + return getAsync(resourceUri, linkerName).block(); + } + + /** + * Returns Linker resource for a given name. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 linker of source and target resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String linkerName, Context context) { + return getWithResponseAsync(resourceUri, linkerName, context).block(); + } + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceUri, String linkerName, LinkerResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (linkerName == null) { + return Mono.error(new IllegalArgumentException("Parameter linkerName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + linkerName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceUri, String linkerName, LinkerResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (linkerName == null) { + return Mono.error(new IllegalArgumentException("Parameter linkerName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + linkerName, + parameters, + accept, + context); + } + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LinkerResourceInner> beginCreateOrUpdateAsync( + String resourceUri, String linkerName, LinkerResourceInner parameters) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceUri, linkerName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LinkerResourceInner.class, + LinkerResourceInner.class, + this.client.getContext()); + } + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LinkerResourceInner> beginCreateOrUpdateAsync( + String resourceUri, String linkerName, LinkerResourceInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceUri, linkerName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), LinkerResourceInner.class, LinkerResourceInner.class, context); + } + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LinkerResourceInner> beginCreateOrUpdate( + String resourceUri, String linkerName, LinkerResourceInner parameters) { + return beginCreateOrUpdateAsync(resourceUri, linkerName, parameters).getSyncPoller(); + } + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LinkerResourceInner> beginCreateOrUpdate( + String resourceUri, String linkerName, LinkerResourceInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceUri, linkerName, parameters, context).getSyncPoller(); + } + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceUri, String linkerName, LinkerResourceInner parameters) { + return beginCreateOrUpdateAsync(resourceUri, linkerName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceUri, String linkerName, LinkerResourceInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceUri, linkerName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LinkerResourceInner createOrUpdate(String resourceUri, String linkerName, LinkerResourceInner parameters) { + return createOrUpdateAsync(resourceUri, linkerName, parameters).block(); + } + + /** + * Create or update linker resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LinkerResourceInner createOrUpdate( + String resourceUri, String linkerName, LinkerResourceInner parameters, Context context) { + return createOrUpdateAsync(resourceUri, linkerName, parameters, context).block(); + } + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (linkerName == null) { + return Mono.error(new IllegalArgumentException("Parameter linkerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + linkerName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (linkerName == null) { + return Mono.error(new IllegalArgumentException("Parameter linkerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete(this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), linkerName, accept, context); + } + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName) { + Mono>> mono = deleteWithResponseAsync(resourceUri, linkerName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceUri, linkerName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName) { + return beginDeleteAsync(resourceUri, linkerName).getSyncPoller(); + } + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName, Context context) { + return beginDeleteAsync(resourceUri, linkerName, context).getSyncPoller(); + } + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName) { + return beginDeleteAsync(resourceUri, linkerName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName, Context context) { + return beginDeleteAsync(resourceUri, linkerName, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName) { + deleteAsync(resourceUri, linkerName).block(); + } + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName, Context context) { + deleteAsync(resourceUri, linkerName, context).block(); + } + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceUri, String linkerName, LinkerPatch parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (linkerName == null) { + return Mono.error(new IllegalArgumentException("Parameter linkerName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + linkerName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceUri, String linkerName, LinkerPatch parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (linkerName == null) { + return Mono.error(new IllegalArgumentException("Parameter linkerName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + linkerName, + parameters, + accept, + context); + } + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LinkerResourceInner> beginUpdateAsync( + String resourceUri, String linkerName, LinkerPatch parameters) { + Mono>> mono = updateWithResponseAsync(resourceUri, linkerName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LinkerResourceInner.class, + LinkerResourceInner.class, + this.client.getContext()); + } + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LinkerResourceInner> beginUpdateAsync( + String resourceUri, String linkerName, LinkerPatch parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceUri, linkerName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), LinkerResourceInner.class, LinkerResourceInner.class, context); + } + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LinkerResourceInner> beginUpdate( + String resourceUri, String linkerName, LinkerPatch parameters) { + return beginUpdateAsync(resourceUri, linkerName, parameters).getSyncPoller(); + } + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LinkerResourceInner> beginUpdate( + String resourceUri, String linkerName, LinkerPatch parameters, Context context) { + return beginUpdateAsync(resourceUri, linkerName, parameters, context).getSyncPoller(); + } + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceUri, String linkerName, LinkerPatch parameters) { + return beginUpdateAsync(resourceUri, linkerName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceUri, String linkerName, LinkerPatch parameters, Context context) { + return beginUpdateAsync(resourceUri, linkerName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LinkerResourceInner update(String resourceUri, String linkerName, LinkerPatch parameters) { + return updateAsync(resourceUri, linkerName, parameters).block(); + } + + /** + * Operation to update an existing link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @param parameters Linker details. + * @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 linker of source and target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LinkerResourceInner update(String resourceUri, String linkerName, LinkerPatch parameters, Context context) { + return updateAsync(resourceUri, linkerName, parameters, context).block(); + } + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 validation result for a linker along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateWithResponseAsync(String resourceUri, String linkerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (linkerName == null) { + return Mono.error(new IllegalArgumentException("Parameter linkerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .validate( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + linkerName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 validation result for a linker along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateWithResponseAsync( + String resourceUri, String linkerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (linkerName == null) { + return Mono.error(new IllegalArgumentException("Parameter linkerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .validate(this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), linkerName, accept, context); + } + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 the validation result for a linker. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ValidateResultInner> beginValidateAsync( + String resourceUri, String linkerName) { + Mono>> mono = validateWithResponseAsync(resourceUri, linkerName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ValidateResultInner.class, + ValidateResultInner.class, + this.client.getContext()); + } + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 the validation result for a linker. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ValidateResultInner> beginValidateAsync( + String resourceUri, String linkerName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = validateWithResponseAsync(resourceUri, linkerName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ValidateResultInner.class, ValidateResultInner.class, context); + } + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 the validation result for a linker. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ValidateResultInner> beginValidate( + String resourceUri, String linkerName) { + return beginValidateAsync(resourceUri, linkerName).getSyncPoller(); + } + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 the validation result for a linker. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ValidateResultInner> beginValidate( + String resourceUri, String linkerName, Context context) { + return beginValidateAsync(resourceUri, linkerName, context).getSyncPoller(); + } + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 validation result for a linker on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAsync(String resourceUri, String linkerName) { + return beginValidateAsync(resourceUri, linkerName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 validation result for a linker on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAsync(String resourceUri, String linkerName, Context context) { + return beginValidateAsync(resourceUri, linkerName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 validation result for a linker. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ValidateResultInner validate(String resourceUri, String linkerName) { + return validateAsync(resourceUri, linkerName).block(); + } + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 validation result for a linker. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ValidateResultInner validate(String resourceUri, String linkerName, Context context) { + return validateAsync(resourceUri, linkerName, context).block(); + } + + /** + * list source configurations for a linker. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 configurations for source resource, include appSettings, connectionString and serviceBindings along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConfigurationsWithResponseAsync( + String resourceUri, String linkerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (linkerName == null) { + return Mono.error(new IllegalArgumentException("Parameter linkerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listConfigurations( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + linkerName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * list source configurations for a linker. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 configurations for source resource, include appSettings, connectionString and serviceBindings along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConfigurationsWithResponseAsync( + String resourceUri, String linkerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (linkerName == null) { + return Mono.error(new IllegalArgumentException("Parameter linkerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listConfigurations( + this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), linkerName, accept, context); + } + + /** + * list source configurations for a linker. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 configurations for source resource, include appSettings, connectionString and serviceBindings on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listConfigurationsAsync(String resourceUri, String linkerName) { + return listConfigurationsWithResponseAsync(resourceUri, linkerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * list source configurations for a linker. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 configurations for source resource, include appSettings, connectionString and serviceBindings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SourceConfigurationResultInner listConfigurations(String resourceUri, String linkerName) { + return listConfigurationsAsync(resourceUri, linkerName).block(); + } + + /** + * list source configurations for a linker. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 configurations for source resource, include appSettings, connectionString and serviceBindings along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listConfigurationsWithResponse( + String resourceUri, String linkerName, Context context) { + return listConfigurationsWithResponseAsync(resourceUri, linkerName, 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 the list of Linker 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 the list of Linker 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/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/LinkersImpl.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/LinkersImpl.java new file mode 100644 index 0000000000000..89ec255383d65 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/LinkersImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.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.servicelinker.fluent.LinkersClient; +import com.azure.resourcemanager.servicelinker.fluent.models.LinkerResourceInner; +import com.azure.resourcemanager.servicelinker.fluent.models.SourceConfigurationResultInner; +import com.azure.resourcemanager.servicelinker.fluent.models.ValidateResultInner; +import com.azure.resourcemanager.servicelinker.models.LinkerResource; +import com.azure.resourcemanager.servicelinker.models.Linkers; +import com.azure.resourcemanager.servicelinker.models.SourceConfigurationResult; +import com.azure.resourcemanager.servicelinker.models.ValidateResult; + +public final class LinkersImpl implements Linkers { + private static final ClientLogger LOGGER = new ClientLogger(LinkersImpl.class); + + private final LinkersClient innerClient; + + private final com.azure.resourcemanager.servicelinker.ServicelinkerManager serviceManager; + + public LinkersImpl( + LinkersClient innerClient, com.azure.resourcemanager.servicelinker.ServicelinkerManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return Utils.mapPage(inner, inner1 -> new LinkerResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, context); + return Utils.mapPage(inner, inner1 -> new LinkerResourceImpl(inner1, this.manager())); + } + + public LinkerResource get(String resourceUri, String linkerName) { + LinkerResourceInner inner = this.serviceClient().get(resourceUri, linkerName); + if (inner != null) { + return new LinkerResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String resourceUri, String linkerName, Context context) { + Response inner = this.serviceClient().getWithResponse(resourceUri, linkerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LinkerResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceUri, String linkerName) { + this.serviceClient().delete(resourceUri, linkerName); + } + + public void delete(String resourceUri, String linkerName, Context context) { + this.serviceClient().delete(resourceUri, linkerName, context); + } + + public ValidateResult validate(String resourceUri, String linkerName) { + ValidateResultInner inner = this.serviceClient().validate(resourceUri, linkerName); + if (inner != null) { + return new ValidateResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ValidateResult validate(String resourceUri, String linkerName, Context context) { + ValidateResultInner inner = this.serviceClient().validate(resourceUri, linkerName, context); + if (inner != null) { + return new ValidateResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public SourceConfigurationResult listConfigurations(String resourceUri, String linkerName) { + SourceConfigurationResultInner inner = this.serviceClient().listConfigurations(resourceUri, linkerName); + if (inner != null) { + return new SourceConfigurationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listConfigurationsWithResponse( + String resourceUri, String linkerName, Context context) { + Response inner = + this.serviceClient().listConfigurationsWithResponse(resourceUri, linkerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SourceConfigurationResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LinkerResource getById(String id) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String linkerName = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}", "linkerName"); + if (linkerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'linkers'.", id))); + } + return this.getWithResponse(resourceUri, linkerName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String linkerName = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}", "linkerName"); + if (linkerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'linkers'.", id))); + } + return this.getWithResponse(resourceUri, linkerName, context); + } + + public void deleteById(String id) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String linkerName = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}", "linkerName"); + if (linkerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'linkers'.", id))); + } + this.delete(resourceUri, linkerName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String linkerName = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}", "linkerName"); + if (linkerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'linkers'.", id))); + } + this.delete(resourceUri, linkerName, context); + } + + private LinkersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.servicelinker.ServicelinkerManager manager() { + return this.serviceManager; + } + + public LinkerResourceImpl define(String name) { + return new LinkerResourceImpl(name, this.manager()); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/MicrosoftServiceLinkerBuilder.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/MicrosoftServiceLinkerBuilder.java new file mode 100644 index 0000000000000..88ae7cd2f1f21 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/MicrosoftServiceLinkerBuilder.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.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 MicrosoftServiceLinkerImpl type. */ +@ServiceClientBuilder(serviceClients = {MicrosoftServiceLinkerImpl.class}) +public final class MicrosoftServiceLinkerBuilder { + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MicrosoftServiceLinkerBuilder. + */ + public MicrosoftServiceLinkerBuilder 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 MicrosoftServiceLinkerBuilder. + */ + public MicrosoftServiceLinkerBuilder 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 MicrosoftServiceLinkerBuilder. + */ + public MicrosoftServiceLinkerBuilder 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 MicrosoftServiceLinkerBuilder. + */ + public MicrosoftServiceLinkerBuilder 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 MicrosoftServiceLinkerBuilder. + */ + public MicrosoftServiceLinkerBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MicrosoftServiceLinkerImpl with the provided parameters. + * + * @return an instance of MicrosoftServiceLinkerImpl. + */ + public MicrosoftServiceLinkerImpl 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(); + } + MicrosoftServiceLinkerImpl client = + new MicrosoftServiceLinkerImpl(pipeline, serializerAdapter, defaultPollInterval, environment, endpoint); + return client; + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/MicrosoftServiceLinkerImpl.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/MicrosoftServiceLinkerImpl.java new file mode 100644 index 0000000000000..0f9728cf5c4de --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/MicrosoftServiceLinkerImpl.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.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.servicelinker.fluent.LinkersClient; +import com.azure.resourcemanager.servicelinker.fluent.MicrosoftServiceLinker; +import com.azure.resourcemanager.servicelinker.fluent.OperationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the MicrosoftServiceLinkerImpl type. */ +@ServiceClient(builder = MicrosoftServiceLinkerBuilder.class) +public final class MicrosoftServiceLinkerImpl implements MicrosoftServiceLinker { + /** 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 LinkersClient object to access its operations. */ + private final LinkersClient linkers; + + /** + * Gets the LinkersClient object to access its operations. + * + * @return the LinkersClient object. + */ + public LinkersClient getLinkers() { + return this.linkers; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * Initializes an instance of MicrosoftServiceLinker 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 endpoint server parameter. + */ + MicrosoftServiceLinkerImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.apiVersion = "2022-01-01-preview"; + this.linkers = new LinkersClientImpl(this); + this.operations = new OperationsClientImpl(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(MicrosoftServiceLinkerImpl.class); +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/OperationImpl.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/OperationImpl.java new file mode 100644 index 0000000000000..834a0a1a847c2 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.implementation; + +import com.azure.resourcemanager.servicelinker.fluent.models.OperationInner; +import com.azure.resourcemanager.servicelinker.models.ActionType; +import com.azure.resourcemanager.servicelinker.models.Operation; +import com.azure.resourcemanager.servicelinker.models.OperationDisplay; +import com.azure.resourcemanager.servicelinker.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.servicelinker.ServicelinkerManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.servicelinker.ServicelinkerManager 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.servicelinker.ServicelinkerManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/OperationsClientImpl.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..7c4caa8ca288e --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/OperationsClientImpl.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.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.servicelinker.fluent.OperationsClient; +import com.azure.resourcemanager.servicelinker.fluent.models.OperationInner; +import com.azure.resourcemanager.servicelinker.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final MicrosoftServiceLinkerImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MicrosoftServiceLinkerImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftServiceLinkerOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftServiceLink") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ServiceLinker/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the available ServiceLinker 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> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the available ServiceLinker 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> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the available ServiceLinker 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 listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the available ServiceLinker 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 listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the available ServiceLinker 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 list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists the available ServiceLinker 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 list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/OperationsImpl.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..4360c2d0108b7 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.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.servicelinker.fluent.OperationsClient; +import com.azure.resourcemanager.servicelinker.fluent.models.OperationInner; +import com.azure.resourcemanager.servicelinker.models.Operation; +import com.azure.resourcemanager.servicelinker.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.servicelinker.ServicelinkerManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.servicelinker.ServicelinkerManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.servicelinker.ServicelinkerManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/SourceConfigurationResultImpl.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/SourceConfigurationResultImpl.java new file mode 100644 index 0000000000000..2c9cc1b28b54c --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/SourceConfigurationResultImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.implementation; + +import com.azure.resourcemanager.servicelinker.fluent.models.SourceConfigurationResultInner; +import com.azure.resourcemanager.servicelinker.models.SourceConfiguration; +import com.azure.resourcemanager.servicelinker.models.SourceConfigurationResult; +import java.util.Collections; +import java.util.List; + +public final class SourceConfigurationResultImpl implements SourceConfigurationResult { + private SourceConfigurationResultInner innerObject; + + private final com.azure.resourcemanager.servicelinker.ServicelinkerManager serviceManager; + + SourceConfigurationResultImpl( + SourceConfigurationResultInner innerObject, + com.azure.resourcemanager.servicelinker.ServicelinkerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List configurations() { + List inner = this.innerModel().configurations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SourceConfigurationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicelinker.ServicelinkerManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/Utils.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/Utils.java new file mode 100644 index 0000000000000..665bda23b8d05 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/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.servicelinker.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/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/ValidateResultImpl.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/ValidateResultImpl.java new file mode 100644 index 0000000000000..307f4a82704c4 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/ValidateResultImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.implementation; + +import com.azure.resourcemanager.servicelinker.fluent.models.ValidateResultInner; +import com.azure.resourcemanager.servicelinker.models.AuthType; +import com.azure.resourcemanager.servicelinker.models.ValidateResult; +import com.azure.resourcemanager.servicelinker.models.ValidationResultItem; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class ValidateResultImpl implements ValidateResult { + private ValidateResultInner innerObject; + + private final com.azure.resourcemanager.servicelinker.ServicelinkerManager serviceManager; + + ValidateResultImpl( + ValidateResultInner innerObject, com.azure.resourcemanager.servicelinker.ServicelinkerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String linkerName() { + return this.innerModel().linkerName(); + } + + public Boolean isConnectionAvailable() { + return this.innerModel().isConnectionAvailable(); + } + + public OffsetDateTime reportStartTimeUtc() { + return this.innerModel().reportStartTimeUtc(); + } + + public OffsetDateTime reportEndTimeUtc() { + return this.innerModel().reportEndTimeUtc(); + } + + public String sourceId() { + return this.innerModel().sourceId(); + } + + public String targetId() { + return this.innerModel().targetId(); + } + + public AuthType authType() { + return this.innerModel().authType(); + } + + public List validationDetail() { + List inner = this.innerModel().validationDetail(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ValidateResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicelinker.ServicelinkerManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/package-info.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/package-info.java new file mode 100644 index 0000000000000..436ac3457d6c2 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for MicrosoftServiceLinker. Microsoft.ServiceLinker provider. */ +package com.azure.resourcemanager.servicelinker.implementation; diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ActionType.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ActionType.java new file mode 100644 index 0000000000000..e477542a61a78 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/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.servicelinker.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/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AuthInfoBase.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AuthInfoBase.java new file mode 100644 index 0000000000000..d3a34302fddee --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AuthInfoBase.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The authentication info. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "authType", + defaultImpl = AuthInfoBase.class) +@JsonTypeName("AuthInfoBase") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "secret", value = SecretAuthInfo.class), + @JsonSubTypes.Type(name = "userAssignedIdentity", value = UserAssignedIdentityAuthInfo.class), + @JsonSubTypes.Type(name = "systemAssignedIdentity", value = SystemAssignedIdentityAuthInfo.class), + @JsonSubTypes.Type(name = "servicePrincipalSecret", value = ServicePrincipalSecretAuthInfo.class), + @JsonSubTypes.Type(name = "servicePrincipalCertificate", value = ServicePrincipalCertificateAuthInfo.class) +}) +@Immutable +public class AuthInfoBase { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AuthType.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AuthType.java new file mode 100644 index 0000000000000..822d0c793fc75 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AuthType.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AuthType. */ +public final class AuthType extends ExpandableStringEnum { + /** Static value systemAssignedIdentity for AuthType. */ + public static final AuthType SYSTEM_ASSIGNED_IDENTITY = fromString("systemAssignedIdentity"); + + /** Static value userAssignedIdentity for AuthType. */ + public static final AuthType USER_ASSIGNED_IDENTITY = fromString("userAssignedIdentity"); + + /** Static value servicePrincipalSecret for AuthType. */ + public static final AuthType SERVICE_PRINCIPAL_SECRET = fromString("servicePrincipalSecret"); + + /** Static value servicePrincipalCertificate for AuthType. */ + public static final AuthType SERVICE_PRINCIPAL_CERTIFICATE = fromString("servicePrincipalCertificate"); + + /** Static value secret for AuthType. */ + public static final AuthType SECRET = fromString("secret"); + + /** + * Creates or finds a AuthType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthType. + */ + @JsonCreator + public static AuthType fromString(String name) { + return fromString(name, AuthType.class); + } + + /** @return known AuthType values. */ + public static Collection values() { + return values(AuthType.class); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AzureKeyVaultProperties.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AzureKeyVaultProperties.java new file mode 100644 index 0000000000000..41fdcf7777ab8 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AzureKeyVaultProperties.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The resource properties when type is Azure Key Vault. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("KeyVault") +@Fluent +public final class AzureKeyVaultProperties extends AzureResourcePropertiesBase { + /* + * True if connect via Kubernetes CSI Driver. + */ + @JsonProperty(value = "connectAsKubernetesCsiDriver") + private Boolean connectAsKubernetesCsiDriver; + + /** + * Get the connectAsKubernetesCsiDriver property: True if connect via Kubernetes CSI Driver. + * + * @return the connectAsKubernetesCsiDriver value. + */ + public Boolean connectAsKubernetesCsiDriver() { + return this.connectAsKubernetesCsiDriver; + } + + /** + * Set the connectAsKubernetesCsiDriver property: True if connect via Kubernetes CSI Driver. + * + * @param connectAsKubernetesCsiDriver the connectAsKubernetesCsiDriver value to set. + * @return the AzureKeyVaultProperties object itself. + */ + public AzureKeyVaultProperties withConnectAsKubernetesCsiDriver(Boolean connectAsKubernetesCsiDriver) { + this.connectAsKubernetesCsiDriver = connectAsKubernetesCsiDriver; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AzureResource.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AzureResource.java new file mode 100644 index 0000000000000..511c4257690e4 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AzureResource.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The azure resource info when target service type is AzureResource. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureResource") +@Fluent +public final class AzureResource extends TargetServiceBase { + /* + * The Id of azure resource. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The azure resource connection related properties. + */ + @JsonProperty(value = "resourceProperties") + private AzureResourcePropertiesBase resourceProperties; + + /** + * Get the id property: The Id of azure resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The Id of azure resource. + * + * @param id the id value to set. + * @return the AzureResource object itself. + */ + public AzureResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the resourceProperties property: The azure resource connection related properties. + * + * @return the resourceProperties value. + */ + public AzureResourcePropertiesBase resourceProperties() { + return this.resourceProperties; + } + + /** + * Set the resourceProperties property: The azure resource connection related properties. + * + * @param resourceProperties the resourceProperties value to set. + * @return the AzureResource object itself. + */ + public AzureResource withResourceProperties(AzureResourcePropertiesBase resourceProperties) { + this.resourceProperties = resourceProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (resourceProperties() != null) { + resourceProperties().validate(); + } + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AzureResourcePropertiesBase.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AzureResourcePropertiesBase.java new file mode 100644 index 0000000000000..b551b18943ddf --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/AzureResourcePropertiesBase.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The azure resource properties. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = AzureResourcePropertiesBase.class) +@JsonTypeName("AzureResourcePropertiesBase") +@JsonSubTypes({@JsonSubTypes.Type(name = "KeyVault", value = AzureKeyVaultProperties.class)}) +@Immutable +public class AzureResourcePropertiesBase { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ClientType.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ClientType.java new file mode 100644 index 0000000000000..1b8ecf70cdc81 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ClientType.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.servicelinker.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ClientType. */ +public final class ClientType extends ExpandableStringEnum { + /** Static value none for ClientType. */ + public static final ClientType NONE = fromString("none"); + + /** Static value dotnet for ClientType. */ + public static final ClientType DOTNET = fromString("dotnet"); + + /** Static value java for ClientType. */ + public static final ClientType JAVA = fromString("java"); + + /** Static value python for ClientType. */ + public static final ClientType PYTHON = fromString("python"); + + /** Static value go for ClientType. */ + public static final ClientType GO = fromString("go"); + + /** Static value php for ClientType. */ + public static final ClientType PHP = fromString("php"); + + /** Static value ruby for ClientType. */ + public static final ClientType RUBY = fromString("ruby"); + + /** Static value django for ClientType. */ + public static final ClientType DJANGO = fromString("django"); + + /** Static value nodejs for ClientType. */ + public static final ClientType NODEJS = fromString("nodejs"); + + /** Static value springBoot for ClientType. */ + public static final ClientType SPRING_BOOT = fromString("springBoot"); + + /** + * Creates or finds a ClientType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ClientType. + */ + @JsonCreator + public static ClientType fromString(String name) { + return fromString(name, ClientType.class); + } + + /** @return known ClientType values. */ + public static Collection values() { + return values(ClientType.class); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ConfluentBootstrapServer.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ConfluentBootstrapServer.java new file mode 100644 index 0000000000000..195d2c0345541 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ConfluentBootstrapServer.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The service properties when target service type is ConfluentBootstrapServer. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ConfluentBootstrapServer") +@Fluent +public final class ConfluentBootstrapServer extends TargetServiceBase { + /* + * The endpoint of service. + */ + @JsonProperty(value = "endpoint") + private String endpoint; + + /** + * Get the endpoint property: The endpoint of service. + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Set the endpoint property: The endpoint of service. + * + * @param endpoint the endpoint value to set. + * @return the ConfluentBootstrapServer object itself. + */ + public ConfluentBootstrapServer withEndpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ConfluentSchemaRegistry.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ConfluentSchemaRegistry.java new file mode 100644 index 0000000000000..68321e5ebc965 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ConfluentSchemaRegistry.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The service properties when target service type is ConfluentSchemaRegistry. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ConfluentSchemaRegistry") +@Fluent +public final class ConfluentSchemaRegistry extends TargetServiceBase { + /* + * The endpoint of service. + */ + @JsonProperty(value = "endpoint") + private String endpoint; + + /** + * Get the endpoint property: The endpoint of service. + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Set the endpoint property: The endpoint of service. + * + * @param endpoint the endpoint value to set. + * @return the ConfluentSchemaRegistry object itself. + */ + public ConfluentSchemaRegistry withEndpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/LinkerList.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/LinkerList.java new file mode 100644 index 0000000000000..d3b63c7c0ba6e --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/LinkerList.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicelinker.fluent.models.LinkerResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of Linker. */ +@Fluent +public final class LinkerList { + /* + * The link used to get the next page of Linker list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * The list of Linkers. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the nextLink property: The link used to get the next page of Linker list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of Linker list. + * + * @param nextLink the nextLink value to set. + * @return the LinkerList object itself. + */ + public LinkerList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: The list of Linkers. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of Linkers. + * + * @param value the value value to set. + * @return the LinkerList object itself. + */ + public LinkerList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/LinkerPatch.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/LinkerPatch.java new file mode 100644 index 0000000000000..1328a8126e437 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/LinkerPatch.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicelinker.fluent.models.LinkerProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A linker to be updated. */ +@Fluent +public final class LinkerPatch { + /* + * Linker properties + */ + @JsonProperty(value = "properties") + private LinkerProperties innerProperties; + + /** + * Get the innerProperties property: Linker properties. + * + * @return the innerProperties value. + */ + private LinkerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the targetService property: The target service properties. + * + * @return the targetService value. + */ + public TargetServiceBase targetService() { + return this.innerProperties() == null ? null : this.innerProperties().targetService(); + } + + /** + * Set the targetService property: The target service properties. + * + * @param targetService the targetService value to set. + * @return the LinkerPatch object itself. + */ + public LinkerPatch withTargetService(TargetServiceBase targetService) { + if (this.innerProperties() == null) { + this.innerProperties = new LinkerProperties(); + } + this.innerProperties().withTargetService(targetService); + return this; + } + + /** + * Get the authInfo property: The authentication type. + * + * @return the authInfo value. + */ + public AuthInfoBase authInfo() { + return this.innerProperties() == null ? null : this.innerProperties().authInfo(); + } + + /** + * Set the authInfo property: The authentication type. + * + * @param authInfo the authInfo value to set. + * @return the LinkerPatch object itself. + */ + public LinkerPatch withAuthInfo(AuthInfoBase authInfo) { + if (this.innerProperties() == null) { + this.innerProperties = new LinkerProperties(); + } + this.innerProperties().withAuthInfo(authInfo); + return this; + } + + /** + * Get the clientType property: The application client type. + * + * @return the clientType value. + */ + public ClientType clientType() { + return this.innerProperties() == null ? null : this.innerProperties().clientType(); + } + + /** + * Set the clientType property: The application client type. + * + * @param clientType the clientType value to set. + * @return the LinkerPatch object itself. + */ + public LinkerPatch withClientType(ClientType clientType) { + if (this.innerProperties() == null) { + this.innerProperties = new LinkerProperties(); + } + this.innerProperties().withClientType(clientType); + return this; + } + + /** + * Get the provisioningState property: The provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the vNetSolution property: The VNet solution. + * + * @return the vNetSolution value. + */ + public VNetSolution vNetSolution() { + return this.innerProperties() == null ? null : this.innerProperties().vNetSolution(); + } + + /** + * Set the vNetSolution property: The VNet solution. + * + * @param vNetSolution the vNetSolution value to set. + * @return the LinkerPatch object itself. + */ + public LinkerPatch withVNetSolution(VNetSolution vNetSolution) { + if (this.innerProperties() == null) { + this.innerProperties = new LinkerProperties(); + } + this.innerProperties().withVNetSolution(vNetSolution); + return this; + } + + /** + * Get the secretStore property: An option to store secret value in secure place. + * + * @return the secretStore value. + */ + public SecretStore secretStore() { + return this.innerProperties() == null ? null : this.innerProperties().secretStore(); + } + + /** + * Set the secretStore property: An option to store secret value in secure place. + * + * @param secretStore the secretStore value to set. + * @return the LinkerPatch object itself. + */ + public LinkerPatch withSecretStore(SecretStore secretStore) { + if (this.innerProperties() == null) { + this.innerProperties = new LinkerProperties(); + } + this.innerProperties().withSecretStore(secretStore); + return this; + } + + /** + * Get the scope property: connection scope in source service. + * + * @return the scope value. + */ + public String scope() { + return this.innerProperties() == null ? null : this.innerProperties().scope(); + } + + /** + * Set the scope property: connection scope in source service. + * + * @param scope the scope value to set. + * @return the LinkerPatch object itself. + */ + public LinkerPatch withScope(String scope) { + if (this.innerProperties() == null) { + this.innerProperties = new LinkerProperties(); + } + this.innerProperties().withScope(scope); + 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/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/LinkerResource.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/LinkerResource.java new file mode 100644 index 0000000000000..5acdc3bbffad6 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/LinkerResource.java @@ -0,0 +1,351 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicelinker.fluent.models.LinkerResourceInner; + +/** An immutable client-side representation of LinkerResource. */ +public interface LinkerResource { + /** + * 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 systemData property: The system data. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the targetService property: The target service properties. + * + * @return the targetService value. + */ + TargetServiceBase targetService(); + + /** + * Gets the authInfo property: The authentication type. + * + * @return the authInfo value. + */ + AuthInfoBase authInfo(); + + /** + * Gets the clientType property: The application client type. + * + * @return the clientType value. + */ + ClientType clientType(); + + /** + * Gets the provisioningState property: The provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the vNetSolution property: The VNet solution. + * + * @return the vNetSolution value. + */ + VNetSolution vNetSolution(); + + /** + * Gets the secretStore property: An option to store secret value in secure place. + * + * @return the secretStore value. + */ + SecretStore secretStore(); + + /** + * Gets the scope property: connection scope in source service. + * + * @return the scope value. + */ + String scope(); + + /** + * Gets the inner com.azure.resourcemanager.servicelinker.fluent.models.LinkerResourceInner object. + * + * @return the inner object. + */ + LinkerResourceInner innerModel(); + + /** The entirety of the LinkerResource definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScopeStage, DefinitionStages.WithCreate { + } + /** The LinkerResource definition stages. */ + interface DefinitionStages { + /** The first stage of the LinkerResource definition. */ + interface Blank extends WithScopeStage { + } + /** The stage of the LinkerResource definition allowing to specify parent resource. */ + interface WithScopeStage { + /** + * Specifies resourceUri. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @return the next definition stage. + */ + WithCreate withExistingResourceUri(String resourceUri); + } + /** + * The stage of the LinkerResource 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.WithTargetService, + DefinitionStages.WithAuthInfo, + DefinitionStages.WithClientType, + DefinitionStages.WithVNetSolution, + DefinitionStages.WithSecretStore, + DefinitionStages.WithScope { + /** + * Executes the create request. + * + * @return the created resource. + */ + LinkerResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LinkerResource create(Context context); + } + /** The stage of the LinkerResource definition allowing to specify targetService. */ + interface WithTargetService { + /** + * Specifies the targetService property: The target service properties. + * + * @param targetService The target service properties. + * @return the next definition stage. + */ + WithCreate withTargetService(TargetServiceBase targetService); + } + /** The stage of the LinkerResource definition allowing to specify authInfo. */ + interface WithAuthInfo { + /** + * Specifies the authInfo property: The authentication type.. + * + * @param authInfo The authentication type. + * @return the next definition stage. + */ + WithCreate withAuthInfo(AuthInfoBase authInfo); + } + /** The stage of the LinkerResource definition allowing to specify clientType. */ + interface WithClientType { + /** + * Specifies the clientType property: The application client type. + * + * @param clientType The application client type. + * @return the next definition stage. + */ + WithCreate withClientType(ClientType clientType); + } + /** The stage of the LinkerResource definition allowing to specify vNetSolution. */ + interface WithVNetSolution { + /** + * Specifies the vNetSolution property: The VNet solution.. + * + * @param vNetSolution The VNet solution. + * @return the next definition stage. + */ + WithCreate withVNetSolution(VNetSolution vNetSolution); + } + /** The stage of the LinkerResource definition allowing to specify secretStore. */ + interface WithSecretStore { + /** + * Specifies the secretStore property: An option to store secret value in secure place. + * + * @param secretStore An option to store secret value in secure place. + * @return the next definition stage. + */ + WithCreate withSecretStore(SecretStore secretStore); + } + /** The stage of the LinkerResource definition allowing to specify scope. */ + interface WithScope { + /** + * Specifies the scope property: connection scope in source service.. + * + * @param scope connection scope in source service. + * @return the next definition stage. + */ + WithCreate withScope(String scope); + } + } + /** + * Begins update for the LinkerResource resource. + * + * @return the stage of resource update. + */ + LinkerResource.Update update(); + + /** The template for LinkerResource update. */ + interface Update + extends UpdateStages.WithTargetService, + UpdateStages.WithAuthInfo, + UpdateStages.WithClientType, + UpdateStages.WithVNetSolution, + UpdateStages.WithSecretStore, + UpdateStages.WithScope { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LinkerResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LinkerResource apply(Context context); + } + /** The LinkerResource update stages. */ + interface UpdateStages { + /** The stage of the LinkerResource update allowing to specify targetService. */ + interface WithTargetService { + /** + * Specifies the targetService property: The target service properties. + * + * @param targetService The target service properties. + * @return the next definition stage. + */ + Update withTargetService(TargetServiceBase targetService); + } + /** The stage of the LinkerResource update allowing to specify authInfo. */ + interface WithAuthInfo { + /** + * Specifies the authInfo property: The authentication type.. + * + * @param authInfo The authentication type. + * @return the next definition stage. + */ + Update withAuthInfo(AuthInfoBase authInfo); + } + /** The stage of the LinkerResource update allowing to specify clientType. */ + interface WithClientType { + /** + * Specifies the clientType property: The application client type. + * + * @param clientType The application client type. + * @return the next definition stage. + */ + Update withClientType(ClientType clientType); + } + /** The stage of the LinkerResource update allowing to specify vNetSolution. */ + interface WithVNetSolution { + /** + * Specifies the vNetSolution property: The VNet solution.. + * + * @param vNetSolution The VNet solution. + * @return the next definition stage. + */ + Update withVNetSolution(VNetSolution vNetSolution); + } + /** The stage of the LinkerResource update allowing to specify secretStore. */ + interface WithSecretStore { + /** + * Specifies the secretStore property: An option to store secret value in secure place. + * + * @param secretStore An option to store secret value in secure place. + * @return the next definition stage. + */ + Update withSecretStore(SecretStore secretStore); + } + /** The stage of the LinkerResource update allowing to specify scope. */ + interface WithScope { + /** + * Specifies the scope property: connection scope in source service.. + * + * @param scope connection scope in source service. + * @return the next definition stage. + */ + Update withScope(String scope); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LinkerResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LinkerResource refresh(Context context); + + /** + * Validate a link. + * + * @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 validation result for a linker. + */ + ValidateResult validate(); + + /** + * Validate a link. + * + * @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 validation result for a linker. + */ + ValidateResult validate(Context context); + + /** + * list source configurations for a linker. + * + * @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 configurations for source resource, include appSettings, connectionString and serviceBindings. + */ + SourceConfigurationResult listConfigurations(); + + /** + * list source configurations for a linker. + * + * @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 configurations for source resource, include appSettings, connectionString and serviceBindings along with + * {@link Response}. + */ + Response listConfigurationsWithResponse(Context context); +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/Linkers.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/Linkers.java new file mode 100644 index 0000000000000..83917f64f0c1b --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/Linkers.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.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 Linkers. */ +public interface Linkers { + /** + * Returns list of Linkers which connects to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @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 list of Linker as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * Returns list of Linkers which connects to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @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 list of Linker as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri, Context context); + + /** + * Returns Linker resource for a given name. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 linker of source and target resource. + */ + LinkerResource get(String resourceUri, String linkerName); + + /** + * Returns Linker resource for a given name. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 linker of source and target resource along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String linkerName, Context context); + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName); + + /** + * Delete a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 resourceUri, String linkerName, Context context); + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 validation result for a linker. + */ + ValidateResult validate(String resourceUri, String linkerName); + + /** + * Validate a link. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 validation result for a linker. + */ + ValidateResult validate(String resourceUri, String linkerName, Context context); + + /** + * list source configurations for a linker. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 configurations for source resource, include appSettings, connectionString and serviceBindings. + */ + SourceConfigurationResult listConfigurations(String resourceUri, String linkerName); + + /** + * list source configurations for a linker. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param linkerName The name Linker resource. + * @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 configurations for source resource, include appSettings, connectionString and serviceBindings along with + * {@link Response}. + */ + Response listConfigurationsWithResponse( + String resourceUri, String linkerName, Context context); + + /** + * Returns Linker resource for a given name. + * + * @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 linker of source and target resource along with {@link Response}. + */ + LinkerResource getById(String id); + + /** + * Returns Linker resource for a given name. + * + * @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 linker of source and target resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a link. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a link. + * + * @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 LinkerResource resource. + * + * @param name resource name. + * @return the first stage of the new LinkerResource definition. + */ + LinkerResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/Operation.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/Operation.java new file mode 100644 index 0000000000000..e68e7d7d00dd1 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/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.servicelinker.models; + +import com.azure.resourcemanager.servicelinker.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.servicelinker.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/OperationDisplay.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/OperationDisplay.java new file mode 100644 index 0000000000000..7def6a8572eda --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/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.servicelinker.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/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/OperationListResult.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/OperationListResult.java new file mode 100644 index 0000000000000..e67087ab4762f --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/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.servicelinker.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.servicelinker.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/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/Operations.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/Operations.java new file mode 100644 index 0000000000000..2ed86c9c352db --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/Operations.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.servicelinker.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists the available ServiceLinker 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 list(); + + /** + * Lists the available ServiceLinker 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 list(Context context); +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/Origin.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/Origin.java new file mode 100644 index 0000000000000..cf08530459948 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/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.servicelinker.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/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SecretAuthInfo.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SecretAuthInfo.java new file mode 100644 index 0000000000000..b0d853dc9699b --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SecretAuthInfo.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The authentication info when authType is secret. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authType") +@JsonTypeName("secret") +@Fluent +public final class SecretAuthInfo extends AuthInfoBase { + /* + * Username or account name for secret auth. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Password or account key for secret auth. + */ + @JsonProperty(value = "secret") + private String secret; + + /** + * Get the name property: Username or account name for secret auth. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Username or account name for secret auth. + * + * @param name the name value to set. + * @return the SecretAuthInfo object itself. + */ + public SecretAuthInfo withName(String name) { + this.name = name; + return this; + } + + /** + * Get the secret property: Password or account key for secret auth. + * + * @return the secret value. + */ + public String secret() { + return this.secret; + } + + /** + * Set the secret property: Password or account key for secret auth. + * + * @param secret the secret value to set. + * @return the SecretAuthInfo object itself. + */ + public SecretAuthInfo withSecret(String secret) { + this.secret = secret; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SecretStore.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SecretStore.java new file mode 100644 index 0000000000000..626bbf8763302 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SecretStore.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.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An option to store secret value in secure place. */ +@Fluent +public final class SecretStore { + /* + * The key vault id to store secret + */ + @JsonProperty(value = "keyVaultId") + private String keyVaultId; + + /** + * Get the keyVaultId property: The key vault id to store secret. + * + * @return the keyVaultId value. + */ + public String keyVaultId() { + return this.keyVaultId; + } + + /** + * Set the keyVaultId property: The key vault id to store secret. + * + * @param keyVaultId the keyVaultId value to set. + * @return the SecretStore object itself. + */ + public SecretStore withKeyVaultId(String keyVaultId) { + this.keyVaultId = keyVaultId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ServicePrincipalCertificateAuthInfo.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ServicePrincipalCertificateAuthInfo.java new file mode 100644 index 0000000000000..dc9e1d46c5726 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ServicePrincipalCertificateAuthInfo.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The authentication info when authType is servicePrincipal certificate. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authType") +@JsonTypeName("servicePrincipalCertificate") +@Fluent +public final class ServicePrincipalCertificateAuthInfo extends AuthInfoBase { + /* + * Application clientId for servicePrincipal auth. + */ + @JsonProperty(value = "clientId", required = true) + private String clientId; + + /* + * Principal Id for servicePrincipal auth. + */ + @JsonProperty(value = "principalId", required = true) + private String principalId; + + /* + * ServicePrincipal certificate for servicePrincipal auth. + */ + @JsonProperty(value = "certificate", required = true) + private String certificate; + + /** + * Get the clientId property: Application clientId for servicePrincipal auth. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: Application clientId for servicePrincipal auth. + * + * @param clientId the clientId value to set. + * @return the ServicePrincipalCertificateAuthInfo object itself. + */ + public ServicePrincipalCertificateAuthInfo withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the principalId property: Principal Id for servicePrincipal auth. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: Principal Id for servicePrincipal auth. + * + * @param principalId the principalId value to set. + * @return the ServicePrincipalCertificateAuthInfo object itself. + */ + public ServicePrincipalCertificateAuthInfo withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the certificate property: ServicePrincipal certificate for servicePrincipal auth. + * + * @return the certificate value. + */ + public String certificate() { + return this.certificate; + } + + /** + * Set the certificate property: ServicePrincipal certificate for servicePrincipal auth. + * + * @param certificate the certificate value to set. + * @return the ServicePrincipalCertificateAuthInfo object itself. + */ + public ServicePrincipalCertificateAuthInfo withCertificate(String certificate) { + this.certificate = certificate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (clientId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property clientId in model ServicePrincipalCertificateAuthInfo")); + } + if (principalId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property principalId in model ServicePrincipalCertificateAuthInfo")); + } + if (certificate() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property certificate in model ServicePrincipalCertificateAuthInfo")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServicePrincipalCertificateAuthInfo.class); +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ServicePrincipalSecretAuthInfo.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ServicePrincipalSecretAuthInfo.java new file mode 100644 index 0000000000000..97ccd04b48fce --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ServicePrincipalSecretAuthInfo.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The authentication info when authType is servicePrincipal secret. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authType") +@JsonTypeName("servicePrincipalSecret") +@Fluent +public final class ServicePrincipalSecretAuthInfo extends AuthInfoBase { + /* + * ServicePrincipal application clientId for servicePrincipal auth. + */ + @JsonProperty(value = "clientId", required = true) + private String clientId; + + /* + * Principal Id for servicePrincipal auth. + */ + @JsonProperty(value = "principalId", required = true) + private String principalId; + + /* + * Secret for servicePrincipal auth. + */ + @JsonProperty(value = "secret", required = true) + private String secret; + + /** + * Get the clientId property: ServicePrincipal application clientId for servicePrincipal auth. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: ServicePrincipal application clientId for servicePrincipal auth. + * + * @param clientId the clientId value to set. + * @return the ServicePrincipalSecretAuthInfo object itself. + */ + public ServicePrincipalSecretAuthInfo withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the principalId property: Principal Id for servicePrincipal auth. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: Principal Id for servicePrincipal auth. + * + * @param principalId the principalId value to set. + * @return the ServicePrincipalSecretAuthInfo object itself. + */ + public ServicePrincipalSecretAuthInfo withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the secret property: Secret for servicePrincipal auth. + * + * @return the secret value. + */ + public String secret() { + return this.secret; + } + + /** + * Set the secret property: Secret for servicePrincipal auth. + * + * @param secret the secret value to set. + * @return the ServicePrincipalSecretAuthInfo object itself. + */ + public ServicePrincipalSecretAuthInfo withSecret(String secret) { + this.secret = secret; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (clientId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property clientId in model ServicePrincipalSecretAuthInfo")); + } + if (principalId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property principalId in model ServicePrincipalSecretAuthInfo")); + } + if (secret() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property secret in model ServicePrincipalSecretAuthInfo")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServicePrincipalSecretAuthInfo.class); +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SourceConfiguration.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SourceConfiguration.java new file mode 100644 index 0000000000000..3311bebb78d66 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SourceConfiguration.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.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A configuration item for source resource. */ +@Fluent +public final class SourceConfiguration { + /* + * The name of setting. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value of setting + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name property: The name of setting. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of setting. + * + * @param name the name value to set. + * @return the SourceConfiguration object itself. + */ + public SourceConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of setting. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of setting. + * + * @param value the value value to set. + * @return the SourceConfiguration object itself. + */ + public SourceConfiguration withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SourceConfigurationResult.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SourceConfigurationResult.java new file mode 100644 index 0000000000000..808f14d90d877 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SourceConfigurationResult.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.resourcemanager.servicelinker.fluent.models.SourceConfigurationResultInner; +import java.util.List; + +/** An immutable client-side representation of SourceConfigurationResult. */ +public interface SourceConfigurationResult { + /** + * Gets the configurations property: The configuration properties for source resource. + * + * @return the configurations value. + */ + List configurations(); + + /** + * Gets the inner com.azure.resourcemanager.servicelinker.fluent.models.SourceConfigurationResultInner object. + * + * @return the inner object. + */ + SourceConfigurationResultInner innerModel(); +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SystemAssignedIdentityAuthInfo.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SystemAssignedIdentityAuthInfo.java new file mode 100644 index 0000000000000..2548428a6cd9d --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/SystemAssignedIdentityAuthInfo.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The authentication info when authType is systemAssignedIdentity. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authType") +@JsonTypeName("systemAssignedIdentity") +@Immutable +public final class SystemAssignedIdentityAuthInfo extends AuthInfoBase { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/TargetServiceBase.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/TargetServiceBase.java new file mode 100644 index 0000000000000..1238b95ce7994 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/TargetServiceBase.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.servicelinker.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The target service properties. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = TargetServiceBase.class) +@JsonTypeName("TargetServiceBase") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "AzureResource", value = AzureResource.class), + @JsonSubTypes.Type(name = "ConfluentBootstrapServer", value = ConfluentBootstrapServer.class), + @JsonSubTypes.Type(name = "ConfluentSchemaRegistry", value = ConfluentSchemaRegistry.class) +}) +@Immutable +public class TargetServiceBase { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/Type.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/Type.java new file mode 100644 index 0000000000000..3797f51df8053 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/Type.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.servicelinker.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Type. */ +public final class Type extends ExpandableStringEnum { + /** Static value AzureResource for Type. */ + public static final Type AZURE_RESOURCE = fromString("AzureResource"); + + /** Static value ConfluentBootstrapServer for Type. */ + public static final Type CONFLUENT_BOOTSTRAP_SERVER = fromString("ConfluentBootstrapServer"); + + /** Static value ConfluentSchemaRegistry for Type. */ + public static final Type CONFLUENT_SCHEMA_REGISTRY = fromString("ConfluentSchemaRegistry"); + + /** Static value KeyVault for Type. */ + public static final Type KEY_VAULT = fromString("KeyVault"); + + /** + * Creates or finds a Type from its string representation. + * + * @param name a name to look for. + * @return the corresponding Type. + */ + @JsonCreator + public static Type fromString(String name) { + return fromString(name, Type.class); + } + + /** @return known Type values. */ + public static Collection values() { + return values(Type.class); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/UserAssignedIdentityAuthInfo.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/UserAssignedIdentityAuthInfo.java new file mode 100644 index 0000000000000..d5df511c9e118 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/UserAssignedIdentityAuthInfo.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The authentication info when authType is userAssignedIdentity. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authType") +@JsonTypeName("userAssignedIdentity") +@Fluent +public final class UserAssignedIdentityAuthInfo extends AuthInfoBase { + /* + * Client Id for userAssignedIdentity. + */ + @JsonProperty(value = "clientId") + private String clientId; + + /* + * Subscription id for userAssignedIdentity. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /** + * Get the clientId property: Client Id for userAssignedIdentity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: Client Id for userAssignedIdentity. + * + * @param clientId the clientId value to set. + * @return the UserAssignedIdentityAuthInfo object itself. + */ + public UserAssignedIdentityAuthInfo withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the subscriptionId property: Subscription id for userAssignedIdentity. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Subscription id for userAssignedIdentity. + * + * @param subscriptionId the subscriptionId value to set. + * @return the UserAssignedIdentityAuthInfo object itself. + */ + public UserAssignedIdentityAuthInfo withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/VNetSolution.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/VNetSolution.java new file mode 100644 index 0000000000000..dcda963576349 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/VNetSolution.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.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The VNet solution for linker. */ +@Fluent +public final class VNetSolution { + /* + * Type of VNet solution. + */ + @JsonProperty(value = "type") + private VNetSolutionType type; + + /** + * Get the type property: Type of VNet solution. + * + * @return the type value. + */ + public VNetSolutionType type() { + return this.type; + } + + /** + * Set the type property: Type of VNet solution. + * + * @param type the type value to set. + * @return the VNetSolution object itself. + */ + public VNetSolution withType(VNetSolutionType 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/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/VNetSolutionType.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/VNetSolutionType.java new file mode 100644 index 0000000000000..36526f4705042 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/VNetSolutionType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VNetSolutionType. */ +public final class VNetSolutionType extends ExpandableStringEnum { + /** Static value serviceEndpoint for VNetSolutionType. */ + public static final VNetSolutionType SERVICE_ENDPOINT = fromString("serviceEndpoint"); + + /** Static value privateLink for VNetSolutionType. */ + public static final VNetSolutionType PRIVATE_LINK = fromString("privateLink"); + + /** + * Creates or finds a VNetSolutionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding VNetSolutionType. + */ + @JsonCreator + public static VNetSolutionType fromString(String name) { + return fromString(name, VNetSolutionType.class); + } + + /** @return known VNetSolutionType values. */ + public static Collection values() { + return values(VNetSolutionType.class); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ValidateResult.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ValidateResult.java new file mode 100644 index 0000000000000..eca072855b080 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ValidateResult.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.resourcemanager.servicelinker.fluent.models.ValidateResultInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of ValidateResult. */ +public interface ValidateResult { + /** + * Gets the linkerName property: The linker name. + * + * @return the linkerName value. + */ + String linkerName(); + + /** + * Gets the isConnectionAvailable property: A boolean value indicating whether the connection is available or not. + * + * @return the isConnectionAvailable value. + */ + Boolean isConnectionAvailable(); + + /** + * Gets the reportStartTimeUtc property: The start time of the validation report. + * + * @return the reportStartTimeUtc value. + */ + OffsetDateTime reportStartTimeUtc(); + + /** + * Gets the reportEndTimeUtc property: The end time of the validation report. + * + * @return the reportEndTimeUtc value. + */ + OffsetDateTime reportEndTimeUtc(); + + /** + * Gets the sourceId property: The resource id of the linker source application. + * + * @return the sourceId value. + */ + String sourceId(); + + /** + * Gets the targetId property: The resource Id of target service. + * + * @return the targetId value. + */ + String targetId(); + + /** + * Gets the authType property: The authentication type. + * + * @return the authType value. + */ + AuthType authType(); + + /** + * Gets the validationDetail property: The detail of validation result. + * + * @return the validationDetail value. + */ + List validationDetail(); + + /** + * Gets the inner com.azure.resourcemanager.servicelinker.fluent.models.ValidateResultInner object. + * + * @return the inner object. + */ + ValidateResultInner innerModel(); +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ValidationItemResult.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ValidationItemResult.java new file mode 100644 index 0000000000000..b74ed06bfa7f0 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ValidationItemResult.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.servicelinker.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ValidationItemResult. */ +public final class ValidationItemResult extends ExpandableStringEnum { + /** Static value success for ValidationItemResult. */ + public static final ValidationItemResult SUCCESS = fromString("success"); + + /** Static value failed for ValidationItemResult. */ + public static final ValidationItemResult FAILED = fromString("failed"); + + /** Static value warning for ValidationItemResult. */ + public static final ValidationItemResult WARNING = fromString("warning"); + + /** + * Creates or finds a ValidationItemResult from its string representation. + * + * @param name a name to look for. + * @return the corresponding ValidationItemResult. + */ + @JsonCreator + public static ValidationItemResult fromString(String name) { + return fromString(name, ValidationItemResult.class); + } + + /** @return known ValidationItemResult values. */ + public static Collection values() { + return values(ValidationItemResult.class); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ValidationResultItem.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ValidationResultItem.java new file mode 100644 index 0000000000000..256a41c5ff5e0 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/ValidationResultItem.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The validation item for a linker. */ +@Fluent +public final class ValidationResultItem { + /* + * The validation item name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The display name of validation item + */ + @JsonProperty(value = "description") + private String description; + + /* + * The result of validation + */ + @JsonProperty(value = "result") + private ValidationItemResult result; + + /* + * The error message of validation result + */ + @JsonProperty(value = "errorMessage") + private String errorMessage; + + /* + * The error code of validation result + */ + @JsonProperty(value = "errorCode") + private String errorCode; + + /** + * Get the name property: The validation item name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The validation item name. + * + * @param name the name value to set. + * @return the ValidationResultItem object itself. + */ + public ValidationResultItem withName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: The display name of validation item. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The display name of validation item. + * + * @param description the description value to set. + * @return the ValidationResultItem object itself. + */ + public ValidationResultItem withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the result property: The result of validation. + * + * @return the result value. + */ + public ValidationItemResult result() { + return this.result; + } + + /** + * Set the result property: The result of validation. + * + * @param result the result value to set. + * @return the ValidationResultItem object itself. + */ + public ValidationResultItem withResult(ValidationItemResult result) { + this.result = result; + return this; + } + + /** + * Get the errorMessage property: The error message of validation result. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Set the errorMessage property: The error message of validation result. + * + * @param errorMessage the errorMessage value to set. + * @return the ValidationResultItem object itself. + */ + public ValidationResultItem withErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Get the errorCode property: The error code of validation result. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The error code of validation result. + * + * @param errorCode the errorCode value to set. + * @return the ValidationResultItem object itself. + */ + public ValidationResultItem withErrorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/package-info.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/package-info.java new file mode 100644 index 0000000000000..a1d8eb02753da --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for MicrosoftServiceLinker. Microsoft.ServiceLinker provider. */ +package com.azure.resourcemanager.servicelinker.models; diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/package-info.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/package-info.java new file mode 100644 index 0000000000000..538867ccb5f47 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/com/azure/resourcemanager/servicelinker/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for MicrosoftServiceLinker. Microsoft.ServiceLinker provider. */ +package com.azure.resourcemanager.servicelinker; diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/module-info.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/main/java/module-info.java new file mode 100644 index 0000000000000..de6b726226e64 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/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.servicelinker { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.servicelinker; + exports com.azure.resourcemanager.servicelinker.fluent; + exports com.azure.resourcemanager.servicelinker.fluent.models; + exports com.azure.resourcemanager.servicelinker.models; + + opens com.azure.resourcemanager.servicelinker.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.servicelinker.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerCreateOrUpdateSamples.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e0104051c4903 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerCreateOrUpdateSamples.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.servicelinker.generated; + +import com.azure.resourcemanager.servicelinker.models.AzureResource; +import com.azure.resourcemanager.servicelinker.models.SecretAuthInfo; +import com.azure.resourcemanager.servicelinker.models.SecretStore; +import com.azure.resourcemanager.servicelinker.models.VNetSolution; +import com.azure.resourcemanager.servicelinker.models.VNetSolutionType; + +/** Samples for Linker CreateOrUpdate. */ +public final class LinkerCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/PutLinkWithServiceEndpoint.json + */ + /** + * Sample code: PutLinkWithServiceEndpoint. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void putLinkWithServiceEndpoint( + com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .define("linkName") + .withExistingResourceUri( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app") + .withTargetService( + new AzureResource() + .withId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db")) + .withAuthInfo(new SecretAuthInfo().withName("name").withSecret("secret")) + .withVNetSolution(new VNetSolution().withType(VNetSolutionType.SERVICE_ENDPOINT)) + .withSecretStore( + new SecretStore() + .withKeyVaultId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.KeyVault/vaults/test-kv")) + .create(); + } + + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/PutLink.json + */ + /** + * Sample code: PutLink. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void putLink(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .define("linkName") + .withExistingResourceUri( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app") + .withTargetService( + new AzureResource() + .withId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db")) + .withAuthInfo(new SecretAuthInfo().withName("name").withSecret("secret")) + .create(); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerDeleteSamples.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerDeleteSamples.java new file mode 100644 index 0000000000000..f8f8b00986966 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.generated; + +import com.azure.core.util.Context; + +/** Samples for Linker Delete. */ +public final class LinkerDeleteSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/DeleteLink.json + */ + /** + * Sample code: DeleteLink. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void deleteLink(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .delete( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + "linkName", + Context.NONE); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerGetSamples.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerGetSamples.java new file mode 100644 index 0000000000000..99d9b22e9b84b --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.generated; + +import com.azure.core.util.Context; + +/** Samples for Linker Get. */ +public final class LinkerGetSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/Link.json + */ + /** + * Sample code: Link. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void link(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .getWithResponse( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + "linkName", + Context.NONE); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerListConfigurationsSamples.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerListConfigurationsSamples.java new file mode 100644 index 0000000000000..550544f416b84 --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerListConfigurationsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.generated; + +import com.azure.core.util.Context; + +/** Samples for Linker ListConfigurations. */ +public final class LinkerListConfigurationsSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/GetConfigurations.json + */ + /** + * Sample code: GetConfiguration. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void getConfiguration(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .listConfigurationsWithResponse( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + "linkName", + Context.NONE); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerListSamples.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerListSamples.java new file mode 100644 index 0000000000000..cd54b3d73cdef --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.generated; + +import com.azure.core.util.Context; + +/** Samples for Linker List. */ +public final class LinkerListSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/LinkList.json + */ + /** + * Sample code: LinkList. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void linkList(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .list( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + Context.NONE); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerUpdateSamples.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerUpdateSamples.java new file mode 100644 index 0000000000000..cc3f051b12bad --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicelinker.models.AzureResource; +import com.azure.resourcemanager.servicelinker.models.LinkerResource; +import com.azure.resourcemanager.servicelinker.models.ServicePrincipalSecretAuthInfo; + +/** Samples for Linker Update. */ +public final class LinkerUpdateSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/PatchLink.json + */ + /** + * Sample code: PatchLink. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void patchLink(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + LinkerResource resource = + manager + .linkers() + .getWithResponse( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + "linkName", + Context.NONE) + .getValue(); + resource + .update() + .withTargetService( + new AzureResource() + .withId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db")) + .withAuthInfo( + new ServicePrincipalSecretAuthInfo().withClientId("name").withPrincipalId("id").withSecret("secret")) + .apply(); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerValidateSamples.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerValidateSamples.java new file mode 100644 index 0000000000000..7dddcd156372a --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/LinkerValidateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicelinker.generated; + +import com.azure.core.util.Context; + +/** Samples for Linker Validate. */ +public final class LinkerValidateSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/ValidateLinkSuccess.json + */ + /** + * Sample code: ValidateLinkSuccess. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void validateLinkSuccess(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager + .linkers() + .validate( + "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + "linkName", + Context.NONE); + } +} diff --git a/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/OperationsListSamples.java b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..030c78ab6ae2b --- /dev/null +++ b/sdk/servicelinker/azure-resourcemanager-servicelinker/src/samples/java/com/azure/resourcemanager/servicelinker/generated/OperationsListSamples.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.servicelinker.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/OperationsList.json + */ + /** + * Sample code: GetConfiguration. + * + * @param manager Entry point to ServicelinkerManager. + */ + public static void getConfiguration(com.azure.resourcemanager.servicelinker.ServicelinkerManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/servicelinker/ci.yml b/sdk/servicelinker/ci.yml new file mode 100644 index 0000000000000..8977f46f730b3 --- /dev/null +++ b/sdk/servicelinker/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/servicelinker/ci.yml + - sdk/servicelinker/azure-resourcemanager-servicelinker/ + exclude: + - sdk/servicelinker/pom.xml + - sdk/servicelinker/azure-resourcemanager-servicelinker/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicelinker/ci.yml + - sdk/servicelinker/azure-resourcemanager-servicelinker/ + exclude: + - sdk/servicelinker/pom.xml + - sdk/servicelinker/azure-resourcemanager-servicelinker/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: servicelinker + Artifacts: + - name: azure-resourcemanager-servicelinker + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerservicelinker diff --git a/sdk/servicelinker/pom.xml b/sdk/servicelinker/pom.xml new file mode 100644 index 0000000000000..b0df6c2bba84c --- /dev/null +++ b/sdk/servicelinker/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-servicelinker-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-servicelinker + + + +